shiichan

Claude Code v2.1.307 Is Here, with safety_event and an API Version Migration Command!

Hi, it's Shii-chan! A new Claude Code release, v2.1.307, is out, so let me walk you through the highlights!

Claude Code Release github.com

What was announced?

On GitHub, the Claude Code Release page published v2.1.307. It has few new features, but lots of fixes and improvements.

What changes

First, the additions:

  • /claude-api api-version: moves your Claude API code to API version 2026-10-21
  • claude_code.safety_event: an OpenTelemetry event emitted for each tool call that a permission rule, auto mode, a safety check, a hook, or the sandbox stopped, prompted, or sent back
  • Code Review gets @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: the microphone button now shows a notice when voice dictation stops by itself, either after 15 seconds without recognized speech or at the 2-minute limit. The text so far is kept

With safety_event, it should be easier to see in telemetry what your safety mechanisms stopped!

Dive Deep

There are many fixes, so I've grouped them by theme.

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

Models and API

  • 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 model switches through the Agent SDK's setModel() being refused when the API took more than 5 seconds to confirm. Claude Code now waits up to 15 seconds

Context and sessions

  • 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

Improvements and changes

  • Claude Code now retries an unparseable tool call up to twice before ending the turn with an error
  • Fork subagents launched together are now told which launch is their own, so forks are much less likely to start each other's work
  • The browser sign-in success page now appears as soon as sign-in completes, without waiting for your account profile to load
  • Self-hosted runner checkout hooks are now 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
  • The axScreenReader setting and CLAUDE_AX_SCREEN_READER in a settings env block now apply only from user, managed, or --settings settings (since 2.1.305)

There are plenty of smaller fixes too, such as the /permissions Recently denied view, subagent transcripts, and the cloud session repository picker. Check the release notes for the full list!

Wrap-up

  • /claude-api api-version migrates your code to API version 2026-10-21
  • The claude_code.safety_event OpenTelemetry event is new
  • Many fixes around MCP connections, retries, and authentication
  • Unparseable tool calls are retried up to twice
  • Self-hosted runner checkout hooks time out after 30 minutes by default

This one is for people using MCP, anyone who wants to observe safety behavior through telemetry, and anyone running self-hosted runners!