Claude Code 2.1.307
新功能 8 項
Code Review 支援停止指令,快速解除 PR 自動審查
當你在 GitHub 的拉取請求(Pull Request)啟用自動審查後,若是功能已經測試完畢準備合併,往往不需要機器人再次介入。⟦跟退訂每日鮮乳配送一樣,以前聯絡客服終止可能還會多送一天的牛奶,現在辦理完成立即停送,不會在退訂當天又往門口放一瓶多餘的飲品。⟧現在 Code Review 新增了 @claude review stop 指令,同時也支援 @claude review off 與 @claude review pause。輸入後能直接結束該拉取請求上的 @claude review always 訂閱,而且不會觸發新一輪審查。在合併程式碼的最後關頭,你可以俐落收尾,不必再被多餘的審查留言打擾。
官方原文
[Code Review] Added @claude review stop (also off and pause) to Code Review, ending an @claude review always subscription on a pull request without starting a new review
內建指令選單顯示精簡描述,新增 API 版本切換
平常在終端機按下 / 或是輸入 /help 查詢功能時,畫面呈現的整潔度直接影響尋找指令的效率。以前針對 /claude-api 等內建技能,清單會直接倒出寫給模型閱讀的長篇說明,把選單畫面撐得相當冗長。⟦讀者翻閱工具書的索引目錄時,以前條目旁印滿給排版校對看的長篇備註,現在全部換回簡短摘要,版面呈現乾淨明瞭。⟧現在選單已改為顯示給使用者看的精簡說明,閱讀起來不再雜亂。若你需要將專案內的 Claude API 程式碼推進至 2026-10-21 版本,直接輸入 /claude-api api-version 即可快速遷移。
官方原文
Added /claude-api api-version to move Claude API code to API version 2026-10-21
Fixed /help and the / command menu showing long model-facing descriptions for bundled skills such as /claude-api instead of their short descriptions
安全事件支援遙測追蹤,權限清單清楚列出被拒指令
當你透過自動模式或安全規則控管各項工具時,操作被擋下的細節與放行流程現在更加清楚。只要工具呼叫被權限規則、自動模式、安全檢查、掛鉤(特定事件發生時被觸發的小程式)或沙盒阻止、提示或退回,OpenTelemetry 都會記錄 claude_code.safety_event 遙測事件。以前在 /permissions 的 Recently denied 畫面中不會顯示被拒絕的 shell 指令,且自動模式的本機分類器在審查重試指令時還會忽略此處的核准;現在核准記錄會直接標明具體指令名稱而非抽象描述。當網頁搜尋預算耗盡時,通知也會同步告誡 Claude 不得透過瀏覽器或電腦操作(computer use)轉向外部搜尋引擎查詢。以前指令被擋下後難以追查原貌、核准重試又可能再次受阻,現在每一道安全關卡都有跡可循,放行指令也能正確生效。
官方原文
Added the claude_code.safety_event OpenTelemetry event for each tool call a permission rule, auto mode, a safety check, a hook or the sandbox stopped, prompted or sent back
Fixed /permissions > Recently denied not showing the denied shell command, and auto mode's local classifier ignoring an approval from there when it checks a retried command; approving a row now names the command, not its description
Changed the notice Claude gets when the WebSearch budget is used up to also tell it not to query search engines in a browser or through computer use
子代理避免重複接工,工具呼叫格式錯誤時支援自動重試
當你借助子代理或 Agent SDK 執行複雜的多工流程時,多項非同步協作的容錯機制已完成補強。針對同時啟動的多個 fork 子代理,現在各自分發時會明確指派身分,不再容易互相搶接對方的工作。⟦工廠領班指派多人協同組裝時,以前組員容易爭搶同一份工單,現在每個人都清楚領取專屬工作卡,遇到辨識不清的指示還會主動重新確認,最多兩次。⟧工具呼叫無法解析時,現在最多重試兩次;仍無法解析才會報錯並結束這一輪。在文字稿記錄方面,串流回應不再填入佔位的 token(AI 處理與計費的文字單位)數值與空白停止原因;透過 SDK 的 setModel() 切換模型時,確認等待時間也由 5 秒放寬至 15 秒。這些調整減少了自動化流程中的非預期中斷,讓複雜排程執行得更平穩。
官方原文
Fixed subagent transcripts recording placeholder token usage and an empty stop reason for streamed responses
Fixed model switches through the Agent SDK's setModel(), and apps built on it, being refused when the API took more than 5 seconds to confirm the model; Claude Code now waits up to 15 seconds
Improved recovery from unparseable tool calls: Claude Code now retries the call up to twice before ending the turn with an error
Improved fork subagents launched together: each is now told which launch is its own, so forks are much less likely to try to start each other's work
瀏覽器登入即刻顯示成功頁面,加快遠端與雲端連線速度
當你開啟瀏覽器登入帳號或使用遠端連線功能時,整體等待體驗與狀態回報已獲得多項改進。現在瀏覽器登入只要一完成,瀏覽器便會立刻跳出成功畫面,不需要乾等帳號個人資料慢慢載入。桌面應用有某個 MCP 外部工具伺服器連不上時,雲端工作階段等待首次回覆的時間也縮短了。如果對話文字稿中塞滿了貼上的大型圖片或 PDF 讀取內容,遠端控制(Remote Control)的連線建立過程也變得更快。透過桌面應用程式封存閒置工作階段而中止的背景指令,通知會清楚標明輸出檔案名稱,不再向 Claude 誤報成是使用者手動停止。
官方原文
Fixed a background command stopped through a connected app (such as the desktop app archiving an idle session) being reported to Claude as stopped by the user; the notice now names its output file
Improved browser sign-in: the success page now appears as soon as sign-in completes, without waiting for your account profile to load
Improved the time to the first reply in cloud sessions when one of the desktop app's MCP servers can't connect
Improved Remote Control connect time for sessions whose transcript contains large pasted images or PDF reads
雲端搜尋提供即時進度回饋,網頁讀取錯誤回歸正常結果
當你在雲端環境挑選儲存庫或讓 Claude 抓取網頁資料時,多處介面狀態與錯誤回饋現在更為貼近真實情況。在儲存庫選擇器中,搜尋進行中會明確顯示「Searching…」,不會再於結果抵達前誤跳「找不到相符儲存庫」的假警報。面對自託管環境,「Waiting for a runner」的等待提示不再被截斷,若是隨選執行器,還會從你最後一則訊息起算等待秒數,並顯示失敗次數。在網路擷取方面,Cowork 雲端工作階段的 WebFetch 遇到網站回傳 4xx 狀態碼或 robots.txt 阻擋時,會如同本機環境般作為一般結果呈現,不再拋出工具錯誤。在雲端或自託管執行器工作階段,搜尋遭 403 拒絕且回應附有原因時,現在會顯示該原因,不再只顯示驗證錯誤(Authentication error)。
官方原文
Fixed WebFetch in Cowork cloud sessions reporting a tool error when a site answered with a 4xx status or a robots.txt refusal; it is now a normal result, as in local sessions
Improved web search errors in cloud and self-hosted runner sessions: a search refused with a 403 that gives a reason now shows that reason instead of a generic "Authentication error"
[Cloud sessions] Fixed the repository picker saying "No repositories match" while a search was still running; it now shows "Searching…" until the results arrive
[Cloud sessions] Fixed the "Waiting for a runner" status on self-hosted environments being cut off; with on-demand runners it now counts up from your last message and shows failed attempts
自託管執行器預設掛鉤超時上限,防止殘留程序佔用槽位
自行架設執行器(Self-hosted runner)跑自動化流程的人,這版要留意四項改動。專案準備階段的 checkout 掛鉤(特定事件發生時被觸發的小程式)現在預設以 30 分鐘為限,超時會直接判定設定失敗;若任務需要更久,可自訂 --checkout-hook-timeout-min 延長時間或設為 0 解除上限。過去若在掛鉤執行期間封存或重新排入工作階段,或停止執行器,掛鉤的行程會留著繼續執行,執行器的槽位也一直被佔住,這已修好。啟用 --use-anthropic-git-proxy 時,也不會再誤將前一次工作階段留下的 .claude/settings.local.json 提交進版本控制中。替 Anthropic 管理的 Git 建立憑證檔案時,現在比照 CLI 過濾受信任憑證,並以 [runner:warn] 記錄排除數量。
官方原文
Self-hosted runner: Fixed sessions with --use-anthropic-git-proxy committing a .claude/settings.local.json left in the clone by an earlier session
Self-hosted runner: Fixed archiving or requeueing a session, or stopping the runner, during its checkout hook leaving the hook's processes running and the runner's slot held
Self-hosted runner: Changed checkout hooks to be stopped after 30 minutes by default, failing the session's setup; if yours needs longer, raise --checkout-hook-timeout-min or set it to 0
Self-hosted runner: Changed the certificate file built for Anthropic-managed git to filter its trusted certificates as the CLI does; a [runner:warn] line gives the number left out
VS Code 語音聽寫新增中斷提示,完善 TLS 憑證支援
在 VS Code 裡對著麥克風念出程式碼需求時,自動停止的機制與公司內網憑證相容性已經獲得完善。當語音聽寫因連續 15 秒沒有辨識出語音或達到 2 分鐘上限而自動關閉時,麥克風按鈕會跳出說明告知原因,並確認剛才說過的文字皆已妥善保留。針對經 TLS 封包檢查的代理網路,若僅在 ~/.claude/settings.json 設定 NODE_EXTRA_CA_CERTS 曾導致聽寫連線失敗,現在已修好,聽寫也會遵循 CLAUDE_CODE_CERT_STORE。語音聽寫與擴充套件本身的請求,現在都比照 CLI 過濾受信任憑證。擴充套件本身的請求也會信任環境變數或使用者設定指定的 NODE_EXTRA_CA_CERTS 憑證檔案。
官方原文
[VSCode] Added a notice on the microphone button when voice dictation stops by itself (15 seconds without recognized speech, or the 2-minute limit), saying why and that the text so far is kept
[VSCode] Fixed dictation failing behind a TLS-inspecting proxy when NODE_EXTRA_CA_CERTS is set only in ~/.claude/settings.json; it now also follows CLAUDE_CODE_CERT_STORE
[VSCode] Changed voice dictation to filter its trusted certificates as the CLI does
[VSCode] Changed the extension's own requests to filter their trusted certificates as the CLI does, and to trust the NODE_EXTRA_CA_CERTS file named in the environment or in user settings
修正 4 項
修復 MCP 工具連線與休眠逾時,避免重複發送寫入請求
當你依賴 MCP(讓 AI 連接外部工具的協定)擴充功能時,以下連線問題已修好。在 macOS 上,若登入鑰匙圈鎖定,claude -p 會說明驗證受阻的原因,解鎖後下次執行便能連線,無須重新登入。過去 macOS 或 Linux 電腦在 MCP 伺服器連線途中進入睡眠,伺服器會被回報為逾時,並在無頭模式(沒有視覺介面的執行模式)下一直顯示失敗,這已修好。HTTP 呼叫中途斷線時,現在僅限唯讀或具備冪等特性(重做也不改變結果)的工具才會自動重試,避免寫入操作觸發兩次。背景任務執行時,新一輪對話有時未取得 SDK MCP 伺服器的最新工具,這已修好。桌面版 Code 標籤頁中,直接設定的 GitHub MCP 伺服器寫入工具,表單關閉後未建立內容的狀況也已修正。
官方原文
Fixed MCP servers showing "needs authentication" in claude -p on macOS while the login keychain was locked; they now say why, and the next run after an unlock connects without a new sign-in
Fixed MCP servers being reported as timed out, and staying failed in headless runs, when a macOS or Linux computer went to sleep while they were connecting
Fixed HTTP MCP tool calls being sent twice when the connection closed mid-call; only read-only or idempotent tools are now retried
Fixed a turn sometimes starting without an SDK MCP server's latest tools when a background task was running
Fixed write tools on a directly configured GitHub MCP server showing a form that closed without creating anything in the desktop app's Code tab
修正自訂閘道標頭與遙測錯誤,完善模型設定判定
若你使用自訂 ANTHROPIC_BASE_URL 閘道(代為轉送連線請求的中間服務)或 Foundry,無效的 prompt-caching-scope 標頭已不再送出。Claude apps 閘道工作階段不再忽略 CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS;其 Claude Desktop 工作階段設定 OTEL_EXPORTER_OTLP_HEADERS 後遙測遭拒的問題已修復。CLAUDE_CODE_DISABLE_1M_CONTEXT 搭配帶 [1m] 的模型別名時不再報錯找不到模型。Artifact 讀取重用連線遭伺服器關閉時不再出現連線重設錯誤。自 2.1.305 起,axScreenReader 與 env 區塊中的 CLAUDE_AX_SCREEN_READER,只從使用者、受管理或 --settings 生效。
官方原文
Fixed requests failing with a model-not-found error when CLAUDE_CODE_DISABLE_1M_CONTEXT is set and the model is an alias with the [1m] suffix, such as opus[1m]
Fixed the prompt-caching-scope beta header being sent behind custom ANTHROPIC_BASE_URL gateways and on Foundry, where it has no effect
Fixed CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS being ignored in Claude apps gateway sessions
Fixed telemetry from Claude Desktop sessions behind a Claude apps gateway being rejected when OTEL_EXPORTER_OTLP_HEADERS is set
Fixed Artifact tool reads failing with a connection reset when the server had closed a reused connection
Changed the axScreenReader setting and CLAUDE_AX_SCREEN_READER in a settings env block to apply only from user, managed or --settings settings (since 2.1.305)
修正對話自動精簡震盪,避免重啟後舊訊息復活
長時間對話並夾帶大量圖表資料時,歷史訊息的壓縮與清理機制決定了對話能否順利延續。⟦辦公室碎紙機處理厚重的設計圖冊時,以前一次塞入太多大張圖紙容易反覆卡紙倒退,清空後的廢紙匣在重開電源後竟然還會把舊草稿吐出來;現在卡紙少了一些,清空的廢紙匣也不會再吐出舊草稿。⟧過去在單一輪次中讀取大量 PDF 頁面、圖片或龐大工具輸出時,可能出現「Autocompact is thrashing」錯誤,代表自動精簡反覆震盪;這次修好了其中一部分情況。在雲端工作階段中,自訂的 /autocompact 視窗範圍在工作階段重新啟動後不會再跳回預設值。透過 /clear 清除的對話紀錄,在雲端或自託管執行器重啟後,也不會再莫名其妙復活。
官方原文
Fixed some "Autocompact is thrashing" errors in turns that read many PDF pages, images or other large tool results
Fixed /autocompact in cloud sessions going back to the default window after the session restarted
Fixed a conversation cleared with /clear sometimes coming back when a cloud or self-hosted runner session restarted
VS Code 限制展開提示詞高度,修正 LaTeX 數學式貼上格式
在 VS Code 中使用 Claude Code 撰寫複雜指示或整理筆記時,對話框排版與文字貼上體驗更為順暢。過去只要點擊 Show more 展開較長的提示詞,整張輸入卡片會直接霸佔整個對話面板;現在釘選的提示詞高度被限制在面板的 40% 以內,超出範圍時會自動產生捲軸方便上下滾動。當你複製含有 LaTeX 數學式的清單項目或表格儲存格時,貼進富文字編輯器中不會再被錯誤切碎成全新的清單或表格。遇到擴充套件重啟後殘留的 Claude 背景行程時,「仍在其他地方開啟」的提示視窗現在也能清楚識別,並說明該行程通常在約 10 分鐘內便會自行退出。以前長文字一展開就遮蔽對話歷史、貼上公式格式又容易碎裂,現在排版邊界更穩定,編輯與查閱操作不再互相打架。
官方原文
[VSCode] Fixed a long prompt expanded with Show more covering the whole chat panel: a pinned prompt is now capped at 40% of the panel and scrolls
[VSCode] Fixed part of a list item or table cell with LaTeX math pasting as a new list or table in rich text editors
[VSCode] Changed the "still open somewhere else" notice to also cover a Claude process left over from an extension restart, which usually ends on its own within about 10 minutes