Claude Code v2.1.271:新增沙箱域名控制、自托管排空与多模型定价,修复多项Bug
v2.1.271
推荐理由
沙箱权限收紧(per-command allowed_domains)直接影响自动化工作流的安全边界,建议开发者立即评估现有脚本是否受此限制影响。
What's changed
变更内容
- Added fast mode in Claude Code Remote sessions (cloud and self-hosted runners): the host's fast-mode setting or /fast typed in the session applies where your organization allows it
- Added mouse support to the /config panel in fullscreen mode: the wheel scrolls the settings list, a click on a setting's value changes it, and the row under the pointer is highlighted
- Added claude self-hosted-runner --drain-marker-file <path>: when that file exists at a SIGTERM drain, the runner reports its exit to the server as a host drain (telemetry only)
- Added per-command allowed_domains to Bash, PowerShell and Monitor in auto mode with sandboxing: the hosts a command needs are reviewed with it and opened for it alone; other hosts are refused
- Added omitClaudeMd to agent frontmatter and --agents JSON, letting custom and plugin subagents run without user, project and local CLAUDE.md files; managed policy files still load
- Added --accept-command <sha256> to claude plugin install and claude plugin update to accept exactly the command a previous --json run displayed, instead of -y
- Added support for a multiplier above 1, up to 10, in the modelPricing managed setting and the Claude apps gateway pricing block, for marked-up internal chargeback rates
- Added a spinner tip pointing Bedrock, Vertex AI, Foundry and LLM gateway users to the Claude desktop app; the claude.ai desktop app tip now suggests /desktop, which offers to download the app
- Fixed a cached organization policy being reused after switching accounts, organizations, or API keys, and the policy not refreshing until the hourly check when the credential changes mid-session
- Fixed the tool and command lists not updating when the organization policy finishes loading after startup or changes mid-session
- Fixed an enterprise managed-mcp.json that can't be read or parsed being ignored: it now keeps exclusive MCP control (user, project and plugin servers don't load) and warns at startup
- Fixed org policy being fetched through, and rejected by, third-party local proxies set via ANTHROPIC_UNIX_SOCKET; they are again treated like other custom gateways, including for Remote Control
- Fixed cloud sessions rejecting every subagent tool call ("updatedInput … failed schema validation") when a workflow or agent approval was applied after the session's worker restarted
- Fixed /fast off answering "Fast mode unavailable" instead of turning fast mode off when the organization has fast mode disabled
- Fixed sessions started with CLAUDE_CODE_SKIP_FAST_MODE_ORG_CHECK re-sending fast requests every turn after the API rejected fast mode; the rejection now stands and its reason is shown
- Fixed fast mode under CLAUDE_CODE_RETRY_WATCHDOG failing the turn on a usage-credits limit, or retrying an overload at fast speed, instead of falling back to standard speed
- Fixed Bash permission checks missing the file that fmt, column and similar commands read when it follows an option the checker doesn't recognize
- Fixed Bash permission checks skipping files a wildcard expands to when the wildcard sits in a command's pattern or option value (for example grep -v dir/* file)
- Fixed Bash permission checks so that shell variable declaration flags cannot misrepresent the command being run
- Fixed Bash commands with two directory changes, a subshell, or a cd+git chain skipping the prompt under permissions.blockReadsOutsideWorkingDirectories in bypass and auto mode
- Fixed a stale .git/config.lock breaking git checkout -b, git push -u and git config for the rest of a session after a sandboxed command failed to start (Linux)
- Fixed settings file changes made outside the session going unnoticed on macOS machines whose system file-event service is saturated; the watcher now falls back to polling
- Fixed resumed claude -p sessions whose tools all come from MCP servers failing with "At least one tool must have defer_loading=false"
- Fixed turns failing with "API returned an empty or malformed response" when an LLM gateway returns the non-streaming reply as text/plain
- Fixed sustained high CPU usage and repeated tool-list requests when an MCP server sends list_changed notifications in a tight loop
- Fixed MCP OAuth mishandling client registrations: denying consent forced a new one, one for another redirect URI was reused, and a concurrent write could delete a valid one or keep a mismatched one
- Fixed tool search returning no match when Claude selects an MCP tool by its bare name instead of its full mcp__server__tool name
- Fixed Ctrl+O cancelling pending MCP server reconnects, and /mcp sent from Remote Control failing while the transcript view is open
- Fixed the Claude in Chrome prompt telling the model to load tools through ToolSearch when ToolSearch is unavailable
- Fixed cross-session messages held by the receiving session's permission-mode policy leaving no trace: headless senders now get a delivery notice, and SendMessage results no longer imply it was read
- Fixed Claude starting a second copy of a background command (such as a watch task or dev server) that was still running after the conversation was compacted
- Fixed /model warning about losing the conversation cache when switching back to the model the conversation actually ran on
- Fixed /reload-skills reporting a skill count that disagreed with the slash menu after /cd
- Fixed /resume and /continue showing only 1-2 sessions in fullscreen mode on short terminals
- Fixed /resume and /teleport keeping the previous conversation's file-read tracking, so Claude could edit files the resumed conversation had never read
- Fixed --resume dropping the 1M context window ([1m]) when the resumed session's model family differs from the configured default model
- Fixed artifacts attached with /artifacts disappearing from the session after --resume
- Fixed background sessions (claude --bg, claude agents) not watching the artifacts they publish for republishes made elsewhere
- Fixed custom agents, slash commands and output styles beyond the first not loading from a virtual drive that reports inode 0, such as an encrypted vault mounted as a Windows drive
- Fixed self-hosted runner sessions silently losing all host config (settings, skills, plugins, MCP servers) when the host config directory exceeds 64 MiB; added --host-config-snapshot disk|memory
- Fixed skills synced from claude.ai staying on disk indefinitely after signing out; copies not refreshed within cleanupPeriodDays now move to the recoverable trash at the next launch
- Fixed spinner tips suggesting commands that aren't available for your account type or are disabled in your session
- Fixed the /add-dir path input: the left and right arrow keys now move the cursor, and Enter adds only the typed path instead of also adding the highlighted completion
- Fixed text fields outside the main prompt moving a leading ! to the end of what you typed (!foo came out as foo!)
- Fixed the interactive /hooks menu crashing when a hook matcher is named after an inherited object property such as __proto__ or constructor
- Fixed a fullscreen rendering glitch where text kept a stale background color after the box around it lost its background
- Fixed Delete in st and Alt+arrow keys in rxvt-unicode not working in attached background sessions
- Fixed the terminal's replies to capability queries (^[[?1;2c) appearing at the shell prompt or in an editor when Claude Code exits, is suspended, or opens an editor right after starting
- Improved terminal rendering performance: large diffs and long transcripts render faster, with fewer slow frames
- Improved startup time slightly by skipping a redundant validation of built-in model data on every launch
- Improved hook feedback: while a SessionStart, UserPromptSubmit, PreToolUse or SessionEnd hook runs, the spinner says so with elapsed time, and Esc cancels a prompt waiting on a SessionStart hook
- 在 Claude Code 远程会话(云端和自托管运行器)中添加了快速模式:主机上的快速模式设置或在会话中输入的 /fast 命令将在组织允许的情况下生效
- 在全屏模式下为 /config 面板添加了鼠标支持:滚轮用于滚动设置列表,点击设置的值可更改该值,指针下方的行会高亮显示
- 添加了 claude self-hosted-runner --drain-marker-file <path>:当 SIGTERM 排空时存在该文件,运行器会将退出报告给服务器作为主机排空(仅限遥测数据)
- 在沙箱环境下自动模式的 Bash、PowerShell 和 Monitor 中添加了 per-command allowed_domains:命令所需的宿主机会与其一起审查并仅为其开放;其他主机会被拒绝
- 在 agent frontmatter 和 --agents JSON 中添加了 omitClaudeMd,允许自定义和插件子代理在没有用户、项目和本地 CLAUDE.md 文件的情况下运行;托管策略文件仍会加载
- 在 claude plugin install 和 claude plugin update 中添加了 --accept-command <sha256>,以接受先前 --json 运行显示的特定命令,而不是使用 -y
- 在 modelPricing 托管设置和 Claude 应用网关定价块中添加了大于 1 且最高为 10 的乘数支持,用于标记内部成本分摊费率
- 添加了一个旋转提示,指引 Bedrock、Vertex AI、Foundry 和 LLM 网关用户使用 Claude 桌面应用;claude.ai 桌面应用提示现在建议输入 /desktop,这将提供下载应用的选项
- 修复了在切换账户、组织或 API 密钥后重用缓存的组织策略的问题,以及凭证在会话中途发生变化时直到每小时检查才刷新策略的问题
- 修复了启动后或会话中途组织策略加载完成时,工具和命令列表未更新的问题
- 修复了无法读取或解析的企业托管 mcp.json 被忽略的问题:现在它将独占 MCP 控制权(不加载用户、项目和插件服务器),并在启动时发出警告
- 修复了通过 ANTHROPIC_UNIX_SOCKET 设置的第三方本地代理获取并被拒绝的组织策略问题:它们再次被视为其他自定义网关,包括用于远程控制
- 修复了在工作流或代理审批应用于会话重启后的工作进程时,云会话拒绝所有子代理工具调用("updatedInput … failed schema validation")的问题
- 修复了当组织禁用快速模式时,/fast off 回答“快速模式不可用”而不是关闭快速模式的问题
- 修复了以 CLAUDE_CODE_SKIP_FAST_MODE_ORG_CHECK 开头的会话在 API 拒绝快速模式后,每轮都重新发送快速请求的问题;现在拒绝状态生效,并显示拒绝原因
- 修复了 CLAUDE_CODE_RETRY_WATCHDOG 下快速模式在使用额度限制时导致回合失败,或在过载时以高速重试而非回退到标准速度的问题
- 修复了 Bash 权限检查未识别 fmt、column 等命令在选项后读取的文件的问题
- 修复了 Bash 权限检查跳过通配符展开文件的问题,当通配符位于命令的模式或选项值中时(例如 grep -v dir/* file)
- 修复了 Bash 权限检查,防止 shell 变量声明标志错误表示正在运行的命令
- 修复了包含两次目录更改、子shell或cd+git链的Bash命令在bypass和auto模式下,因permissions.blockReadsOutsideWorkingDirectories而跳过提示的问题
- 修复了过期的 .git/config.lock 在沙盒命令启动失败后,破坏会话剩余部分的 git checkout -b、git push -u 和 git config 的问题(Linux)
- 修复了 macOS 机器上系统文件事件服务饱和时,会话外对设置文件的更改未被察觉的问题;现在监视器将回退到轮询
- 修复了恢复的 claude -p 会话,其所有工具均来自 MCP 服务器,但因 "At least one tool must have defer_loading=false" 而失败的问题
- 修复了当 LLM 网关以 text/plain 格式返回非流式回复时,回合因 "API returned an empty or malformed response" 而失败的问题
- 修复了 MCP 服务器在紧密循环中发送 list_changed 通知时导致的持续高 CPU 使用和重复的工具列表请求
- 修复了 MCP OAuth 对客户注册的处理不当:拒绝同意会强制创建新的注册,另一个重定向 URI 的注册被重用,且并发写入可能删除有效注册或保留不匹配的注册
- 修复了当 Claude 通过其裸名而非完整的 mcp__server__tool 名称选择 MCP 工具时,工具搜索无匹配结果的问题
- 修复了 Ctrl+O 取消待处理的 MCP 服务器重连,以及在转录视图打开时从远程控制发送 /mcp 失败的问题
- 修复了 Chrome 中的 Claude 提示词指示模型在 ToolSearch 不可用时通过 ToolSearch 加载工具的问题
- 修复了由接收会话的权限模式策略持有的跨会话消息不留痕迹的问题:无头发送方现在会收到投递通知,且 SendMessage 的结果不再暗示消息已被阅读
- 修复了 Claude 在对话被压缩后,仍启动后台命令(如 watch 任务或开发服务器)的第二个副本的问题
- 修复了 /model 警告:在切换回实际运行对话的模型时丢失对话缓存的问题
- 修复了 /reload-skills 在 /cd 之后报告的技能数量与斜杠菜单不一致的问题
- 修复了 /resume 和 /continue 在短终端的全屏模式下仅显示 1-2 个会话的问题
- 修复了 /resume 和 /teleport 保留上一个对话的文件读取跟踪记录,导致 Claude 能够编辑恢复后的对话从未读取过的文件的问题
- 修复了当恢复会话的模型系列与配置的默认模型不同时,--resume 会丢弃 1M 上下文窗口 ([1m]) 的问题
- 修复了使用 /artifacts 附加的工件在 --resume 后从会话中消失的问题
- 修复了后台会话(claude --bg、claude agents)未监控其发布的工件以检测在其他地方进行的重新发布的问题
- 修复了自定义代理、斜杠命令和输出样式在第一个之后无法从报告 inode 为 0 的虚拟驱动器(如挂载为 Windows 驱动器的加密保险库)加载的问题
- 修复了自托管运行器会话在主机配置目录超过 64 MiB 时静默丢失所有主机配置(设置、技能、插件、MCP 服务器)的问题;新增了 --host-config-snapshot disk|memory 选项
- 修复了从 claude.ai 同步的技能在注销后无限期保留在磁盘上的问题;未在 cleanupPeriodDays 内刷新的副本将在下次启动时移至可恢复的回收站
- 修复了旋转提示建议的命令不适用于你的账户类型或在你的会话中被禁用的问题
- 修复了 /add-dir 路径输入的问题:左右箭头键现在可以移动光标,且 Enter 仅添加输入的路径,而不再同时添加高亮的补全内容
- 修复了主提示框外的文本字段将前导 ! 移动到输入末尾的问题(!foo 变成了 foo!)
- 修复了交互式 /hooks 菜单在钩子匹配器命名为继承的对象属性(如 __proto__ 或 constructor)时崩溃的问题
- 修复了全屏渲染故障:文本在周围方框失去背景色后仍保留过时的背景色
- 修复了 st 中的 Delete 键和 rxvt-unicode 中的 Alt+箭头键在附加的后台会话中无效的问题
- 修复了终端对能力查询 (^[[?1;2c) 的回复在 Claude Code 退出、挂起或在启动后立即打开编辑器时出现在 shell 提示符或编辑器中的问题
- 改进终端渲染性能:大型差异和长转录内容的渲染速度更快,卡顿帧更少
- 通过跳过每次启动时对内置模型数据的冗余验证,略微缩短了启动时间
- 改进钩子反馈:在 SessionStart、UserPromptSubmit、PreToolUse 或 SessionEnd 钩子运行时,旋转图标会显示已用时间,且按 Esc 可取消等待 SessionStart 钩子的提示
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力