Claude Code v2.1.304:修复rm -r安全提示缺失、沙箱命令启动失败及多项Bug
v2.1.304
推荐理由
本次更新修复了 rm -r 挂载目录缺失安全提示及 Linux 沙箱命令启动失败等高危问题,直接影响操作安全与稳定性,建议开发者尽快升级以规避数据风险。
What's changed
变更内容
- Added a transcript line when a plugin that runs first skips one of your mod's hooks, naming the event and the plugin
- Added decider: "person" to a mod's tool.check answer: only the permission dialog or a host's callback can approve the ask, and it is refused with the mod's reason where nobody can be asked
- Added e.isReadOnly to a mod's tool.check event, set when the tool call is read-only
- Added /auto-mode-setup: a guided setup that reads your project and recent sessions to teach auto mode about your environment, now also available on Bedrock, Vertex, Foundry, Claude apps gateway and telemetry-disabled sessions
- Added /claude-api managed-agents-secure, which compares a Managed Agents agent's settings with Anthropic's published security guide, without changing anything
- Added the names of the tools called earlier to the compaction summary in the transcript view (Ctrl+O)
- Added a warning on Pro and Max plans when resuming an inactive conversation would use a noticeable share of your 5-hour usage limit: resume anyway, or start a new conversation and Claude can look up the previous one if you refer to it
- Fixed the organization policy not refreshing until the hourly check after approving an ANTHROPIC_API_KEY at startup or switching "Use custom API key" in /config
- Fixed sandboxed commands failing to start on Linux when a sandbox.filesystem.denyRead glob contains brackets that are not a character class, such as a [user-id] route folder
- Fixed rm -r of a mounted drive or a folder at its top level (/Volumes, /media, WSL's /mnt/c) not getting the safety prompt that rm -rf /Applications gets
- Fixed CLAUDE_CODE_TRANSCRIPT_LOCAL_GC dropping messages from the saved transcript when the disk filled up while the file was being trimmed
- Fixed a plugin keeping a headless run going past --max-turns, Stop, or ended input by spawning subagents or re-running a finished one
- Fixed a failed mod reload removing the tools and commands of the version that stays loaded, and its messages being wrong or silent about whether the previous version is still loaded
- Fixed a click on a mod's button being lost when buttons with the same label and no key were redrawn unchanged
- Fixed mod sharing in the built-in plugin-authoring skill stopping at the secret scan on machines with managed settings and on Team and Enterprise plans
- Fixed scheduled Cowork cloud sessions waiting five minutes again for each subagent whose WebFetch needed a URL approval that nobody was there to give
- Fixed Write results and rejected edits showing a file outside the working directory as ../../…; they now show ~/… or the full path
- Fixed a claude.ai Directory plugin's skills not running as commands when picked from the "/" menu in Cowork cloud sessions
- Fixed Remote Control permanently withholding a desktop conversation's history when a different account was signed in to the terminal
- Fixed Remote Control failing to start from Claude Desktop when DISABLE_TELEMETRY or DO_NOT_TRACK is set on a paid plan
- Fixed model switches, messages and interrupts waiting behind a context usage check in SDK and desktop sessions
- Fixed context_management: Extra inputs are not permitted errors behind LLM gateways; Claude Code now resends the request without that field
- Fixed OpenTelemetry settings delivered through server-managed settings being ignored for the whole session after signing in during first-run setup or the first start after /logout
- Fixed unsandboxed Bash commands in Claude Desktop Code tab sessions on macOS and Linux not seeing environment variables exported in shell startup files such as ~/.zshrc
- Fixed the Consumer Terms notice being skipped for a day or longer after a server error
- Fixed /privacy-settings offering choices that may not apply to you after a network or server error
- Fixed a "Context limit reached" or "Prompt is too long" error after stopping a turn while Claude Code was compacting a conversation the API had rejected as too long
- Fixed subagents sometimes forgetting their most recent work when they were messaged or resumed right after finishing
- Fixed claude --help text for --tools, --resume, --debug, --json-schema, --disable-slash-commands, --system-prompt-snapshot and claude update to match actual behavior
- Fixed claude --worktree removing the worktree and its branch without asking at exit when HEAD was detached or on another branch, which could lose commits
- Fixed resumed and cloud sessions sending Claude the whole skill list again each time plugins reloaded at startup
- Fixed an interrupt not ending a Read that waits on an idle pipe or device named like an image
- Fixed /effort status, /effort ultracode and the prompt's effort indicator showing a guessed effort level when CLAUDE_CODE_EFFORT_LEVEL is auto or unset and no level is sent
- Fixed a PreToolUse hook's deny reason being replaced by a timeout error when an Agent SDK callback hook on the same tool call timed out
- Fixed Bash and PowerShell deleting a large command's output file when it could not be copied to the session's tool-results folder, unless the disk is full
- Fixed notes typed into a multiple-choice question with previews being cut off with "…" in terminals under about 100 columns, hiding what was typed (#82768)
- Fixed self-paced /loop wakeups scheduled at the 1-hour maximum firing just after the 1-hour prompt cache expired, so those wakeups no longer re-read the conversation uncached
- Fixed agent teams: approving a shutdown request from the main session no longer exits the whole CLI
- Fixed a skill's once hook also removing another skill's identical hook after it ran
- Fixed transcript mode's { and } landing the prompt on an inconsistent row, or off screen, instead of the transcript's first row
- Fixed CLAUDE_CODE_AUTO_COMPACT_WINDOW=200k silently setting a 100K window: the variable now accepts k and M suffixes like --autocompact, and warns when a value is out of range or ignored
- Fixed Ctrl+C in the agents view clearing a text selection without copying it when pressed before the mouse button was released
- Improved /usage to say when a rate limit on usage data ends instead of "try again in a moment"
- Improved the lines shown when a mod written in the session loads, reloads or fails to load
- Improved artifacts with several views: when you ask for links to them, Claude now writes out each view's link and explains that the address bar stays the same as you switch views
- Improved cloud sessions: a new conversation's first turn no longer waits for the local (stdio) MCP servers of plugins synced from claude.ai, unless a server sets alwaysLoad: true
- Improved how a remote session recovers its status when the server refuses a status update that carried other session data
- Improved session file size in auto mode: the safety classifier's context is no longer stored with every request
- Improved the claude -p invalid-settings warning: a file that did not load lists only what stopped it, and long lists are capped per file
- Improved resume of large compacted sessions in SDK and headless mode: the first request after resuming is sent sooner
- Improved responsiveness and throughput when many subagents are running at the same time
- Improved memory use when sending requests in long or resumed conversations
- Self-hosted runner: Improved the error shown when the git host answers "not found" for a session's repository: it now names the repository and whom to ask
- Windows: Improved git command start-up with a standard Git for Windows install by running its git.exe directly instead of through its cmd launcher
- Changed mods' settings.read hooks to receive each settings layer and rewrite the merged settings, so a managed mod can make an organization's setting a ceiling, including the cleanupPeriodDays the retention sweep uses
- 当优先运行的插件跳过您模块的某个钩子时,在转录行中添加提示,指明事件名称和插件名称
- 为模块的 tool.check 添加了决策器:"person"。答案仅为权限对话框或主机的回调可批准该请求;若无人可询问,则使用模块的原因拒绝
- 为模块的 tool.check 事件添加了 e.isReadOnly,当工具调用为只读时设置此属性
- 新增 /auto-mode-setup:一种引导式设置,通过读取您的项目和近期会话来教自动模式了解您的环境,现在也适用于 Bedrock、Vertex、Foundry、Claude 应用网关以及禁用了遥测的会话
- 新增 /claude-api managed-agents-secure,用于将托管代理(Managed Agents)的设置与 Anthropic 发布的安全指南进行比较,且不进行任何更改
- 在转录视图(Ctrl+O)的压缩摘要中添加了之前调用的工具名称
- 在 Pro 和 Max 计划中,当恢复非活跃对话会显著占用您的 5 小时使用限额时发出警告:仍可恢复,或开始新对话,若您引用之前的对话,Claude 可以查找它
- 修复了组织策略在启动时批准 ANTHROPIC_API_KEY 或在 /config 中切换“使用自定义 API 密钥”后,直到每小时检查才刷新的问题
- 修复了在 Linux 上,当 sandbox.filesystem.denyRead 通配符包含不是字符类的括号(如 [user-id] 路由文件夹)时,沙箱命令无法启动的问题
- 修复了对挂载驱动器或其顶层文件夹(/Volumes、/media、WSL 的 /mnt/c)执行 rm -r 时,未获得类似 rm -rf /Applications 那样的安全提示的问题
- 修复了在文件修剪过程中磁盘空间已满时,CLAUDE_CODE_TRANSCRIPT_LOCAL_GC 从保存的转录中丢弃消息的问题
- 修复了插件通过生成子代理或重新运行已完成的子代理,导致无头运行超出 --max-turns、Stop 或已结束输入限制的问题
- 修复了模块重载失败时移除了仍加载版本的工具和命令,且其消息未能正确或静默说明前一版本是否仍在加载的问题
- 修复了在标签相同且无键的按钮被未改变地重绘时,点击模块按钮丢失的问题
- 修复了在内置插件创作技能中进行模块共享时,在具有托管设置的机器以及 Team 和 Enterprise 计划上,秘密扫描停止工作的问题
- 修复了预定的 Cowork 云会话对每个需要 URL 批准但无人给予批准的 WebFetch 子代理再次等待五分钟的问题
- 修复了写入结果和被拒绝的编辑显示工作目录外的文件为 ../../… 的问题;现在显示 ~/… 或完整路径
- 修复了在 Cowork 云会话中从“/”菜单选择时,claude.ai Directory 插件的技能未作为命令运行的问题
- 修复了当终端登录了不同账户时,远程控制永久保留桌面对话历史记录的问题
- 修复了在付费计划上设置 DISABLE_TELEMETRY 或 DO_NOT_TRACK 时,无法从 Claude Desktop 启动远程控制的问题
- 修复了模型切换、消息和中断在 SDK 和桌面会话中因上下文使用检查而等待的问题
- 修复了 LLM 网关后出现“不允许额外输入”错误的问题;Claude Code 现在会重新发送不带该字段的请求
- 修复了通过服务器管理设置提供的 OpenTelemetry 设置在首次运行设置期间或 /logout 后的首次启动期间登录后,整个会话被忽略的问题
- 修复了 macOS 和 Linux 上 Claude Desktop 代码标签页会话中的非沙盒 Bash 命令无法看到在 shell 启动文件(如 ~/.zshrc)中导出的环境变量的问题
- 修复了服务器错误后跳过消费者条款通知一天或更长时间的问题
- 修复了网络或服务器错误后 /privacy-settings 提供可能不适用于您的选项的问题
- 修复了在停止一个回合时,如果 Claude Code 正在压缩 API 因过长而拒绝的对话,导致出现“达到上下文限制”或“提示词太长”错误的问题
- 修复了子智能体在完成工作后立即收到消息或恢复时,有时会忘记其最近工作的情况
- 修复了 claude --help 中关于 --tools、--resume、--debug、--json-schema、--disable-slash-commands、--system-prompt-snapshot 和 claude update 的文本与实际行为不匹配的问题
- 修复了当 HEAD 处于分离状态或在另一个分支上时,claude --worktree 在退出时未经询问即删除工作树及其分支,可能导致提交丢失的问题
- 修复了恢复的会话和云会话在插件每次启动时重新加载时,再次向 Claude 发送整个技能列表的问题
- 修复了中断未能结束等待名为图像的空闲管道或设备的读取操作的问题
- 修复了当 CLAUDE_CODE_EFFORT_LEVEL 为 auto 或未设置且未发送级别时,/effort 状态、/effort ultracode 和提示词的 effort 指示器显示猜测的努力等级的问题
- 修复了当同一工具调用的 Agent SDK 回调钩子超时时,PreToolUse 钩子的拒绝原因被替换为超时错误的问题
- 修复了 Bash 和 PowerShell 在无法将大型命令的输出文件复制到会话的 tool-results 文件夹时删除该文件的问题,除非磁盘已满
- 修复了在列数少于 100 列的终端中,多选题预览中输入的笔记被 "…" 截断,导致隐藏输入内容的问题 (#82768)
- 修复了自定进度的 /loop 唤醒任务:当安排在 1 小时最大间隔触发时,会在 1 小时提示缓存过期后不久立即触发,现在这些唤醒任务不再重新读取未缓存的对话
- 修复了代理团队问题:批准来自主会话的关闭请求不再退出整个 CLI
- 修复了技能(skill)的 once 钩子在运行后也会移除另一个技能的相同钩子的问题
- 修复了转录模式(transcript mode)中 { 和 } 导致提示符落在不一致的行或屏幕外,而不是转录的第一行的问题
- 修复了 CLAUDE_CODE_AUTO_COMPACT_WINDOW=200k 静默设置为 100K 窗口的问题:该变量现在接受 k 和 M 后缀(与 --autocompact 类似),并在值超出范围或被忽略时发出警告
- 修复了代理视图中 Ctrl+C 的问题:在鼠标按钮释放前按下 Ctrl+C 会清除文本选区但不复制内容
- 改进了 /usage 命令:显示使用数据速率限制的结束时间,而不是显示 "稍后再试"
- 改进了会话中加载、重新加载或加载失败的模块(mod)所显示的日志行
- 改进了具有多个视图的工件(artifacts):当你请求它们的链接时,Claude 现在会输出每个视图的链接,并解释在切换视图时地址栏保持不变
- 改进了云会话:新对话的首轮交互不再等待从 claude.ai 同步的插件的本地 (stdio) MCP 服务器,除非某个服务器设置了 alwaysLoad: true
- 改进了远程会话在服务器拒绝携带其他会话数据的状态更新时恢复其状态的方式
- 改进了自动模式下的会话文件大小:安全分类器的上下文不再随每个请求存储
- 改进了 claude -p 无效设置警告:未加载的文件仅列出阻止其加载的原因,且长列表按文件进行限制
- 改进了 SDK 和无头模式下大型压缩会话的恢复:恢复后的首个请求发送得更快
- 改进了同时运行大量子代理时的响应速度和吞吐量
- 改进了在长对话或恢复的对话中发送请求时的内存使用
- 自托管运行程序:改进了当 git 主机对会话的仓库返回 "not found" 时显示的错误信息:现在它会指明具体的仓库名称以及应向谁询问
- Windows:通过直接运行 Git for Windows 安装自带的 git.exe,而不是通过其 cmd 启动器,在使用标准 Git for Windows 安装时改进了 git 命令的启动速度。
- 将 mods 的 settings.read 钩子更改为接收每个设置层并重写合并后的设置,从而使受管理的 mod 可以将组织的设置设为上限,包括保留清理周期使用的 cleanupPeriodDays。
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力