Claude Code 发布 v2.1.328,为 Opus 4.6/Sonnet 4.6 新增 auto 权限模式
v2.1.328
用 Claude Code 跑 agent 的朋友可以升级了:auto 模式让 Bedrock、Google Cloud、Microsoft Foundry 上的 Opus 4.6 和 Sonnet 4.6 会话不用手动调权限,mcp_tool hooks 还能调用失败自动阻断。自托管 runner 也补了排队和失败指标,运维同学值得看看。
Anthropic 为 Claude Code 推出 v2.1.328 版本。新增的 auto 模式支持 Claude Opus 4.6 和 Sonnet 4.6,覆盖 Amazon Bedrock、Google Cloud 的 Agent Platform、Microsoft Foundry 和 Claude apps gateway 四个平台,未指定权限模式的交互式会话会默认进入 auto 模式。mcp_tool hooks 新增 "onFailure": "block" 选项,hook 调用失败时会直接阻断对应操作,行为与 command 和 HTTP hooks 对齐。
工具链方面,新版本提供 CLAUDE_CODE_DISABLE_DEFERRED_TOOL_RESUME 环境变量,让宿主程序能阻止 claude -p --resume 和 --continue 执行被 hook 延后的工具调用;嵌入 Claude Code 的应用可启用 policy 插件的 allowManagedModsOnly 选项,且管理员托管设置仍具最高优先级。自托管 runner 增加了 --repository-folder、--hook-label、--metadata 等参数,并在 /metrics 中新增两个 orchestrator 指标:会话排队等待时长(按原因分类)和启动失败放弃计数。
Bug 修复清单覆盖十余项,包括 zsh 中以 = 开头的词导致的 "not found" 错误、自动 compaction 错误复用旧 system prompt、长文本 markdown 渲染冻结、权限提示时 Esc 键丢失、慢连接下粘贴内容被截断输入,以及第三方 provider 下保存定时任务误删其他任务等问题。/status 和 claude doctor 现在会在 OpenTelemetry exporter 缺少 endpoint 时给出数据丢失警告。
v2.1.328
What's changed Added auto mode for Claude Opus 4.6 and Sonnet 4.6 on Amazon Bedrock, Google Cloud's Agent Platform, Microsoft Foundry and Claude apps gateway; interactive sessions with no permission mode start in it Added "onFailure": "block" for mcp_tool hooks, as for command and HTTP hooks: a hook whose call fails blocks the action Added a warning when a message from a session that skips permission prompts may be held and dropped by a cloud session Added a notice in /status and claude doctor when an OpenTelemetry exporter has no endpoint and its data would likely be lost Added CLAUDE_CODE_DISABLE_DEFERRED_TOOL_RESUME , which lets a host stop claude -p --resume and --continue from running a tool call that a hook deferred Added support for apps that embed Claude Code to switch on the policy plugin's allowManagedModsOnly option; an admin's managed settings still win Added a startup warning to the Claude apps gateway when a policy's maxEffortLevel is not a valid effort level Self-hosted runner: Added --repository-folder to name the folder that sessions use for a repository at --capacity 1 , in place of its path under the base folder, which can't be a symbolic link Self-hosted runner: Added a start-up warning when the host's settings.json sets a default permission mode that sessions ignore Self-hosted runner: Added --hook-label to claude self-hosted-runner orchestrator , to hand chosen session labels to the spawn-runner hook Self-hosted runner: Added --metadata key=value to claude --environment , to label a session for the spawn-runner hook Self-hosted runner: Added claude_code_self_hosted_orchestrator_session_queue_wait_by_reason_seconds to the orchestrator's /metrics , so a re-opened session's wait can be told from a new one's Self-hosted runner: Added an orchestrator metric, claude_code_self_hosted_orchestrator_sessions_given_up_total , that counts by cause how often Anthropic gave up starting a runner for a session Fixed Bash commands in zsh stopping with a "not found" error at a word that starts with = , such as echo ==== or [ a == b ] ; =cmd no longer expands to a command's path Fixed automatic compaction reusing the session's earlier system prompt instead of rebuilding it the way /compact does Fixed markdown rendering freezing on some very long or malformed input Fixed rare screen freezes Fixed Esc often being lost at a permission prompt or question when you typed straight after it; in terminals that send Alt as Esc and a key, an unused Alt or Option key now declines there Fixed a paste or a terminal's reply being typed into the prompt when a slow connection cut it in two Fixed saving a scheduled task erasing the project's other saved tasks when the scheduled tasks file can't be read, on third-party providers or with telemetry or feature flags turned off Fixed a scheduled task with a typo in the project's scheduled tasks file being deleted the next time that file was saved Fixed a case where a resumed cloud session could lose its compaction summary or recent messages when a message was saved late Fixed the token counts on the spinner and for subagents counting a retried reply twice, missing replies that were not streamed, and standing still while Claude thinks Fixed the error shown when usage credits run out mid-response, which named a rate limit Fixed auto mode failing every turn outside Claude Desktop with CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS set behind a gateway rejecting betas, on Bedrock, Agent Platform, Foundry or Claude apps gateway Fixed CLAUDE_STREAM_IDLE_TIMEOUT_MS not lengthening the 5-minute connection limit on gateways, custom base URLs and cloud providers Fixed some Claude Desktop sessions on third-party providers, other than scheduled tasks, ending for good with "Prompt is too long" after large tool results; the largest are now left out Fixed MCP tools whose input schema starts with anyOf , oneOf or allOf going missing on third-party providers or with telemetry or feature flags turned off Fixed an MCP tool with an invalid input schema failing requests on third-party providers or with telemetry or feature flags turned off; the tool is now left out and Claude is told why Fixed effort being turned off for a subagent's model for the session if Bedrock, Google Cloud's Agent Platform or Foundry refused its progress summary's effort setting (regression in 2.1.327) Fixed Code Mode stopping a script when a permission prompt outside auto or bypass mode, a plan approval or a question stayed open for ten minutes Fixed Code Mode scripts in auto and bypass-permissions modes failing to call an MCP server that had connected while the previous script was running Fixed Code Mode scripts not running in the background in auto or bypass permissions mode in a session chosen in the claude --resume picker Fixed Code Mode losing a loaded skill, hook context or a note typed with a permission approval when resuming a session in which one reply ran several scripts Fixed Claude not being told that a Code Mode script was cut off when the session was resumed from the picker or in a mode that asks for permission Fixed Code Mode silently using undefined for top-level variables that an earlier failed script never set Fixed Code Mode scripts not being told when a failing command's long output was cut Fixed Code Mode refusing valid scripts that start with a { block Fixed Code Mode refusing scripts that use both a top-level await and a top-level return Fixed an @-mentioned small file not being attached in Code Mode after a script had read or written it Fixed Code Mode offering write() and edit() to read-only subagents that can't call them Fixed Claude starting a turn by itself in Code Mode when Esc was followed by a command such as /model Fixed Claude in Code Mode not being told to run workflows only when you ask, or the workflow size you set in /config Fixed Remote Control repeating the same disconnect message, and telling you to retry a session that can't reconnect Fixed a waiting permission prompt being lost, and its answer ignored, when a remote session restarted while the service was slow Fixed cloud sessions resuming a cleared conversation after a rewind followed by /clear Fixed a remote session losing a turn's tool calls and results when its runner or worker was lost after a dropped model stream had been retried Fixed cloud and Remote Control sessions that just started, or have an @ in their title, being unreachable in cross-session messaging from a session with Remote Control on Fixed Claude being told that cloud sessions can never reply; it now learns when a reply can come and how else to get the result Fixed /diff , the Changes pane of Remote Control sessions and the diff beside an edit leaving out committed work after a command moved into another repository Fixed Remote Control not showing a running workflow's agents when a session run by an IDE extension or other SDK app is opened over an hour after the workflow last made progress Remote Control: Fixed an idle Desktop or VS Code session showing as running after Remote Control is turned on Fixed the model saying background agents were still running after an SDK interrupt had stopped them Fixed Send now in the desktop app and SDK hosts telling Claude that a stopped web search found no results Fixed Cmd+letter being typed into the prompt in terminals that report Cmd Fixed Ctrl+click opening a link twice in GNOME Terminal, side mouse buttons acting as clicks, and the first wheel notch in the other direction being ignored after a pause, in fullscreen mode Fixed Shift+Enter in Konsole outside tmux and ssh, and Alt shortcuts on non-Latin keyboard layouts in terminals that speak the kitty keyboard protocol Linux: Fixed pasting in other apps freezing while Claude Code is suspended with Ctrl+Z, when xclip or wl-copy is installed Linux: Fixed Ctrl+V missing the clipboard image, pasting an old one or hanging Fixed text copied in fullscreen mode including the quote bar, losing spaces at line wraps when a drag scrolled upward, or missing words under the "Jump to bottom" pill Fixed an image path pasted into a ! command becoming an attachment Fixed Ctrl+C showing no exit warning while the ? shortcuts list is open Fixed Ctrl+R search in fullscreen mode and the /theme color editor picking the wrong row when keys arrive together, and keys being dropped there and in the search of /config and /plugin Fixed wrong or missing colors inside GNU screen Fixed many background notifications cutting into the top border of open dialogs in fullscreen mode Fixed a message to a background agent showing a long file path in place of a pasted image Fixed /goal removing a skill's Stop hook, or ending early on another hook's result, when both had the same wording Fixed /bug saying cancelled after the report was sent Fixed Esc not dismissing the transcript share question for Pro and Max users Fixed /hooks losing your place when going back Fixed /export writing a file named .txt when the name was left empty Fixed /terminal-setup in Zed replacing a symlinked keymap.json with a plain file Fixed /install-github-app adding a code review workflow when asked to update the existing workflow file Fixed /plugin reopening a skill, or closing the open page, when a slow save or removal finished after you went back Fixed /plugin asking to uninstall the wrong plugin, or ignoring Esc, after leaving a plugin while a change was still running Fixed typing and arrow keys not working on the /plugin Installed tab after a search with no results or a click on the tab row Fixed holding Enter in /plugin turning off several installed plugins Fixed the /usage plugin total stopping at 2,000 tokens on 1M context models, and low token estimates in /usage and /plugin when no model is picked Fixed Esc on the Bedrock access keys step closing /login instead of going back Fixed /exit and Ctrl+D describing running work differently, and /exit warning about a workflow that had stopped Fixed Claude calling an artifact private after reading one in a shared folder or publishing to another organization's, and saying only named people can open one when its folder's people can too Fixed a plugin's toast sometimes showing another plugin's text Fixed a mod saved just after a turn began sometimes reloading mid-turn instead of at the turn's end Fixed one malformed OTEL_RESOURCE_ATTRIBUTES entry dropping the variable's other labels from metric points, events, and spans. Now only that entry is left off Fixed agent hooks running past their timeout while compacting after a request was refused as too large Fixed a crash at startup when FORCE_COLOR is set to a negative number Fixed a crash in secret masking when the machine is almost out of memory Fixed the Bash sandbox on Linux renaming .git/HEAD after each command when the branch name is not valid UTF-8 Self-hosted runner: Fixed all running sessions being stopped when a proxy or web filter answered a poll with HTTP 200 and a body such as {} ; the runner now retries such a poll Self-hosted runner: Fixed deletion of a kept clone's objects or refs, and of commits that existed only there, after a temporary disk error; that start now fails instead Fixed self-hosted runners stopping when their token ran out on a host whose clock is slow or was set back Self-hosted runner: Fixed sessions with Anthropic-managed git losing git access to GitHub after a script or hook in the session ran claude again Fixed self-hosted runners with Anthropic-managed git being unable to fetch or push where the machine's git config sets http.proactiveAuth Self-hosted runner: Fixed a runner that exited without telling the server when setup failed after it had registered; it now deregisters with a reason, and an on-demand runner reports the failed start Self-hosted runner: Fixed archiving or requeueing a session not taking effect while it waited for another session to prepare the same repository ( --capacity above 1) Self-hosted runner: Fixed a session with a damaged .claude.json failing every later start under --trust-workspace false ; it now starts on defaults, with MCP servers turned off there on again Self-hosted runner: Fixed a failed start's message losing the words that say what failed when a checkout hook or git printed a lot Fixed the self-hosted runner skipping its post-session hook when a disk stalled for a few seconds; on a dead disk a session's end can take 25 seconds longer by default Fixed self-hosted runners: a session that resumes in a new Claude config directory no longer loses its task list Fixed Claude not being told when a self-hosted session starts without one of its repositories, and why Self-hosted runner: Fixed --correlation-id of claude --environment not reaching the spawn-runner hook Fixed the self-hosted runner setup wizard's key rotation advice, which now warns that revoking a key stops the sessions running under it Improved claude -p and SDK sessions to fetch managed-settings plugins that have their own git repository, in the background, for a later session Improved how soon managed-settings plugins from a git marketplace load on a fresh machine in claude -p , SDK and Claude Desktop sessions; a short run may exit up to 30 seconds later Improved the time to resume large sessions Improved memory use when resuming a session with many images Improved memory use and response time in long SDK and desktop sessions that run slow commands or tools Improved Code Mode's speed in auto and bypass-permissions modes by removing a 0.75 second pause after most scripts Improved prompt caching for new Code Mode sessions that have MCP servers, and Claude is now told when a server is still connecting and when the list of servers changes Improved Code Mode's token use with shorter tool descriptions Improved Code Mode to show the command a script is running, and its output, while it runs Improved Code Mode edits: an edit that changes nothing no longer stops a script, and Claude is told where a failed edit matches or comes closest Improved Code Mode: Claude is now told which tool calls were still running when a script failed Improved how Claude starts dev servers in Code Mode's auto and bypass modes: Claude is told to run them as background tasks that show in /tasks Windows: Improved Code Mode by telling Claude that scripts' shell commands run in Git Bash and that PowerShell aliases run instead of functions with the same name Improved starting several in-process teammates at once: far fewer now fail with "Lock file is already being held" Improved the computer use approval dialog: it now shows each app's level of access and plainer warnings Improved cross-session messaging: Claude now explains that Remote Control is off when a cloud session or another computer is not listed Improved claude -p text output to say on stderr when a message from another session is held or dropped, and how to allow it Improved Claude's answers on who can open an artifact it published: Claude is now told to check the artifact again instead of repeating the last publish's answer Improved resumed self-hosted runner sessions: Claude now checks whether its earlier work is still there, and says what is missing Changed plan mode and Bash prompts for Opus 4.6 and Sonnet 4.6 on third-party providers to use and offer auto mode, as on newer models; disableAutoMode turns both off Changed Code Mode to no longer run UserPromptSubmit hooks, managed ones included, on scripts' output; to redact that output, use a PostToolUse hook with updatedToolOutput Changed /code-review on most models to report only bugs and CLAUDE.md violations; run /simplify for reuse, simplification and efficiency cleanups Changed /code-review to mark each finding Important, Pre-existing or Nit on most models, and to end each summary with a suggested fix; a clean review's list now reads "Code review found no issues." Changed deniedMcpServers entries of the form claude.ai <name> to apply to that connector in cloud and self-hosted runner sessions too Changed managed PostToolUse hooks to no longer fire for calls refused before they ran: no log entry, rewrite, block or stop there; PostToolBatch gets most, not marked as refused Changed /bug to ask Yes or No before sending, so repeated Enters no longer send a report or open GitHub Changed subagents in claude -p , the Agent SDK, desktop and VS Code to wait for their own subagents by default when CLAUDE_CODE_FORK_SUBAGENT=0 is set Changed claude -p with CLAUDE_CODE_FORK_SUBAGENT=0 to count a background subagent and those it waits for against one 10-minute wait; raise CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS for longer chains Changed a shell command rewritten by a PermissionRequest hook to a sandbox-excluded command to run outside the sandbox Changed the Claude in Chrome welcome screen and /chrome to say that Claude Code asks before Claude acts on a site, unless your permission mode or a rule in /permissions answers Changed Claude Desktop and Agent SDK sessions on third-party providers or with telemetry or feature flags off to end the turn when closed with a question open, instead of continuing without an answer Changed pasted text to be marked for Claude as pasted, on third-party providers or with telemetry or feature flags turned off Changed subagent progress summaries in terminal sessions on the Anthropic API to be written by the default small fast model from short notes, also with telemetry off, using far fewer tokens Changed how a sandbox that can't start is reported, unless sandbox.failIfUnavailable is set: the next sandboxed Bash command is refused and says that the sandbox is off for the session Changed /list-agents to show its list to you alone; Claude lists sessions itself when needed Self-hosted runner: Changed the built-in gh api to be off by default where settings guard Claude's GitHub tools by name; --use-anthropic-gh true turns it on Self-hosted runner: Changed a claude that a wrapper script runs before the session's own claude is up, or after it has ended, to have no Anthropic-managed git Self-hosted runner: Changed CLAUDE_RUNNER_SESSION_UUID and CLAUDE_CODE_REMOTE_SESSION_UUID to both be set for the session and its checkout , post-session and spawn-runner hooks Changed self-hosted runners at --capacity 1 to refuse a session earlier when the path of a repository it pushes to is a symbolic link [VSCode] Added a notice when a message from another session is held, with a link to the settings file that can allow it [VSCode] Fixed the permission prompt cutting off its No button, reply field or title when the panel is low or a command, URL or description is long [VSCode] Fixed failed or blocked tool calls showing no reason or a reason cut short, and Glob and Grep counting an error as results
This report is categorized under AITOP's "Products" desk, focusing on US frontier AI labs and Silicon Valley technology leaders. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows and US-China foundation model benchmarks and commercialization comparison. Key entities and technical topics under continuous tracking include Claude Code, Claude Opus 4.6, Sonnet 4.6, coding assistants.
Primary source verification: published directly by Claude Code: GitHub Releases with first-party authority.