Skip to main content

Claude Code v2.1.318: Sign-In Expiry and Network Home Fixes

Claude Code v2.1.318 shows when a claude.ai sign-in expires, protects ~/.claude.json on network homes, and changes IDE extension installs and deniedMcpServers.

Claude Code v2.1.318 has 84 changelog entries: 47 fixes, 15 improvements, 11 additions, 10 changes, and 1 removal. Unattended runs can now see when a stored claude.ai sign-in will end, and a large group of fixes and improvements protects ~/.claude.json, settings files and the stored login, especially on shared and network home directories. Mods gain an effort option on $.model.fork, and the Claude apps gateway gains assume_role on mantle upstreams. Several entries change behavior that scripts and admins rely on, from IDE extension installs to deniedMcpServers URL entries and the self-hosted runner orchestrator’s log lines; they are collected under “Changed Behavior Worth Noting” below.

What’s New

See When a Stored claude.ai Sign-In Ends

Two additions make the end of a stored claude.ai sign-in visible before it stops a job:

  • claude auth status now includes the date the sign-in ends as loginExpiresAt, and claude -p JSON results include it as credential_expires_at.
  • claude -p text output prints a one-line warning on stderr, starting 10 days before the sign-in ends.

When a stored claude.ai login does reach its time limit, the sign-in failure now says so, and in claude -p it names claude auth login and claude setup-token. If you run claude -p on a schedule with a claude.ai sign-in, you can now check the date in advance instead of learning about it from a failed run.

Mods and the Claude Apps Gateway

  • effort on $.model.fork. A mod’s $.model.fork takes an effort option, so a quick side job can run at low whatever effort the session uses. The result reports the effort that was sent.
  • assume_role on mantle upstreams. The Claude apps gateway’s mantle upstreams accept assume_role, for a role in another AWS account and for per-developer AWS cost attribution.
  • Your answer on mods Claude wrote is recorded. When Claude Code asks to turn on the mods it wrote in a session, it now keeps a record of your answer.

Cloud Sessions

  • No repository. A cloud session on an Anthropic-hosted environment can now start without picking a repository.
  • Chrome names. Cloud sessions now have the usual Chrome names, so tools other than Playwright can find the built-in Chromium through google-chrome and CHROME_PATH.
  • New session button. The card shown when a cloud session’s environment was deleted, where the message box is hidden, now has a New session button.

Shared Home Directories and ~/.claude.json

Ten entries, seven fixes and three improvements, cover how Claude Code saves and recovers ~/.claude.json, settings files and the stored login.

On Shared and Network Home Directories

  • No more false success. When the config file could not be updated on a shared network home directory, /logout, claude auth logout and claude mcp remove reported success, and changes to trust, consent or MCP settings were dropped with no word.
  • Saves hold up better. ~/.claude.json, settings files and the stored login are less often deleted, briefly emptied, or replaced by a near-empty or older copy when saved on shared network home directories.
  • A second look. On network file systems, sessions now look again when the configuration file is wrongly reported as missing, so fewer start without your MCP servers and trusted folders.
  • No empty login file. The stored login was replaced by an empty file when a network home directory had no room left for data but still took new files.

