Claude Code 2.1.311:自托管 runner 可闲置挂起,超 20 万 token 改为压缩续跑
Claude Code 2.1.311 为 self-hosted-runner 增加闲置挂起参数,VS Code 代码块着色与 Skills 使用分析,并将超 20 万 token 的标准上下文会话改为压缩后续跑;另含 ultrathink 提至 xhigh、16 项改进与 56 项修复。
社区整理的变更说明指向 Claude Code 2.1.311 官方 changelog。相对上一版,本版在自托管与长上下文上的行为更值得研发团队关注。
新增:--hold-idle-file 与 --max-hold-min 用于 self-hosted-runner,可在主机仍上报其遗留进程时保持空闲会话;VS Code 侧为回复中的代码块增加浅色/深色/高对比深色语法着色,并为较慢的 UserPromptSubmit hooks 显示 “Running …” 状态;Claude Tag 分析新增 Skills 视图,可看 Slack 频道里各挂载 skill 的调用频次与闲置项。另有面向 Explanatory 输出风格的使用提示。
变更:交互终端中的 ultrathink 会在经 Anthropic API 的 Opus 5.5、Sonnet 5.5、Haiku 5.5 与 Fable 5.1 上将该轮提到 xhigh 努力等级;彩虹提示仅在关键字确实能提努力时出现。/code-review 把努力等级前置,且仅在明确要求时用 max。Bedrock、Mantle、Vertex、Foundry 改从 downloads.claude.ai 上的签名文件加载模型设置(可用 CLAUDE_CODE_MODEL_CATALOG=off 关闭)。
改进与修复(节选):宣称 16 项改进(含 Pro/Max 更快启动、超时 shell 先吐已有输出并后台继续、压缩摘要为空时再请求一次)与 56 项修复。关键修复包括:标准上下文会话在超过约 20 万 token 时不再误报需 1M 额度而中断,改为压缩后续跑;CLAUDE.md 超长列表项导致的启动卡住;子代理无法使用启动后才连上的 MCP 工具;上千行级 Write/Edit 最多卡住约五秒等。
flowchart LR
A[长会话逼近/超过 200K] --> B{旧行为}
B --> C[误报需 1M 额度并停止]
A --> D{2.1.311}
D --> E[压缩摘要]
E --> F[继续同会话]
升级前建议对照本队 self-hosted runner 与 VS Code 插件版本阅读官方 changelog,在非生产仓库验证闲置挂起与长上下文压缩是否符合预期。
Claude Code 2.1.311 is here
🚨 BREAKING: Claude Code 2.1.311 is here
Added:
--hold-idle-fileand--max-hold-minforself-hosted-runner, to keep an idle session while your host reports processes it left running- Tip for the Explanatory output style when you ask Claude for explanations
- [VS Code] Syntax coloring for code blocks in Claude's replies (light, dark, high contrast dark)
- [VS Code] "Running UserPromptSubmit hooks" spinner status for slow hooks
- [Claude Tag] Skills view in analytics: how often Claude runs each attached skill in Slack channels and which go unused
Changed:
ultrathinkin the interactive terminal runs its turn at xhigh effort on Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.1 via Anthropic's API; typed while Claude is working, it raises the rest of that turn- The
ultrathinkrainbow appears only where the keyword can raise effort - Ctrl+D in agent view: pressing it twice on empty input exits
- Model names drop the
[1m]suffix where it has no effect (still accepted) /code-reviewputs the effort level first and uses max only when asked- Bedrock, Mantle, Vertex and Foundry load model settings from a signed file on http://downloads.claude.ai (CLAUDE_CODE_MODEL_CATALOG=off to turn off)
- [VS Code] Sessions start with
DISABLE_TELEMETRYset while VS Code telemetry is off
Improved (16):
- Faster startup for Pro and Max accounts
- Shell commands that hit their timeout show output so far and keep running in the background
- Compaction asks for the summary once more when the reply has none
Fixed (56), including:
- Standard-context sessions stopping with "Usage credits required for 1M context" over 200K tokens; they now compact and continue
- Long startup freezes when a CLAUDE.md holds a very long list item
- Subagents unable to use MCP tools from servers that connect after they start
- Write and Edit stalling up to 5 seconds on edits of thousands of lines +52 more fixes
Changelog: https://code.claude.com/docs/en/changelog