Claude Code v2.1.301:修复模型切换与用量消耗异常、Vim模式及VSCode面板问题
v2.1.301
推荐理由
本次更新直接修复了“切换小窗口模型时意外消耗用量”这一破坏性逻辑错误,且涉及高频使用的 Vim 交互与 VS Code 体验,建议开发者升级以规避潜在成本损失。
What's changed
变更内容
- Added CLAUDE_CODE_RETRY_WATCHDOG_MAX_USAGE_LIMIT_WAIT_MS so unattended retry mode (CLAUDE_CODE_RETRY_WATCHDOG) ends a request at a usage limit that resets too far away instead of waiting
- Added OpenTelemetry tracing guidance to the claude-api skill, including setting up trace destinations with the ant CLI
- Added the % motion to vim mode: jump to the matching bracket, alone or with d/c/y
- Added rows to a mod's Input: a text field of several lines in the terminal, where Enter submits and Shift+Enter or a backslash before Enter starts a new line
- Added classifier_verdict and permission_mode to OpenTelemetry tool_decision events, so auto mode classifier decisions can be told apart from permission rules
- Added classifier_category to OpenTelemetry tool_decision events, naming the built-in rule a classifier block matched, when OTEL_LOG_TOOL_DETAILS=1
- Fixed quitting removing a worktree made by a WorktreeCreate hook without asking when it may hold unpushed commits
- Fixed the fable (and best) model alias erroring on the Anthropic API when the newest Fable model is not available to your organization: Claude Code now retries once on the previous Fable model
- Fixed a misleading "Please run /login" error when a full disk keeps the login from being refreshed; the error now names the disk and says to delete files
- Fixed Grep and Glob reporting no matches when the search program failed unexpectedly before returning any results; they now return an error saying the search failed
- Fixed workflow agents sometimes skipping their step, and the run still reporting success, after reading the harness note that their task text carries no user authority
- Fixed artifact updates being refused where a PreToolUse hook covers Edit or Write; Claude now edits the file and then republishes instead of changing it in the publish call
- Fixed skills and commands with very many or very long argument names stalling for seconds when invoked; only the first 64 names, each up to 64 characters, are now filled in
- Fixed skills, commands and hooks using very large amounts of memory when their arguments fill many placeholders
- Fixed stray characters such as >0q covering the folder trust prompt, and >4m before the shell prompt at exit, in terminals built on VTE older than 0.53 such as MATE Terminal on RHEL 8
- Fixed stray GOK text appearing in the prompt at startup in some versions of iTerm2
- Fixed switching to a model whose name contains application-inference-profile running your awsAuthRefresh command and delaying model-switch hooks when the provider is not Bedrock
- Fixed sign-in refresh timeouts and unexpected sign-outs after a short command such as claude auth status or claude plugin list exited in the middle of a token refresh
- Fixed a tool call cut off by a message sent mid-turn during its permission check being reported to the model as rejected by the user
- Fixed a case where switching to a model with a smaller context window could spend usage credits on a summary by the previous model without asking first
- Fixed conversations being compacted over and over, on a model you didn't pick, behind an LLM gateway whose responses name a different model than the one requested
- Fixed vim mode sometimes staying in INSERT after Escape on a slow or busy machine
- Fixed Esc discarding a typed AskUserQuestion answer in vim mode: the free-text field now supports vim NORMAL mode, and Esc cancels only from NORMAL
- Fixed the Read tool reading binary files such as .xlsm, .parquet, .epub and .heic as text
- Fixed a Markdown table with only a header row drawing nothing when too wide for the terminal, including in plans on the plan approval card
- Fixed the /claude-api skill saying CMEK external-key endpoints aren't available on Claude Platform on AWS
- Fixed skills no longer being listed to the model after using /rewind
- Fixed the compaction row in a resumed session offering ctrl+o for history that is not loaded; it now says where the earlier messages are saved, and also shows in fullscreen
- Fixed the "new task? /clear to save tokens" hint coming back right after you interrupt a response
- Fixed the permission prompt for a plugin or skill hook's ask decision not showing which plugin or skill the hook comes from
- Fixed /diff not noticing a conflicted cherry-pick or revert in reftable repositories when one of its git checks timed out or failed
- Fixed workflow scripts asking for permission or being refused when read, edited or re-run after a Bash cd in the same session
- Fixed dim text on the dark ANSI theme and 16-color terminals: faint inside filled boxes, not faint under selection and search highlights, and list descriptions dimmed like other secondary text
- Fixed a mod's $.model.fork returning nothing-to-fork when called before the first response of a new Claude Code process had finished, as in claude -p runs and cloud sessions
- Fullscreen mode: Fixed /compact and auto-compact briefly freezing the UI while the visible transcript is rebuilt
- Self-hosted runner: Fixed sessions started from Slack being unable to find or attach a repository when managed settings restrict MCP servers; use deniedMcpServers to keep those tools off
- Self-hosted runner: Fixed sessions being reported as having a deleted source branch, and not retried, when an unrelated setup or session failure quoted git's missing-ref wording
- Self-hosted runner: Fixed the log promising a retry of a failed or declined session release for a session that is ending; repeated failures now show a count
- Windows: Fixed stopped background PowerShell commands missing the closing [killed] line in their output file
- Improved switching to a model with a smaller context window: a conversation too long for the new model is now summarized by the previous model first
- Improved rendering performance while a long-running subagent works: its progress trail now updates incrementally instead of being reprocessed in full on every render
- Improved artifacts: pages Claude writes now paint the band above a sticky header, so scrolled text no longer shows there in the mobile apps
- Improved mods: in VS Code and the desktop and mobile apps, a tree drawn above the question dialog can now hold Markdown and up to 48 rows; the terminal keeps 12 plain rows
- Changed a mod hook's .catch handler to run only when the hook throws or times out; events raised beneath the hook's own calls now skip that hook without asking its .catch
- Changed a mod's $.env.set to resolve with {} once the variable is set or unset, or with { deny } saying why when the write is not made
- [VSCode] Added LaTeX math rendering in Claude's responses, including $$ and multi-line \[ … \] blocks and inline $…$ and \(…\) math
- [VSCode] Added a "Get more usage" link to the usage-limit banner for Pro and Max plans in the VS Code and JetBrains panels
- [VSCode] Fixed a conversation that crashes or freezes the panel being reopened on every reload
- [VSCode] Fixed the chat panel slowing down during long thinking: it no longer re-parses the whole thinking text on every update
- [VSCode] Fixed diagnostics showing "[object Object]" instead of the rule code (e.g. MD013) for some language servers
- [VSCode] Fixed the native dictation audio module being loaded, to check microphone permission, where dictation is not offered (non-claude.ai sign-ins, remote windows)
- 新增 CLAUDE_CODE_RETRY_WATCHDOG_MAX_USAGE_LIMIT_WAIT_MS,使无干预重试模式(CLAUDE_CODE_RETRY_WATCHDOG)在重置时间过远的用量限制处终止请求,而非继续等待
- 向 claude-api 技能添加了 OpenTelemetry 追踪指南,包括使用 ant CLI 设置追踪目标
- 在 vim 模式中新增 % 运动:跳转到匹配的括号,可单独使用或与 d/c/y 组合使用
- 为 mod 的 Input 新增了行支持:终端中的多行文本字段,按 Enter 提交,按 Shift+Enter 或在 Enter 前加反斜杠则开始新行
- 在 OpenTelemetry tool_decision 事件中新增 classifier_verdict 和 permission_mode,以便区分自动模式的分类器决策与权限规则
- 在 OpenTelemetry tool_decision 事件中新增 classifier_category,当 OTEL_LOG_TOOL_DETAILS=1 时,命名分类器块匹配到的内置规则
- 修复了退出时未询问即删除由 WorktreeCreate 钩子创建的 worktree 的问题,尤其是在该 worktree 可能包含未推送的提交时
- 修复了 fable(以及 best)模型别名在 Anthropic API 中因组织无法访问最新 Fable 模型而出错的问题:Claude Code 现在会在上一个 Fable 模型上重试一次
- 修复了磁盘满导致登录无法刷新时显示的误导性“请运行 /login”错误;现在错误信息会指明磁盘并提示删除文件
- 修复了 Grep 和 Glob 在搜索程序意外失败且未返回任何结果时报告无匹配项的问题;现在它们会返回表示搜索失败的错误
- 修复了工作流代理在读取到其任务文本不具备用户授权后,有时跳过步骤但仍报告运行成功的问题
- 修复了在 PreToolUse 钩子覆盖 Edit 或 Write 时拒绝更新工件的问题;Claude 现在会先编辑文件,然后在发布调用中重新发布,而不是在发布调用中更改它
- 修复了参数名称非常多或非常长的技能和命令在调用时会卡顿数秒的问题;现在仅填充前 64 个名称,每个名称最多 64 个字符
- 修复了当参数填充大量占位符时,技能和命令及钩子使用大量内存的问题
- 修复了基于早于 0.53 版本的 VTE 构建的终端(如 RHEL 8 上的 MATE Terminal)中, stray 字符如 \u003e0q 覆盖文件夹信任提示,以及在退出时 shell 提示符前出现 \u003e4m 的问题
- 修复了在某些版本的 iTerm2 启动时提示符中出现 stray GOK 文本的问题
- 修复了切换到名称包含 application-inference-profile 且正在运行 awsAuthRefresh 命令的模型时,在 provider 不是 Bedrock 的情况下延迟 model-switch hooks 的问题
- 修复了在 token 刷新过程中,claude auth status 或 claude plugin list 等短命令中途退出后出现的登录刷新超时和意外登出问题
- 修复了在权限检查期间因发送消息而导致工具调用被截断,并被报告给模型为已被用户拒绝的问题
- 修复了切换到上下文窗口较小的模型时,可能会在未事先询问的情况下消耗使用额度用于前一个模型的摘要生成的情况
- 修复了对话被反复压缩的问题,这发生在由 LLM 网关背后的模型上(该模型并非用户选择),且其响应中提及的模型与请求的模型不同
- 修复了在缓慢或繁忙的机器上,vim 模式有时在按 Escape 后仍停留在 INSERT 状态的问题
- 修复了 Esc 键在 vim 模式下丢弃已输入的 AskUserQuestion 答案的问题:自由文本字段现在支持 vim NORMAL 模式,且 Esc 仅从 NORMAL 模式取消
- 修复了 Read 工具将 .xlsm、.parquet、.epub 和 .heic 等二进制文件作为文本读取的问题
- 修复了当 Markdown 表格过宽超出终端显示范围时(包括在计划审批卡片中的计划里),仅含标题行的表格无法正确绘制的问题
- 修复了 /claude-api 技能错误地声称 Claude Platform on AWS 上不可用 CMEK external-key 端点的问题
- 修复了在使用 /rewind 后技能不再向模型列出的问题
- 修复了恢复会话中的压缩行对未加载的历史记录提供 ctrl+o 快捷键的问题;现在它会说明早期消息保存的位置,并在全屏模式下显示
- 修复了在中断响应后立即重新出现“新任务?/clear 以节省令牌”提示的问题
- 修复了插件或技能钩子的 ask 决策权限提示未显示钩子来源的插件或技能的问题
- 修复了当 git 检查超时时,/diff 未能注意到 reftable 仓库中冲突的 cherry-pick 或 revert 的问题
- 修复了在同一会话中执行 Bash cd 后,工作流脚本在读取、编辑或重新运行时请求权限或被拒绝的问题
- 修复了深色 ANSI 主题和 16 色终端下文本变暗的问题:填充框内的文本不应变淡,选中和搜索高亮下的文本不应变淡,列表描述应像其他次要文本一样变暗
- 修复了在新 Claude Code 进程的第一个响应完成之前(如 claude -p 运行和云会话中)调用 $.model.fork 返回无内容可分叉的问题
- 全屏模式:修复了固定/紧凑和自动紧凑模式下,在重建可见转录内容时短暂冻结用户界面的问题
- 自托管运行器:修复了在受管设置限制 MCP 服务器时,从 Slack 启动的会话无法找到或附加仓库的问题;使用 deniedMcpServers 以禁用这些工具
- 自托管运行器:修复了当无关的设置或会话失败引用了 git 的 missing-ref 措辞时,会话被报告为具有已删除的源分支且未重试的问题
- 自托管运行器:修复了日志承诺对结束中的会话的重试失败或被拒绝的会话释放,但实际并未重试的问题;重复失败现在会显示计数
- Windows:修复了停止的后台 PowerShell 命令在其输出文件中缺少关闭行 [killed] 的问题
- 改进了切换到上下文窗口较小的模型时的体验:如果对话长度超出新模型的限制,现由前一个模型先进行摘要
- 改进了长时间运行的子代理工作时的渲染性能:其进度轨迹现在增量更新,而不是每次渲染时都重新处理全部内容
- 改进了工件(artifacts):Claude 编写的页面现在会在粘性标题上方绘制色带,因此在移动应用中滚动文本时不再在该区域显示
- 改进了 mods:在 VS Code 以及桌面和移动应用中,位于问题对话框上方的树形控件现在可以容纳 Markdown 内容和最多 48 行;终端保持 12 行纯文本
- 更改了 mod 钩子的 .catch 处理器,使其仅在钩子抛出异常或超时时运行;钩子自身调用下方引发的事件现在会跳过该钩子,而不询问其 .catch
- 更改了 mod 的 $.env.set 行为:变量设置或取消设置后解析为 {},如果写入未成功则解析为 { deny } 并说明原因
- [VSCode] 在 Claude 的回复中添加了 LaTeX 数学公式渲染支持,包括 $$ 和多行 \[ … \] 块以及内联 $…$ 和 \(…\) 数学公式
- [VSCode] 在 VS Code 和 JetBrains 面板中,为 Pro 和 Max 计划的使用量限制横幅添加了“获取更多使用”链接
- [VSCode] 修复了导致面板崩溃或冻结的对话在每次重新加载时都被重新打开的问题
- [VSCode] 修复了在长时间思考期间聊天面板变慢的问题:它不再在每次更新时重新解析整个思考文本
- [VSCode] 修复了某些语言服务器的诊断信息显示 “[object Object]” 而非规则代码(例如 MD013)的问题
- [VSCode] 修复了在非 claude.ai 登录、远程窗口等不提供语音输入功能的场景下,仍加载原生语音输入音频模块以检查麦克风权限的问题
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力