Claude Code v2.1.311: sessions past 200K tokens keep going, self-hosted-runner hold flags#

Published by

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

Claude Code v2.1.311, the release after v2.1.310, keeps a standard-context session going past 200K tokens: where that request used to stop with "Usage credits required for 1M context," it now compacts the conversation and continues.[1] It also adds --hold-idle-file and --max-hold-min to self-hosted-runner and clears a batch of background-session and subagent reliability bugs.[1]

Standard-context sessions compact past 200K#

A standard-context session that ran over 200K tokens used to stop with "Usage credits required for 1M context." In v2.1.311 that request compacts the conversation and continues instead.[1]

self-hosted-runner: hold an idle session while leftover processes live#

self-hosted-runner gets two flags for sessions that leave a process running after the model goes idle.[1]

FlagWhat It Does
--hold-idle-file <path>Does not release an idle session (the --release-idle-session-min release) while <path> is a regular file changed recently; the host keeps the file fresh while a process the session left running, such as a nohup or tmux process, lives. The path is re-checked on an interval. It does not hold at startup, at --retire-at, at the shutdown-defer ceiling, or at --kill-session-after-min. Env form SELF_HOSTED_RUNNER_HOLD_IDLE_FILE.
--max-hold-min <n>Used with --hold-idle-file: releases the session anyway N minutes after it went idle; 0 disables the hold. Env form SELF_HOSTED_RUNNER_MAX_HOLD_MS.

The reliability batch#

Most of v2.1.311 is fixes, and several land on background work and subagents.[1]

  • Background sessions that crashed between turns now restart while the session is attached, pinned, or has a scheduled task or wake-up set.[1]
  • Subagents can use MCP tools from servers that finish connecting after the subagent starts.[1]
  • SubagentStop hooks fire once when a subagent finishes, not about twice a minute per running subagent.[1]
  • Write and Edit no longer stall for up to 5 seconds and report 0 lines changed when changing thousands of lines in a file.[1]
  • claude -p and SDK sessions no longer save transcript messages out of order or keep messages that were taken back.[1]
  • Automatic compaction no longer leaves Claude reading stale MEMORY.md and CLAUDE.md content after those files were edited earlier in the session.[1]
  • Interrupting Claude now takes effect even while an MCP server has not answered a resource read or a skill is still downloading.[1]

ultrathink runs the turn at xhigh effort#

In the interactive terminal, ultrathink now runs its turn at xhigh effort on Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.1 through Anthropic's API; typed while Claude is working, it raises the effort for the rest of that turn.[1]

New Environment Variables#

VariableWhat It Does
CLAUDE_CODE_EVEN_MORE_DANGEROUSLY_SKIP_PERMISSIONSWhen set, dangerous rm commands can run without a confirmation prompt in bypass permissions mode. The build carries guards where it has no effect: in a session without managed settings, or on Windows while the registry cannot be read for managed settings, dangerous rm commands keep their usual checks. Present in v2.1.311 and absent from v2.1.310; the v2.1.311 changelog does not name it.

Two config changes also land for gateway and settings-file users. Model settings on Bedrock, Mantle, Vertex and Foundry now load from a signed file on downloads.claude.ai, and CLAUDE_CODE_MODEL_CATALOG=off turns that off.[1] DISABLE_COMPACT in settings files and in a mod's $.env.set can now only turn compaction off, not back on.[1]

When a session looks idle but still has work in flight#

Several changes touch the same seam: a session the model has gone quiet on while something it started keeps running. The self-hosted-runner hold file keeps a session slot while a leftover nohup or tmux process keeps a file fresh; background sessions that crash between turns come back when attached, pinned, or scheduled; and a long session past 200K tokens folds down and continues rather than stopping.[1]

The hold is bounded on both ends. --max-hold-min releases the slot a set number of minutes after idle even while the file stays fresh, and the hold never applies at startup, at --retire-at, at the shutdown-defer ceiling, or at --kill-session-after-min.[1] So the file can delay only the soft idle release, not any of the runner's hard lifecycle bounds, which keeps a wedged process from parking a slot indefinitely.

Sources#

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

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


Previous Claude Code analysis: v2.1.310 (October 24, 2026)

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