Claude Code v2.1.317:修复auto模式失败、MCP断开及多项SDK与CLI问题
v2.1.317
推荐理由
本次更新修复了 auto 模式在特定网关配置下完全失效的关键 Bug,以及 MCP 连接不稳定等高频痛点。依赖自动化工作流或云端集成的开发者务必升级,以避免任务中断和数据同步异常。
What's changed
变更内容
- Added a warning to /schedule when a new cloud scheduled task gets connectors you did not ask for, with how to remove them
- Added a check that asks before a web or shell tool call sends your account email address to the network
- Added onFailure: "block" for Agent SDK hook callbacks, so a callback that fails blocks the action instead of letting it run
- Added a notice in Claude Desktop's Code tab when your organization's remote managed settings haven't loaded for the session, and another once they do
- Added a notice when auto mode's check has no answer for a subagent's tool call, which used to leave nothing in the main view
- Added anthropic.plan, anthropic.seat_type, anthropic.provider and anthropic.custom_base_url to OTel metrics, events and spans
- Added a cost report to the Claude apps gateway admin API, GET /v1/organizations/analytics/cost, for reading past spend over a date range in total, per developer, per day or per IdP group
- Added a daily record of each developer's IdP groups on Claude apps gateways with admin: set, kept for admin.identity_retention_days, which the cost report groups by
- Added CLAUDE_CODE_DISABLE_NESTED_SESSION_ID: set it to 1 on a self-hosted runner to have claude -p run inside a session use that session's ID and transcript, as in earlier versions
- Fixed project and local MCP servers disconnecting after the first turn in some Claude desktop sessions
- Fixed auto mode failing every turn when an LLM gateway set as the base URL answers 403 or 422 to its server-side safety check (a 403 with an apiKeyHelper is unchanged)
- Fixed claude auth status exiting before a slow token refresh was saved, which could sign you out on the next run
- Fixed a project's effortLevel setting being ignored by sessions that an app starts ahead of time and then opens in the project, such as new sessions in the desktop app's Code tab
- Fixed claude --from-pr reporting "No conversations found" in projects with many sessions when the linked session was older than the first page
- Fixed the second of two simultaneous permission prompts showing no file path or command on claude.ai and the mobile apps
- Fixed Remote Control and SDK hosts offering "don't ask again" on a mod's tool calls
- Fixed session titles being lost in cloud and SDK sessions when a new message or Stop arrived while the title was generating
- Fixed self-paced /loop wakeups sometimes not being scheduled when Claude left a field out of its request
- Fixed auto mode in cloud sessions stopping for approval when the Artifact tool uploaded, wrote to a database or saved a file through the outputs folder
- Fixed skills synced from claude.ai being lost or downloaded again every ten minutes when they can't be written to disk
- Fixed /schedule leaving a cloud scheduled task's next run time and link out of its results after creating or updating it
- Fixed screen readers speaking a running subagent's elapsed time and token count on every change in screen reader mode
- Fixed a region or network block (HTTP 403) being shown as a sign-in failure; the error now explains the block
- Fixed Claude saying a working claude.ai connector needed authorization or had failed in cloud sessions when a synced plugin included the same server
- Fixed claude -p exiting 0 when a full disk or quota lost its transcript or ~/.claude.json writes; it now prints an error and, in text and json output, exits 1. Full NFS exports may be missed
- Fixed edits to settings files made in the first second or so after launch not taking effect until a settings file changed again
- Fixed old transcripts not being cleaned up on machines where some runs skip cleanup, such as runs using --setting-sources
- Fixed deleted agent team inboxes being re-created by a teammate's late message
- Fixed a re-created agent teammate being removed from its team by an earlier shutdown approval
- Fixed stored scheduled tasks being impossible to list or delete after scheduled tasks were turned off
- Fixed Claude deleting your most recently updated /team-onboarding guide when asked to delete one without naming which
- Fixed Claude saying a /team-onboarding guide was deleted when the server refused the delete
- Fixed the Claude apps gateway hiding Amazon Bedrock's "Input is too long." error, which left sessions failing every turn with "upstream rejected the request" instead of compacting
- Fixed self-hosted runner sessions losing recent turns or the whole conversation when restarted while a plan waited for approval
- Fixed "Prompt is too long" after automatic compaction in sessions whose very large CLAUDE.md changed since it was last sent
- Fixed high memory use and slow startup in headless sessions with many plugins that register commands
- Fixed stdio MCP servers receiving an empty AWS_BEARER_TOKEN_BEDROCK when their env config sets it to empty; the variable is now unset, so the server can use the machine's own AWS credentials
- Fixed API requests failing with "unable to get local issuer certificate" behind some TLS-inspecting proxies after a root certificate renewal
- Fixed very long conversations losing their earlier summary when compaction had to shorten its own request
- Fixed a PDF's own metadata being able to make Read and @-mentions under-count its pages
- Fixed DISABLE_PROMPT_CACHING_OPUS and DISABLE_PROMPT_CACHING_SONNET having no effect on [1m], other-region and undated spellings of the default model
- Fixed /artifacts and the Artifact tool's shared list showing no shared artifacts when you have 200 or more of your own
- Fixed Claude treating partial Grep and Glob results as complete when a search hit its time limit
- Fixed OpenTelemetry exports to an https:// endpoint through a proxy never being sent when they started while another export was still in progress
- Fixed a flood of connection attempts to a proxy that blocks (HTTP 403) OpenTelemetry exports to an http:// endpoint
- Fixed OpenTelemetry exports hanging indefinitely behind a proxy that never answers; they now time out after 10 seconds, or OTEL_EXPORTER_OTLP_TIMEOUT up to 30 seconds
- Fixed resumed sessions telling Claude again about a file change it already knew about
- Fixed Claude sometimes not using a built-in tool in a resumed session after an earlier call failed because the tool was switched off
- Fixed /remote-control answering "Unknown command" instead of saying that Remote Control is turned off by the disableRemoteControl setting
- Fixed agent team teammates in tmux or iTerm2 panes starting in auto mode when the lead session was in manual mode
- Fixed a background session sometimes losing a just-made change of permission mode when it was upgraded or retired
- Fixed Ctrl+C stopping all running background agents when pressed to clear typed text at the prompt
- Fixed /feedback showing "Enter to confirm" while a report is being sent
- Fixed child processes of a stopped shell command sometimes being sent SIGTERM twice, which could make some programs skip their cleanup
- Fixed claude -p run inside a cloud or self-hosted runner session sharing that session's ID: it wrote into the session's transcript, and a restart could resume the wrong conversation
- Fixed claude -p run inside a cloud or self-hosted runner session generating a title of its own and sending it to that session
- Improved the error shown on Microsoft Foundry when Azure credentials can't be loaded: it now says to check or refresh them, and reports as cloud_credential_error
- Improved /design-sync to say up front when your design system has moved to Claude, and stop before building instead of failing at upload
- Improved the startup error when a required Claude apps gateway can't be reached: it points to the network instead of a sign-in, and says when the gateway's TLS certificate can't be verified
- 在 /schedule 中新增警告:当新的云计划任务获取了您未请求的连接器时,会提示如何移除它们
- 新增检查项:在网页或 Shell 工具调用将您的账户电子邮件地址发送至网络之前,会先征求同意
- 为 Agent SDK 钩子回调新增了 onFailure: "block" 选项,这样失败的回调将阻止操作执行,而不是让其继续运行
- 在 Claude Desktop 的 Code 标签页中新增通知:当组织远程管理设置未在会话期间加载时显示一条通知,加载完成后显示另一条通知
- 新增通知:当自动模式的检查对子代理的工具调用没有答案时(此前主视图中将无任何显示)
- 将 anthropic.plan、anthropic.seat_type、anthropic.provider 和 anthropic.custom_base_url 添加到 OTel 指标、事件和跨度中
- 在 Claude 应用网关管理 API GET /v1/organizations/analytics/cost 中新增成本报告,用于按日期范围读取总花费、每位开发者的花费、每日花费或每个 IdP 组的花费
- 在具有 admin: set 权限的 Claude 应用网关上,新增每位开发者的 IdP 组每日记录,保留时间为 admin.identity_retention_days,成本报告将据此进行分组
- 新增 CLAUDE_CODE_DISABLE_NESTED_SESSION_ID:在自托管运行器上将其设置为 1,可使 claude -p 在会话内运行并使用该会话的 ID 和转录内容,行为与早期版本一致
- 修复了在某些 Claude 桌面会话中,项目和本地 MCP 服务器在第一个回合后断开连接的问题
- 修复了当作为基础 URL 设置的 LLM 网关对其服务端安全检查返回 403 或 422 时,自动模式在每个回合都失败的问题(带有 apiKeyHelper 的 403 响应保持不变)
- 修复了 claude auth status 在慢速令牌刷新保存之前退出的问题,这可能导致下次运行时被登出
- 修复了项目的 effortLevel 设置被提前启动随后在项目内打开的会话忽略的问题,例如桌面应用 Code 标签页中的新会话
- 修复了 claude --from-pr 在包含大量会话的项目中,当链接会话早于第一页时报告“未找到对话”的问题
- 修复了在 claude.ai 和移动应用中,两个同时出现的权限提示中的第二个不显示文件路径或命令的问题
- 修复了远程控制 (Remote Control) 和 SDK 主机在管理员的工具调用中提供“不再询问”选项的问题
- 修复了在生成标题时收到新消息或 Stop 信号导致云端和 SDK 会话丢失标题的问题
- 修复了当 Claude 在其请求中遗漏某个字段时,自定节奏的 /loop 唤醒有时未被调度的问题
- 修复了在云会话中,当 Artifact 工具上传、写入数据库或通过输出文件夹保存文件时,自动模式停止等待审批的问题
- 修复了当无法写入磁盘时,从 claude.ai 同步的技能每十分钟丢失或重新下载的问题
- 修复了 /schedule 在创建或更新后,其结果中云计划任务的下次运行时间和链接异常的问题
- 修复了屏幕阅读器在每次模式更改时朗读正在运行的子代理的已用时间和令牌计数的问題
- 修复了将区域或网络阻止(HTTP 403)显示为登录失败的问题;现在错误信息会解释该阻止情况
- 修复了在云会话中,当同步的插件包含相同的服务器时,Claude 声称正常工作的 claude.ai 连接器需要授权或已失败的问题
- 修复了 claude -p 在磁盘已满或配额耗尽导致转录本或 ~/.claude.json 写入失败时退出代码为 0 的问题;现在它会打印错误并以文本和 JSON 输出形式退出代码 1。可能会遗漏完整的 NFS 导出
- 修复了在启动后约一秒钟内对设置文件进行的编辑直到设置文件再次更改才生效的问题
- 修复了在部分运行跳过清理(例如使用 --setting-sources 的运行)的机器上,旧转录本未被清理的问题
- 修复了被删除的代理团队收件箱因队友的延迟消息而重新创建的问题
- 修复了重新创建的代理团队成员被较早的关机审批移除的问题
- 修复了在关闭计划任务后,存储的计划任务无法列出或删除的问题
- 修复了当要求删除某个 /team-onboarding 指南但未指明具体是哪一份时,Claude 删除了您最近更新的指南的问题
- 修复了当服务器拒绝删除操作时,Claude 声称 /team-onboarding 指南已被删除的问题
- 修复了 Claude 应用网关隐藏 Amazon Bedrock 的“输入过长”错误的问题,这导致会话在每一步都因“上游拒绝了请求”而失败,而不是进行压缩
- 修复了在计划等待审批时重启,导致自托管运行器会话丢失最近的轮次或整个对话的问题
- 修复了在会话中自动压缩后出现“提示词过长”的问题,这些会话的非常大的 CLAUDE.md 自上次发送以来已发生更改
- 修复了在注册了大量命令的插件的头无头会话中内存使用率高和启动缓慢的问题
- 修复了当环境配置将其设置为空时,stdio MCP 服务器接收空的 AWS_BEARER_TOKEN_BEDROCK 的问题;现在该变量未设置,因此服务器可以使用机器自身的 AWS 凭据
- 修复了在部分 TLS 检查代理后面,根证书更新后 API 请求因“无法获取本地颁发者证书”而失败的问题
- 修复了超长对话在压缩过程需要缩短自身请求时丢失早期摘要的问题
- 修复了 PDF 自身的元数据可能导致 Read 和 @提及功能对其页数统计偏低的问题
- 修复了 DISABLE_PROMPT_CACHING_OPUS 和 DISABLE_PROMPT_CACHING_SONNET 对 [1m]、其他区域版本以及未标注日期的默认模型变体无效的问题
- 修复了当用户拥有 200 个或更多自己的工件时,/artifacts 和 Artifact 工具的共享列表不显示任何共享工件的问题
- 修复了 Claude 在搜索达到时间限制时将部分 Grep 和 Glob 结果视为完整结果的问题
- 修复了通过代理向 https:// 端点导出 OpenTelemetry 数据时,若导出启动时已有其他导出正在进行,则永远不会发送导出的问题
- 修复了向阻止(HTTP 403)OpenTelemetry 导出至 http:// 端点的代理发起大量连接尝试的问题
- 修复了 OpenTelemetry 导出在代理后方无限挂起的问题;现在它们在 10 秒后超时,或根据 OTEL_EXPORTER_OTLP_TIMEOUT 设置最长 30 秒后超时
- 修复了恢复会话时再次告知 Claude 其已知的文件更改的问题
- 修复了 Claude 有时在恢复会话中不使用内置工具的问题,此前因该工具被禁用导致早期调用失败
- 修复了 /remote-control 返回“未知命令”而非提示 Remote Control 已被 disableRemoteControl 设置关闭的问题
- 修复了 tmux 或 iTerm2 窗格中的 Agent 团队成员在主会话处于手动模式时以自动模式启动的问题
- 修复了后台会话在升级或退役时有时会丢失刚刚进行的权限模式更改的问题
- 修复了按 Ctrl+C 清除提示符处输入的文本时会停止所有正在运行的后台代理的问题
- 修复了 /feedback 在报告发送过程中显示“按 Enter 确认”的问题
- 修复了停止的 shell 命令的子进程有时被发送两次 SIGTERM 信号,这可能导致某些程序跳过清理操作的问题
- 修复了 claude -p 在云或自托管运行器会话内运行时共享该会话 ID 的问题:它会写入该会话的转录记录,且重启可能恢复错误的对话
- 修复了 claude -p 在云或自托管运行器会话内运行时生成自己的标题并将其发送至该会话的问题
- 改进了 Microsoft Foundry 上无法加载 Azure 凭据时显示的错误信息:现在会提示检查或刷新凭据,并将错误报告为 cloud_credential_error
- 改进了 /design-sync,使其在您的设计系统迁移至 Claude 时提前说明,并在构建前停止而非在上传时失败
- 改进了在无法访问必需的 Claude 应用网关时的启动错误提示:指向网络问题而非登录问题,并说明当网关的 TLS 证书无法验证时的情况
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力