精选85Claude Code(GitHub Releases)AI 编程与模型
Claude Code v2.1.251:新增模型切换钩子、远程控制流式传输与多项安全修复
v2.1.251
推荐理由
开发者注意:此版本修复了多个可被利用的安全漏洞(符号链接越界、路径穿越、日志泄露),建议尽快升级。同时新增模型切换钩子和远程控制流式传输,对自动化工作流有实质增强。
What's changed
变更内容
- Added PreModelSwitch and PostModelSwitch hook events (block, confirm, or annotate a model switch); SessionStart resume hooks now receive session staleness and the estimated re-cache cost
- Added live streaming of a foreground subagent's tool calls and results to Remote Control clients (background subagents, the default, still show status only)
- Added a Spend limit bar to /usage and a rate_limits.spend_limit status line field for developers behind a Claude apps gateway with spend limits
- Added a per-session prompt-cache line to /cost (hit ratio, misses, tokens re-cached, warm/cold) and a matching prompt_cache object for status line scripts
- Added attach, logs, stop, respawn, and rm to claude --help; the --resume message for a running background session now names the exact claude attach <id> command
- Fixed file tools (Read, Write, Edit) following a symlink swapped inside the working directory after the permission check, which could read or write outside the approved location
- Fixed plugin commands declared in a marketplace entry being able to point outside the plugin directory; such paths are now rejected with a path-traversal error
- Fixed project settings being able to enable detailed beta tracing or raw API body logging, and a lower-scope beta tracing endpoint bypassing an OTLP collector pinned by managed settings or a host app
- Fixed the Workflow tool reading (and quoting in errors) a scriptPath outside what the session may read before the permission check ran
- Fixed Grep and Glob not applying Read(...) deny rules to files reached through a symlinked search path
- Fixed conversations getting stuck on "text content blocks must be non-empty" errors after a turn where the model produced only thinking
- Fixed the first launch on a fresh install starting in default mode instead of auto mode for accounts whose startup default is auto mode
- Fixed Opus 5 requests failing with "effort … is not supported when thinking is disabled" when effort was xhigh/max and thinking was turned off; effort is now sent as high in that case
- Fixed replying to a message Claude Desktop delivered from another session: SendMessage to that session id now delivers through Claude Desktop instead of failing with "not reachable"
- Fixed TUI lag with many parallel subagents: per-second progress ticks now replace their predecessor instead of piling up in the transcript
- Fixed agent teams: a teammate's final answer not reaching the team lead — it now arrives in the idle notification instead of a content-free "available" notice
- Fixed background subagents being unable to reply to a message from an unnamed sibling or parent agent (from was the agent type, which is not an address)
- Fixed managed-settings disableAutoMode arriving mid-session not moving an already-running auto-mode session back to default mode
- Fixed a "switch to Opus 1M for 5x more context" tip that appeared even when the current Opus model already has a 1M context window
- Fixed Claude apps gateway sessions treating a stored Anthropic profile (e.g. a Console sign-in) as active: listing it in /status and retrying gateway 401s with it, though requests never use it
- Fixed cloud sessions telling Claude the model had changed when the host was only setting the session's initial model
- Fixed Remote Control reporting a failure when an organization's policy disables it; it now shows a single quiet notice instead
- Fixed /mcp reconnect on Remote Control showing a generic withheld-detail error instead of the real remedy when a server was disabled in another session
- Fixed --input-format stream-json: client-injected assistant tool calls sent without a message id were merged into the first one and their results lost, including when resuming older sessions
- Fixed session transcripts being silently overwritten when a directory change relocated a session onto an existing same-ID transcript
- Fixed background sessions and their subagents being unable to edit files inside a git worktree they created with git worktree add
- Fixed background sessions occasionally starting without any plugin skills (and staying that way) when another Claude Code process was refreshing the plugin marketplace at the same moment
- Fixed selecting text in an opened background session inside tmux over SSH: it now copies to the tmux buffer like a foreground session instead of falling back to OSC 52
- Fixed SDK and cloud sessions hanging indefinitely when an SDK MCP server's handshake acknowledgment was lost; the wait now times out after 70 seconds and marks only that server failed
- Fixed self-hosted runner leaving a stuck session's Bash tool processes running after the session was force-stopped
- Fixed /usage-credits for Team and Enterprise members whose admin set the org's usage-credit limit to $0: it now offers to ask the admin instead of saying a cap was reached
- Fixed --worktree --tmux with a merge-request number on a gitlab.com origin trying a doomed GitHub-style fetch first instead of fetching the GitLab ref directly
- Fixed Ctrl+G failing with "Emacs quit unexpectedly" in background sessions for editors that open /dev/tty, such as emacs -nw and micro
- Fixed an additionalDirectories entry containing a null byte crashing startup, or breaking /add-dir and later settings updates when it came from an SDK host, IDE, or hook; it is now skipped
- Fixed the MCP server menu's copy shortcut: it now says how the sign-in URL was copied instead of always claiming success
- Fixed italic text (such as the session recap line) rendering as highlighted blocks in GNU screen and in tmux sessions using a screen terminal type
- Fixed claude mcp add --header and claude mcp add-json help text naming the wrong transports
- Fixed claude ultrareview and /ultrareview waiting the full 30 minutes when the cloud session fails to start; they now stop early and report the reason
- Fixed Bash permission checks auto-approving commands that assign an arithmetic expression to an integer shell variable (e.g. OPTIND=1/0, RANDOM=2+2); these now prompt for approval
- Fixed backgrounded sessions (←, /background, --bg) losing a Vertex/Bedrock gateway (ANTHROPIC_*_BASE_URL + CLAUDE_CODE_SKIP_*_AUTH) exported in the shell, so every request failed
- Fixed claude --bg --model fable on Max plans stopping to ask for usage credits while the interactive session on the same account still had Fable allowance
- Fixed the one-time "make auto mode your default" offer appearing in unattended sessions (e.g. agent-team teammate panes), where a stray keypress could accept it unread
- Fixed the managed-settings approval prompt re-appearing after signing in again to the same Claude apps gateway when the settings are unchanged
- Fixed disabled /bug and /share reporting that /feedback was disabled; tips, /help, and refusal messages no longer suggest /feedback when an org policy or env var turns it off
- Fixed cloud session creation advising GitHub setup after a transient GitHub connection failure — the message now says to retry instead
- Improved CPU usage during turns in interactive sessions by cutting redundant UI re-renders
- Improved install size: the native binary is about 5 MB smaller
- Improved cloud sessions: when the session's network proxy drops a connection during a Bash command, the tool result now names the host and reason instead of only "connection reset"
- Improved /schedule to explain that MCP servers configured in Claude Code can't be attached to cloud routines, instead of a bare "No MCP connectors" message
- Improved framing of messages from your own subagents: Claude is told the sender is a worker inside this session, not an unrelated Claude session
- Improved the prompt placeholder to read "Message @name…" while viewing a background subagent or fork transcript opened from the subagent panel or /tasks
- Improved sanitization of MCP server names in error messages, menus, and command results
- 新增 PreModelSwitch 和 PostModelSwitch 钩子事件(可阻止、确认或注释模型切换);SessionStart 恢复钩子现在接收会话陈旧度和预估重新缓存成本
- 新增将前台子代理的工具调用和结果实时流式传输到远程控制客户端(后台子代理,默认情况,仍仅显示状态)
- 在 /usage 中新增支出限制条,并为位于具有支出限制的 Claude 应用网关后的开发者新增 rate_limits.spend_limit 状态行字段
- 在 /cost 中新增每会话提示缓存行(命中率、未命中、重新缓存的令牌、热/冷),并为状态行脚本新增匹配的 prompt_cache 对象
- 在 claude --help 中新增 attach、logs、stop、respawn 和 rm;运行中后台会话的 --resume 消息现在指明确切的 claude attach <id> 命令
- 修复了文件工具(Read、Write、Edit)在权限检查后跟随工作目录内被交换的符号链接,可能导致读取或写入批准位置之外的问题
- 修复了市场条目中声明的插件命令能够指向插件目录之外的问题;此类路径现在会以路径遍历错误被拒绝
- 修复了项目设置能够启用详细的 beta 追踪或原始 API 主体日志记录,以及较低范围的 beta 追踪端点绕过由托管设置或宿主应用固定的 OTLP 收集器的问题
- 修复了 Workflow 工具在权限检查运行前读取(并在错误中引用)会话可能无法读取的 scriptPath 的问题
- 修复了 Grep 和 Glob 未将 Read(...) 拒绝规则应用于通过符号链接搜索路径访问的文件的问题
- 修复了在模型仅产生思考的回合后,对话卡在“文本内容块必须非空”错误上的问题
- 修复了全新安装首次启动时,对于启动默认设置为自动模式的账户,以默认模式而非自动模式启动的问题
- 修复了 Opus 5 请求在 effort 为 xhigh/max 且 thinking 关闭时,因“effort … 在禁用思考时不支持”而失败的问题;现在这种情况下 effort 会以 high 发送
- 修复了回复 Claude Desktop 从其他会话传递的消息的问题:现在向该会话 ID 发送 SendMessage 会通过 Claude Desktop 传递,而不是以“不可达”失败
- 修复了 TUI 在大量并行子代理下的延迟问题:每秒进度更新现在会替换其前一个,而不是在转录中堆积
- 修复了固定代理团队:队友的最终答案未能到达团队负责人——现在它会出现在空闲通知中,而不是无内容的“可用”通知
- 修复了后台子代理无法回复来自未命名兄弟或父代理的消息(from 是代理类型,不是地址)
- 修复了会话中途到达的托管设置 disableAutoMode 未能将已运行的自动模式会话移回默认模式
- 修复了即使当前 Opus 模型已具有 1M 上下文窗口时,仍出现“切换到 Opus 1M 以获得 5 倍上下文”提示的问题
- 修复了 Claude 应用网关会话将存储的 Anthropic 配置文件(例如 Console 登录)视为活动状态:在 /status 中列出它,并用它重试网关 401,尽管请求从未使用它
- 修复了云会话在主机仅设置会话初始模型时告知 Claude 模型已更改的问题
- 修复了当组织策略禁用远程控制时,远程控制报告失败的问题;现在它只显示一个安静的提示
- 修复了远程控制中 /mcp 重连在服务器在另一会话中被禁用时显示通用隐藏详情错误而非真实解决方案的问题
- 修复了 --input-format stream-json:客户端注入的助手工具调用在未带消息 ID 时被合并到第一个调用中,导致其结果丢失,包括恢复旧会话时
- 修复了当目录更改将会话移动到现有同 ID 转录文件时,会话转录被静默覆盖的问题
- 修复了后台会话及其子代理无法编辑它们通过 git worktree add 创建的 git 工作树内文件的问题
- 修复了当另一个 Claude Code 进程同时刷新插件市场时,后台会话偶尔无任何插件技能启动(并保持该状态)的问题
- 修复了通过 SSH 在 tmux 中打开的后台会话中选择文本的问题:现在它像前台会话一样复制到 tmux 缓冲区,而不是回退到 OSC 52
- 修复了当 SDK MCP 服务器的握手确认丢失时,SDK 和云会话无限挂起的问题;现在等待在 70 秒后超时,并仅将该服务器标记为失败
- 修复了自托管运行器在会话被强制停止后,仍让卡住的会话的 Bash 工具进程继续运行的问题
- 修复了 /usage-credits 对于管理员将组织使用额度限制设置为 $0 的团队和企业成员的问题:现在它提供询问管理员,而不是说已达到上限
- 修复了 --worktree --tmux 在 gitlab.com 源上带有合并请求编号时,先尝试注定失败的 GitHub 风格获取,而不是直接获取 GitLab 引用的问题
- 修复了在后台会话中,对于打开 /dev/tty 的编辑器(如 emacs -nw 和 micro),Ctrl+G 导致“Emacs 意外退出”的问题
- 修复了 additionalDirectories 条目包含空字节导致启动崩溃,或来自 SDK 主机、IDE 或钩子时破坏 /add-dir 及后续设置更新的问题;现在会跳过该条目
- 修复了 MCP 服务器菜单的复制快捷键:现在会说明登录 URL 是如何复制的,而不是总是声称成功
- 修复了斜体文本(如会话摘要行)在 GNU screen 和使用 screen 终端类型的 tmux 会话中显示为高亮块的问题
- 修复了 claude mcp add --header 和 claude mcp add-json 帮助文本中错误命名传输方式的问题
- 修复了 claude ultrareview 和 /ultrareview 在云会话启动失败时等待整整 30 分钟的问题;现在会提前停止并报告原因
- 修复了 Bash 权限检查自动批准将算术表达式赋值给整数 shell 变量(如 OPTIND=1/0、RANDOM=2+2)的命令的问题;现在会提示批准
- 修复了后台会话(←、/background、--bg)丢失 shell 中导出的 Vertex/Bedrock 网关(ANTHROPIC_*_BASE_URL + CLAUDE_CODE_SKIP_*_AUTH)导致每次请求失败的问题
- 修复了 Max 计划上的 claude --bg --model fable 在交互式会话仍具有 Fable 配额时停止询问使用积分的问题
- 修复了一次性“将自动模式设为默认”的提示出现在无人值守会话(如 agent-team 队友面板)中的问题,此时误按键可能未经阅读就接受
- 修复了在设置未更改时,重新登录同一 Claude 应用网关后托管设置批准提示再次出现的问题
- 修复了禁用的 /bug 和 /share 报告 /feedback 被禁用的问题;当组织策略或环境变量关闭 /feedback 时,提示、/help 和拒绝消息不再建议使用它
- 修复了云会话创建在 GitHub 连接暂时失败后建议设置 GitHub 的问题——现在消息会建议重试
- 通过减少冗余 UI 重渲染,改进了交互式会话中回合期间的 CPU 使用率
- 改进了安装大小:原生二进制文件减小了约 5 MB
- 改进了云会话:当会话的网络代理在 Bash 命令期间断开连接时,工具结果现在会指明主机和原因,而不仅仅是“连接重置”
- 改进了 /schedule 说明,明确在 Claude Code 中配置的 MCP 服务器无法附加到云端例行任务,而非仅显示“无 MCP 连接器”的简单消息
- 改进了来自您自己的子代理的消息框架:Claude 被告知发送者是本次会话中的工作人员,而非无关的 Claude 会话
- 改进了提示占位符,在查看从子代理面板或 /tasks 打开的后台子代理或分支记录时,显示“消息 @名称…”
- 改进了错误消息、菜单和命令结果中 MCP 服务器名称的净化处理
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力