Claude Code v2.1.307: A Safety Telemetry Event, API Version Migration, and a Long List of MCP and Session Fixes
Claude Code v2.1.307 adds the claude_code.safety_event OpenTelemetry event for every tool call a rule, auto mode, a hook or the sandbox intervened on, adds /claude-api api-version, and fixes duplicate HTTP MCP tool calls, locked-keychain MCP authentication, autocompact thrashing on large tool results, and much else.
Claude Code v2.1.307 has 43 changelog entries: 24 fixes, 6 improvements, 5 changes, and 4 additions. They concentrate on MCP reliability, cloud and self-hosted runner sessions, and the VS Code extension. If you run Claude Code unattended or through a gateway, this is a worthwhile update.
What’s New
A safety telemetry event. The new claude_code.safety_event OpenTelemetry event fires for each tool call that a permission rule, auto mode, a safety check, a hook, or the sandbox stopped, prompted on, or sent back. If you already export OpenTelemetry from Claude Code, each of those interventions now arrives as its own event rather than only appearing in the session.
/claude-api api-version. The bundled /claude-api skill gained a subcommand that moves Claude API code to API version 2026-10-21. It joins migrate, upgrade, managed-agents-onboard, prompt-audit, cost-optimize, and the rest of that skill’s actions.
MCP Reliability
Six entries touch MCP: five fixes and one latency improvement.
- Duplicate tool calls are gone. An HTTP MCP tool call could be sent twice when the connection closed mid-call. Only read-only or idempotent tools are retried now.
- A locked macOS keychain no longer looks like a broken server. MCP servers showed “needs authentication” in
claude -pwhile the login keychain was locked. They now say why, and the next run after an unlock connects without a new sign-in. - Sleep no longer kills servers permanently. Servers connecting when the computer slept were reported as timed out and stayed failed in headless runs.
- A turn no longer starts with stale SDK tools when a background task was running.
- Write tools on a directly configured GitHub MCP server showed a form that closed without creating anything, in the desktop app’s Code tab.
- Cloud sessions reply sooner when one of the desktop app’s MCP servers cannot connect. This one is an improvement rather than a fix.
Session and Context Fixes
- Autocompact thrashing on turns that read many PDF pages, images, or other large tool results.
/autocompactin cloud sessions reverting to the default window after a restart.- A conversation cleared with
/clearsometimes returning after a cloud or self-hosted runner session restarted. CLAUDE_CODE_DISABLE_1M_CONTEXTfailing with a model-not-found error when the model was an alias carrying the[1m]suffix, such asopus[1m].- Unparseable tool calls are now retried up to twice before the turn ends with an error.
- Fork subagents launched together are each told which launch is their own, so they are much less likely to start each other’s work.
Permissions and Gateways
/permissions> Recently denied did not show the denied shell command, and auto mode’s local classifier ignored an approval made there when it rechecked a retried command. Approving a row now names the command rather than its description.- The
prompt-caching-scopebeta header is no longer sent behind a customANTHROPIC_BASE_URLgateway or on Foundry, where it has no effect. CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MSwas ignored in Claude apps gateway sessions.- Telemetry from Claude Desktop sessions behind a Claude apps gateway was rejected when
OTEL_EXPORTER_OTLP_HEADERSwas set.
Changed Behavior Worth Noting
axScreenReaderandCLAUDE_AX_SCREEN_READERin a settingsenvblock now apply only from user, managed, or--settingssettings. This has been the case since v2.1.305 and is now documented.- Self-hosted runner checkout hooks are stopped after 30 minutes by default, failing the session’s setup. Raise
--checkout-hook-timeout-minor set it to0if yours needs longer. - The WebSearch budget notice Claude receives now also tells it not to fall back to querying search engines in a browser or through computer use.
Self-Hosted Runner and Code Review
- Sessions using
--use-anthropic-git-proxyno longer commit a.claude/settings.local.jsonleft in the clone by an earlier session. - Archiving or requeueing a session, or stopping the runner, during its checkout hook no longer leaves the hook’s processes running and the runner’s slot held.
- The managed-git certificate file now filters its trusted certificates the way the CLI does, and a
[runner:warn]line reports how many were left out. - Code Review gained
@claude review stop(alsooffandpause), which ends an@claude review alwayssubscription on a pull request without starting a new review.
VS Code
- A pinned long prompt expanded with Show more is capped at 40% of the panel and scrolls, instead of covering the whole chat panel.
- Voice dictation shows a notice when it stops by itself, at 15 seconds without recognized speech or the two-minute limit, and says the text so far is kept.
- Dictation and the extension’s own requests now follow
CLAUDE_CODE_CERT_STOREand theNODE_EXTRA_CA_CERTSfile named in the environment or user settings, which fixes dictation behind a TLS-inspecting proxy. - Pasting part of a list item or table cell containing LaTeX math no longer creates a new list or table in rich text editors.
No Command Surface Change
Despite the length of this changelog, the captured CLI surface is unchanged from v2.1.306: 64 commands, 327 options, 249 configuration keys, and 391 environment-variable names. The new api-version action lives inside the existing /claude-api skill command. This site’s CLI reference reflects that.
How to Update
- Check your installed version:
claude --version - Update in place:
claude update