Claude Code v2.1.273:新增网关请求头、修复权限检查与MCP连接问题
v2.1.273
推荐理由
涉及网关协议扩展(新 Header)与自动模式分类器切换,且修复了权限检查与 MDM 配置失效等破坏性 Bug,重度使用者建议升级以保障工作流稳定。
What's changed
变更内容
- Added x-claude-code-request-class, x-claude-code-agent-type, x-claude-code-prev-tool-durations, x-claude-code-compaction and x-claude-code-context-compacted request headers for LLM gateways; opt in with CLAUDE_CODE_GATEWAY_HINT_HEADERS=1
- Added a notification when an MCP server disconnects mid-session and automatic reconnection gives up, pointing at /mcp
- Added forking a session started with claude --remote-control or /remote-control from the Claude app; the fork runs as a background session on your computer
- Fixed Bash commands the permission checker cannot fully analyze skipping the prompt under permissions.blockReadsOutsideWorkingDirectories, and a subshell hiding a dangerous rm in bypass mode
- Fixed skills synced from claude.ai staying available after your organization turns Skills off; they now move to the recoverable trash
- Fixed allowManagedMcpServersOnly, deniedMcpServers and disableClaudeAiConnectors set via MDM or managed-settings.json being ignored when server-managed settings are also present
- Fixed 401/403 errors on Bedrock, Vertex and Foundry, and Claude apps gateway 403s, telling you to run /login; the message now names the credential to refresh or points to your gateway administrator
- Fixed /login, /upgrade, and /extra-usage discarding earlier thinking from the conversation, which forced a full prompt-cache rewrite on the next request
- Fixed auto mode stopping for approval when the Artifact tool uploads a file you attached to the chat in a cloud or Remote Control session
- Fixed a long-running session recreating a stub .git/info/exclude after the repository's .git directory was removed or moved away
- Fixed the main prompt dropping a ! typed at the start while already in shell mode, so negated commands like ! grep … can be typed
- Fixed Read on macOS refusing a dragged-in screenshot, or any file the system reports under a second path, with "symlink resolution changed after permission was checked"
- Fixed permissions.blockReadsOutsideWorkingDirectories: a memory directory chosen by a repository's settings is no longer loaded into the prompt, recalled, indexed, or used by memory extraction
- Fixed sub-agents and background agents being reported as failed, with their result never delivered, when the final streamed reply omitted token usage or carried no model id
- Fixed the context meter and auto-compact counting advisor-tool turns at roughly twice their real context size, which made auto-compact fire at about half the real window
- Fixed /tui refusing to restart because of an agent-team teammate that had already finished its work and was no longer shown in the agents panel
- Fixed saved scheduled tasks running in the wrong session after .claude/scheduled_tasks.json was copied into another folder, such as a new worktree
- Fixed SDK and --output-format stream-json output dropping a subagent's remaining messages and final report after it is moved to the background mid-run (e.g. by CLAUDE_AUTO_BACKGROUND_TASKS)
- Fixed /install-github-app reporting a SAML single sign-on block as "admin permissions required"
- Fixed Remote Control clients attached to a Claude Desktop, VS Code or JetBrains session being refused when they ask for the session's context window usage
- Fixed the spinner showing a doubled ellipsis ("……") on compaction status lines such as "Running PreCompact hooks…"
- Fixed a false-positive spinner tip suggesting the frontend-design plugin after reading or publishing Artifacts
- Reverted a 2.1.268 change that checked Read and Edit deny rules on Bash lines the permission checker can't analyze (eval, env -C); commands like time -p make build prompt again instead of being denied
- Improved responsiveness in long sessions: hook progress and sub-agent activity no longer re-process the whole conversation on every update
- Improved the Artifact tool's error when a publish includes a file type artifacts don't serve: Claude is told which types are served and what to do instead, and the terminal shows one plain line
- Improved the Artifact tool's page read to state the capabilities and database rules the artifact service holds for the page, for anyone who can publish to it
- Improved artifact database writes: an update can now remove a single field instead of rewriting the whole document
- Improved artifact publishing: a publish whose connection drops after reaching claude.ai is now re-sent safely instead of failing or creating a duplicate version
- Improved the cloud-session GitHub error for an IP allow list, a suspended app installation or SAML single sign-on to show the cause instead of a generic install hint
- Improved /autofix-pr: when gh pr view fails it now shows gh's own error (sign-in, SAML, rate limit) instead of a generic exit-code line
- Improved /autofix-pr to say why GitHub webhook delivery couldn't be set up for the PR (for example, no linked GitHub account) instead of a generic warning
- Improved /web-setup errors: a refused GitHub token now lists the likely reasons and the fix, and a connection failure names a configured proxy or TLS certificate problem
- Improved the in-session SSL certificate and proxy connection errors to name the error code and what to fix, such as NODE_EXTRA_CA_CERTS for an untrusted corporate CA
- Improved the error when a cloud session can't be created because your Claude login expired or was revoked: it now tells you to run /login
- Improved the error shown when an MCP server's sign-in expires mid-session to say how to re-authenticate (/mcp)
- Changed auto mode on Bedrock, Vertex and Foundry to use the local classifier by default for now; set CLAUDE_CODE_AUTO_MODE_SERVER=1 to use the platform's server-side classifier
- Changed OTEL_LOG_TOOL_DETAILS=1 to also include real agent, skill, plugin and MCP server names on cost and token metrics
- Changed sign-in with a Claude account to also request access to your claude.ai plugins
- Changed /bug and /feedback reports to include only model-behavior params (model, system prompt, tools) from the last API request, omitting request metadata and CLAUDE_CODE_EXTRA_BODY fields
- [VSCode] Fixed "Report a problem" still appearing, and /bug / /feedback opening a report form, for organizations that have product feedback disabled
- [VSCode] Fixed a red "Claude Code process exited with code 4294967295" banner appearing after completed turns on Windows
- Windows: Improved the network-path permission check for UNC paths when a mapped network drive was added with --add-dir
- [Claude Code on the web] Fixed routines losing access to an organization connector, and still calling the old one, after an admin removed and re-added that connector
- [Claude Code on the web] Fixed creating a self-hosted environment from organization settings occasionally failing with a server error and leaving a half-created environment behind
- [Claude Code on the web] Changed the admin "Share cloud sessions" setting to live under Data and privacy instead of the Claude Code page, where Data and privacy admins can also manage it
- [Claude Code on the web] Added a "Discard unsaved changes?" confirmation before the New routine page or the Edit routine dialog throws away a routine name, prompt or edit you typed
- [Claude Code on the web] Removed the full-page desktop-app download screen that new users without a cloud environment saw on Mac and Windows; they now go straight to setup
- [Claude Code on the web] Improved the routine detail page: menu and rename in the breadcrumb, the on/off switch and Run now at the top, and run history beside the routine's settings
- [Claude Tag] Fixed Claude going silent minutes after reinstalling the app when an Enterprise Grid was disconnected but one of its workspaces stayed connected
- [Claude Tag] Fixed scheduled tasks set up in an organization-shared private Slack channel silently never posting; they now keep running in the thread they were created in
- 为 LLM 网关添加了 x-claude-code-request-class、x-claude-code-agent-type、x-claude-code-prev-tool-durations、x-claude-code-compaction 和 x-claude-code-context-compacted 请求头;通过设置 CLAUDE_CODE_GATEWAY_HINT_HEADERS=1 启用
- 当 MCP 服务器在会话中途断开连接且自动重连失败时,添加通知并指向 /mcp
- 支持从 Claude 应用程序对使用 claude --remote-control 或 /remote-control 启动的会话进行分叉;该分叉将在您的计算机上作为后台会话运行
- 修复了 Bash 命令权限检查器无法完全分析而跳过 permissions.blockReadsOutsideWorkingDirectories 下提示的问题,以及子 shell 在绕过模式下隐藏危险 rm 命令的问题
- 修复了从 claude.ai 同步的技能在组织关闭技能后仍可用的问题;现在它们会被移至可恢复的回收站
- 修复了通过 MDM 或 managed-settings.json 设置的 allowManagedMcpServersOnly、deniedMcpServers 和 disableClaudeAiConnectors 在同时存在服务器管理设置时被忽略的问题
- 修复了 Bedrock、Vertex 和 Foundry 上的 401/403 错误,以及 Claude 应用程序网关的 403 错误,这些错误曾提示您运行 /login;现在消息会指明需要刷新的凭据或指向您的网关管理员
- 修复了 /login、/upgrade 和 /extra-usage 丢弃对话中早期思考内容的问题,这会导致在下一次请求时强制重写整个提示缓存
- 修复了在云会话或远程控制会话中,当 Artifact 工具上传您附加到聊天中的文件时,自动模式停止等待批准的问题
- 修复了长时间运行的会话在仓库的 .git 目录被移除或移动后重新创建存根 .git/info/exclude 的问题
- 修复了主提示符在已进入 shell 模式时丢弃开头输入的 ! 的问题,从而允许输入如 ! grep … 等取反命令
- 修复了 macOS 上 Read 拒绝拖入的屏幕截图,或系统报告为第二个路径下的任何文件,报错“权限检查后符号链接解析已更改”的问题
- 修复了 permissions.blockReadsOutsideWorkingDirectories:由仓库设置选择的内存目录不再加载到提示符中、被回忆、索引或由内存提取使用
- 修复了当最终流式回复省略 token 使用情况或不包含模型 ID 时,子代理和后台代理被报告为失败且其结果从未交付的问题
- 修复了上下文计量器和自动压缩计数顾问工具将大约两倍于实际上下文大小的回合数计入自动压缩触发条件,导致自动压缩在实际窗口大小约一半时就触发的问题
- 修复了 /tui 因代理团队中已完成工作且不再显示在代理面板中的队友而拒绝重启的问题
- 修复了在 .claude/scheduled_tasks.json 被复制到另一个文件夹(如新的 worktree)后,保存的计划任务在错误的会话中运行的问题
- 修复了 SDK 和 --output-format stream-json 输出在子代理运行中途移至后台时(例如通过 CLAUDE_AUTO_BACKGROUND_TASKS),丢弃其剩余消息和最终报告的问题
- 修复了 /install-github-app 将 SAML 单点登录阻止错误地报告为“需要管理员权限”的问题
- 修复了当附加到 Claude Desktop、VS Code 或 JetBrains 会话的远程控制客户端请求该会话的上下文窗口使用情况时被拒绝的问题
- 修复了压缩状态行(如“正在运行 PreCompact 钩子…”)上显示的旋转图标出现双省略号("……")的问题
- 修复了在读取或发布 Artifacts 后,旋转图标提示误报建议安装 frontend-design 插件的问题
- 回退了 2.1.268 版本中的一项更改:该更改会对权限检查器无法分析的 Bash 行(eval、env -C)上的 Read 和 Edit 拒绝规则进行检查;现在像 time -p 这样的命令会再次触发构建提示,而不是被拒绝
- 改进了长会话中的响应速度:钩子进度和子代理活动不再在每次更新时重新处理整个对话
- 改进了 Artifact 工具在发布包含 Artifacts 不提供的文件类型时的错误提示:Claude 会被告知哪些类型是被支持的以及该如何操作,终端也会显示一行纯文本信息
- 改进了 Artifact 工具的页面读取功能,以说明 artifact 服务对该页面所具备的能力及数据库规则,供任何有权向其发布内容的人参考
- 改进了 artifact 数据库写入操作:现在更新可以仅移除单个字段,而无需重写整个文档
- 改进了 artifact 发布流程:如果发布在到达 claude.ai 后连接中断,现在会安全地重新发送,而不是失败或创建重复版本
- 改进了 cloud-session 在处理 IP 白名单、挂起的应用安装或 SAML 单点登录时的 GitHub 错误提示,改为显示具体原因而非通用的安装提示
- 改进了 /autofix-pr:当 gh pr view 失败时,现在会显示 gh 自身的错误信息(如登录、SAML、速率限制),而不是一般的退出代码行
- 改进了 /autofix-pr 的提示信息,说明为何无法为 PR 设置 GitHub webhook 投递(例如未关联 GitHub 账户),而不是一般的警告信息
- 改进了 /web-setup 错误提示:被拒绝的 GitHub token 现在会列出可能的原因及修复方法,连接失败则会指明是配置的代理或 TLS 证书问题
- 改进了会话期间的 SSL 证书和代理连接错误提示,使其显示错误代码及修复建议,例如对于不受信任的企业 CA,需设置 NODE_EXTRA_CA_CERTS
- 改进了因 Claude 登录已过期或被撤销而无法创建云会话时的错误提示:现在会提示你运行 /login
- 改进了 MCP 服务器在会话中途签名过期的错误提示,说明如何重新进行身份验证(/mcp)
- 将 Bedrock、Vertex 和 Foundry 上的自动模式默认改为使用本地分类器;如需使用平台的服务端分类器,请设置 CLAUDE_CODE_AUTO_MODE_SERVER=1
- 将 OTEL_LOG_TOOL_DETAILS=1 设置为也包含在成本和令牌指标中显示真实的智能体、技能、插件和 MCP 服务器名称
- 更改了使用 Claude 账户登录的行为,现在也会请求访问你的 claude.ai 插件
- 更改了 /bug 和 /feedback 报告的内容,仅包含来自上一次 API 请求的模型行为参数(模型、系统提示词、工具),省略请求元数据和 CLAUDE_CODE_EXTRA_BODY 字段
- [VSCode] 修复了在禁用产品反馈的组织中,“报告问题”仍会出现,且 /bug 和 /feedback 仍会打开报告表单的问题
- [VSCode] 修复了在 Windows 上完成一轮对话后,出现红色横幅提示“Claude Code 进程以代码 4294967295 退出”的问题
- Windows:在使用 --add-dir 添加映射网络驱动器后,改进了对 UNC 路径的网络路径权限检查
- [网页版 Claude Code] 修复了管理员移除并重新添加组织连接器后,例程失去对该连接器的访问权限但仍调用旧连接器的问题
- [网页版 Claude Code] 修复了从组织设置创建自托管环境时偶尔因服务器错误而失败,并留下半创建状态环境的问题
- [网页版 Claude Code] 将管理员的“共享云会话”设置移至“数据与隐私”页面,而非原来的 Claude Code 页面,数据与隐私管理员也可在此管理该设置
- [网页版 Claude Code] 在新建例程页面或编辑例程对话框丢弃你输入的例程名称、提示词或编辑内容之前,添加了“是否丢弃未保存的更改?”确认提示
- [网页版 Claude Code] 移除了新用户(无云环境)在 Mac 和 Windows 上看到的全屏桌面应用下载屏幕;他们现在直接进入设置流程
- [网页版 Claude Code] 改进了常规详情页面:面包屑中的菜单和重命名、顶部的开关和立即运行按钮,以及常规设置旁边的运行历史
- [Claude Tag] 修复了在企业网格断开连接但其中一个工作区仍保持连接时,重新安装应用后 Claude 在几分钟后陷入沉默的问题
- [Claude Tag] 修复了在组织共享的私有 Slack 频道中设置的定时任务静默不发布的问题;现在它们会在创建它们的线程中继续运行
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力