Damaged Files, Backups and Locks

  • Invalid JSON is left alone. Non-interactive launches replaced a ~/.claude.json that isn’t valid JSON with defaults. The start now fails, says how to restore the file, and leaves it as is (anthropics/claude-code#87551).
  • Empty is not corrupted. An empty ~/.claude.json with no backup was reported as corrupted; Claude Code now starts as it does when the file is missing.
  • Restore commands. The restore command printed for a damaged or missing ~/.claude.json no longer names an empty or cut-off backup, and no longer fails on a read-only file.
  • Retention cleanup keeps a backup. Retention cleanup could leave a home that only runs claude -p with no ~/.claude.json backup. It now takes a fresh backup before deleting the last good one.
  • claude mcp add and remove take the lock. They wrote the config without its lock; they now wait for it or exit 1. The changelog notes that another job’s save can still replace a saved server.
  • Fewer rewrites. Unattended runs (claude -p, SDK apps) no longer rewrite ~/.claude.json on every run when nothing in it changed.

Changed Behavior Worth Noting

  • No IDE extension installs from an IDE terminal. Started in an IDE terminal, Claude Code no longer installs or updates the IDE extension. Use /ide from a terminal outside the editor, or your editor’s extensions view.
  • Background subagents background long shell commands. On all providers, a background subagent now moves a shell command to the background after 3 minutes, so the prompt cache doesn’t expire while it runs.
  • deniedMcpServers URL entries block more. A URL entry now also blocks Anthropic-provided servers whose upstream URL matches, and connectors in cloud sessions and on self-hosted runners, where the session is given the connector’s own URL. Elsewhere, deny a connector by name. If you deny servers by URL, check what your entries now match.
  • Managed Agents onboarding defaults to auto. /claude-api managed-agents-onboard now gives a new agent’s built-in tools, and a quickstart template’s MCP tools, the auto permission policy (“Judge risky actions”) by default, matching the Claude Console. Say “run without asking” to opt out.
  • Self-hosted runner orchestrator log lines. ok session=… now prints at every log level on stdout (it was debug only, on stderr), with reason=… after jti=…. nack session=… now ends its fields with reason=… after retryable=…. Update scripts that match retryable=true: or retryable=false:.
  • The 2.1.288 thinking fix is removed. v2.1.288 fixed resuming a conversation started on 2.1.286 or earlier so that the model’s earlier thinking was kept. That fix has been removed, and that thinking can now be dropped.

Three more entries change what a script sees:

  • A non-interactive launch now fails at start, instead of replacing the file with defaults, when ~/.claude.json isn’t valid JSON.
  • claude mcp add and claude mcp remove now wait for the config lock or exit 1.
  • claude -p text output can carry the new one-line stderr warning in the 10 days before a stored claude.ai sign-in ends.

The other five changes:

  • Subagents stop instead of switching models when “Switch models when a message is flagged” is set to “Ask each time”.
  • On Bedrock, Vertex, Foundry, or with telemetry off, a subagent progress summary can now wait up to 5 minutes for the subagent’s pending response when the prompt cache is cold.
  • What a mod attaches at prompt.submit now stays in the user’s turn rather than going out as a system message.
  • The /permissions rule details, built-in rules and delete confirmation views use the standard dialog, and pressing Ctrl+C twice there now goes back or cancels instead of quitting.
  • In cloud sessions, connector search results tell Claude that the search covers only part of the connector directory.

Sign-In and Account Fixes

  • Not logged in after another sign-in. Jobs exited with Not logged in when another terminal or host signed in again to the same account and organization on the same home.
  • Plugin commands and token refresh. claude plugin commands could exit before a slow token refresh was saved, which could sign you out on the next run.
  • Another login’s allowedProviders. Sessions were refused at startup by an allowedProviders list that another login on the same machine had stored.
  • setup-token with forceLoginOrgUUID. Tokens from setup-token were refused at start on machines with forceLoginOrgUUID, even when the token belonged to a permitted organization.

Sessions, Subagents and Headless Runs

  • --continue sometimes lost the earlier conversation after a malformed tool call’s retries ran out, a regression in 2.1.314.
  • Idle compaction could replace a conversation with a reply that was not a summary.
  • Restarted sessions no longer re-send a message that failed with an API error ahead of the newer message waiting behind it, and no longer drop the interrupted turn when the restart came right after Claude read a large image or retried a tool call.
  • Stop in headless sessions now cancels or stops a message sent right after a model change, as it would a queued message; that message used to keep running after Stop.
  • False success in headless runs. claude -p and Agent SDK sessions reported success when an API error cut off a reply while a mod hooked turn.step, and a mod’s turn.step hook could make a stopped reply finish as a success.
  • Custom slash commands that fail, or that only Claude can invoke, printed nothing in claude -p and SDK sessions.
  • Deleted session transcripts were re-created with their last prompt when an idle non-interactive session exited.
  • Workflows resumed after a usage limit re-ran agents that had already finished.
  • The “Now using usage credits” notice reappeared about every 30 seconds while a background subagent was running.

MCP, Plugins and the Terminal

  • stdio MCP servers that exit on the version probe are no longer re-probed on every start, and a server that dies in under 3 seconds for its own reason is also pinned to the legacy handshake for 7 days.
  • MCP tool errors: a call made before the tool is loaded now returns the tool’s input schema.
  • claude plugin validate passed a custom-named marketplace file that claude plugin marketplace add rejects.
  • Permission prompts could be answered by keys typed just after sending a message, or before a slow prompt appeared.
  • macOS sessions with many running Bash commands stalled while memory grew.
  • macOS’s built-in /bin/bash: git commits and pull request creation are more reliable when the Bash tool runs it.
  • NODE_EXTRA_CA_CERTS: a file that is empty, not PEM, or starts with a damaged certificate made every connection fail. Readable certificates are now used, with a warning on stderr.
  • Auto-update now retries right away after a brief network failure while verifying a release, instead of waiting for the next check.
  • Smaller fixes and improvements: the error for a too-large image in a request with more than 20 images now shows the API’s limit instead of always saying 2000px; the runtime in background shell details updates while the dialog is open; Claude leaving the status field out of a PushNotification call no longer produces a duplicate notification; /design revoke no longer reports success when the request failed with a 404; “Ask your admin for more usage” in the usage limit menu sends the request in one step; and You should know toasts say “try again” instead of “press 2”, which only works in the terminal.

Cloud Sessions, Remote Control and Self-Hosted Runners

  • Approved commands run in the folder they were asked in. A shell command approved after a self-hosted runner or cloud session restart ran in the session’s start folder instead. If the folder it was asked in can’t be entered, the command is now not run.
  • Binaries of running processes. claude remote-control hosts, the background daemon and self-hosted runners failed to start new sessions (spawn ENOENT) after an update or version cleanup removed the binary of a still-running process. Version cleanup also treated a running Claude Code process owned by another user, for example one left by sudo claude, as dead, which could delete its binary.
  • Cloud session restarts. Claude is now told when an approved connector tool is unavailable after a cloud session restart, and cloud sessions are no longer stopped in the middle of a turn when the service refuses uploads for several minutes.
  • Setup hooks: variables a Setup hook writes to CLAUDE_ENV_FILE did not reach the Bash tool in some cloud sessions.
  • iPhone app: a cloud session’s turn showed as finished while it kept running, after a response was cut off at a tool call or a refused image or document was removed.
  • GitHub Actions logs: gh run view --log and gh api log requests in cloud sessions now get the log in most environments, not an unreachable redirect.
  • Create PR failures: most failure messages in cloud and Remote Control sessions now give the reason or a link to GitHub instead of saying Try again.
  • /mcp in cloud sessions counted tools the model can’t use; a server’s row now shows how many of its tools are available.
  • Remote Control: /remote-control no longer shows a session as available after a failed connection; a missing working folder now produces an error that names the folder instead of a misleading “spawn error: ENOENT”; side-by-side checkouts of one repository each show their own folder name in the environment menu’s Remote Control rows; and a fork of a terminal fork is titled “Name (fork 2)” when the app doesn’t set a title. Remote sessions also reconnect faster after a pause or sleep.
  • Self-hosted runner: the orchestrator’s spawn-runner hook environment gains CLAUDE_RUNNER_SPAWN_REASON, which says why Anthropic sent the request (for example runner_lost or resumed) and is unset when none was sent. A startup warning now flags --release-idle-session-min when it is the last argument with no value (still ignored) or has a value of only spaces (still read as 0).

Gateway, VS Code, Claude Tag and Code Review

  • Gateway: a new log warning fires when the Google access token from a federation (external_account) credentials file is about to expire. The log hints about listen.trusted_proxies now say to list only a proxy that adds the connecting address to X-Forwarded-For itself, and the warning when AWS CountTokens fails on Amazon Bedrock now says that Claude Code, not the gateway, counts after the 501, and points at IAM only when AWS denies access.
  • VS Code: a window whose sign-in the organization’s settings refuse no longer starts a new Claude Code process in the background every minute; the sign-in screen shows what Claude Code printed when its sign-in status check fails; and a long word in the chat panel’s error banner no longer pushes its close button out of view.
  • Claude Tag: keyboard focus and screen reader announcements in Claude Tag admin setup are fixed, and pressing Escape in the connect form no longer also closes the Add dialog.
  • Code Review: the analytics page retries once after a server or network failure, then shows a Try again banner instead of empty cards.

How to Update

  1. Check your installed version: claude --version
  2. Update in place: claude update
  3. If a script parses the self-hosted runner orchestrator’s nack session=… lines, update any match on retryable=true: or retryable=false:.