Skip to main content

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 -p while 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.
  • /autocompact in cloud sessions reverting to the default window after a restart.
  • A conversation cleared with /clear sometimes returning after a cloud or self-hosted runner session restarted.
  • CLAUDE_CODE_DISABLE_1M_CONTEXT failing with a model-not-found error when the model was an alias carrying the [1m] suffix, such as opus[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-scope beta header is no longer sent behind a custom ANTHROPIC_BASE_URL gateway or on Foundry, where it has no effect.
  • CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS was ignored in Claude apps gateway sessions.
  • Telemetry from Claude Desktop sessions behind a Claude apps gateway was rejected when OTEL_EXPORTER_OTLP_HEADERS was set.

Changed Behavior Worth Noting

  • axScreenReader and CLAUDE_AX_SCREEN_READER in a settings env block now apply only from user, managed, or --settings settings. 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-min or set it to 0 if 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-proxy no longer commit a .claude/settings.local.json left 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 (also off and pause), which ends an @claude review always subscription 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_STORE and the NODE_EXTRA_CA_CERTS file 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

  1. Check your installed version: claude --version
  2. Update in place: claude update