Claude Code v2.1.318: sign-in expiry warnings and an experimental Code Mode#

Published by

Part of the Claude Code Version Tracker series. | Official Env Vars | Official Changelog

Claude Code 2.1.318, the build after 2.1.317, surfaces when a stored claude.ai sign-in expires: claude auth status and claude -p JSON now carry the end date, with a one-line stderr warning in the 10 days before it lapses. It also fixes --continue losing earlier conversation after a tool call's retries ran out (a regression in 2.1.314) and idle compaction replacing a conversation with a non-summary reply.

Sign-in expiry, before it bites#

A stored claude.ai sign-in now reports when it ends. claude auth status carries the date as loginExpiresAt, and claude -p JSON results carry it as credential_expires_at.[1] Starting 10 days before the sign-in lapses, claude -p text output also prints a one-line stderr warning, so a scripted or headless run gets notice before a token expires mid-job.

A gateway role and a lighter mod fork#

assume_role is now available on mantle upstreams of the Claude apps gateway, so an upstream can assume a role in another AWS account; the changelog names per-developer AWS cost attribution as one use.[1] It needs SigV4 source credentials, either access keys or the ambient AWS credential chain.

A mod's $.model.fork takes an effort option, so a quick side job can run at low whatever effort the session is using, and the result reports the effort that was sent.[1]

An experimental Code Mode#

CLAUDE_CODE_EXPERIMENTAL_CODE_MODE turns on an experimental Code Mode, off by default. At startup the session settles a Code Mode opt-in and records the answer; a refused opt-in is followed by a one-line stderr warning. Companion variables CLAUDE_CODE_EXPERIMENTAL_CODE_MODE_RESTART and CLAUDE_CODE_EXPERIMENTAL_CODE_MODE_RESTARTED_FROM carry a restart through the mode. The changelog notes the build now records your answer when it asks to turn on the mods it writes in a session.[1]

Fixes across restart, handoff, and shared homes#

Restarted sessions no longer re-send a message that failed with an API error ahead of a newer one waiting behind it, nor drop an interrupted turn after a large image read or a tool retry, and a deleted transcript is no longer re-created with its last prompt when an idle non-interactive session exits.[1] Remote-control hosts, the background daemon, and self-hosted runners no longer fail to start new sessions with spawn ENOENT after an update or version cleanup removed the binary of a still-running process, and version cleanup no longer treats another user's running process (such as one left by sudo claude) as dead. An approved shell command after a runner or cloud restart now runs in the folder it was asked in.

On a shared network home, /logout, claude auth logout, and claude mcp remove no longer report success when the config file could not be written, and a session is no longer refused at startup by an allowedProviders list another login stored. Permission prompts are no longer answered by keys typed just after a message is sent or before a slow prompt appears, and in headless sessions Stop now cancels a message sent right after a model change. Connections no longer all fail when NODE_EXTRA_CA_CERTS is empty, not PEM, or starts with a damaged certificate, and the "Now using usage credits" notice no longer reappears about every 30 seconds while a background subagent runs.[1]

New environment variables#

VariableWhat It Does
CLAUDE_CODE_CONFIG_LOCK_WAIT_MSSets how long, in milliseconds, a config write waits for the config file's lock before failing. claude mcp add and remove now wait for the lock or exit 1 instead of writing without it; the error names CLAUDE_CODE_CONFIG_LOCK_WAIT_MS=60000 to wait up to a minute when another process holds the file.
CLAUDE_CODE_EXPERIMENTAL_CODE_MODETurns on the experimental Code Mode, off by default. The session settles a Code Mode opt-in at startup and records the answer, printing a one-line stderr warning when it was refused. CLAUDE_CODE_EXPERIMENTAL_CODE_MODE_RESTART and CLAUDE_CODE_EXPERIMENTAL_CODE_MODE_RESTARTED_FROM carry a restart through the mode.
CLAUDE_CODE_REPLY_GATE_POLICYCarries a reply-gate policy into agent-loop sessions: a list of terminal tools and caps on how many times Claude asks after a person's message, after its own task or a server event, and otherwise.

When more than one session shares a home#

A large share of this release lands where more than one Claude Code process touches the same home directory or account. The config-file lock, the allowedProviders list stored by another login, the Not logged in exit when another terminal signs in to the same account and organization, and the version cleanup that could delete the binary of a still-running process owned by another user all describe one setup: several sessions, one machine or one account.

These are the conditions on a shared build server or a self-hosted runner, where sessions start and stop around each other and sign-ins drift toward expiry between runs. The sign-in expiry date, the stderr warning that precedes it, and CLAUDE_CODE_CONFIG_LOCK_WAIT_MS are the pieces a long-lived automated setup can read and tune; the rest hold without configuration.

This analysis is conducted for educational and research purposes under fair use principles. All trademarks and software referenced belong to their respective owners.

Sources#

  1. Claude Code Official Changelog, v2.1.318 release notes

Previous Claude Code analysis: v2.1.317 (November 3, 2026)

All 86 Claude Code analyses: Claude Code Version Tracker · Official Claude Code changelog