Skip to main content

Claude Code v2.1.312: safety_event Stops, New Hook Limits

Claude Code v2.1.312 stops sending claude_code.safety_event, caps concurrent prompt and agent hooks, and changes two defaults for unrecognized model names.

Claude Code v2.1.312 has 39 changelog entries: 22 fixes, 9 changes, 4 additions, and 4 improvements. The entries most likely to need action are changes: Claude Code stops sending the claude_code.safety_event OpenTelemetry event, limits how many prompt and agent hooks run at once, and changes two defaults for model names it doesn’t recognize. If you export OpenTelemetry, use prompt or agent hooks, or run Claude Code on Bedrock, Vertex, Foundry or Mantle under a custom deployment name or an inference profile ARN, read the first section before updating.

v2.1.312 shipped a day after v2.1.311. The next version with changelog notes is v2.1.314.

Changed Behavior Worth Noting

claude_code.safety_event Is No Longer Sent

Claude Code stops sending the claude_code.safety_event OpenTelemetry event. v2.1.307 added that event for each tool call that a permission rule, auto mode, a safety check, a hook or the sandbox stopped, prompted on, or sent back. The changelog gives no reason and names no replacement. If a dashboard, alert or export pipeline depends on the event, it stops arriving once you update.

A second telemetry change: OpenTelemetry mcp_server.name now reports the real name of fixed-URL remote MCP servers declared by plugins from the official Anthropic marketplace, instead of custom.

Prompt and Agent Hooks Run at Most 24 at a Time

Prompt and agent hooks now run at most 24 at a time per session, subagents included, plus at most 12 that have waited longer than their event’s timeout. A timeout under 1 second now counts as 1 second. If your configuration fires many prompt or agent hooks together, or sets sub-second timeouts, check it against these limits.

Two Defaults Change for Unrecognized Model Names

Both changes apply to model names Claude Code doesn’t recognize, such as custom deployment names, and each comes with an environment variable to opt out:

  • Shorter system prompt. On Bedrock, Vertex, Foundry and Mantle, such names, inference profile ARNs included, now get the shorter system prompt, even when the model behind them is Sonnet or Haiku. Set CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT=0 to keep the full prompt.
  • Automatic model switches. The automatic model switches after a flagged message now also cover these names. Set CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK=1 to turn them off.

”5-Hour Limit” Replaces “Session Limit”

Usage limit messages now call the 5-hour window the “5-hour limit” instead of the “session limit”. In VS Code, usage limit resets also show a clock time, such as “Resets at 3:10 PM”, and say “5-hour limit”. If a script or alert matches the old “session limit” wording, update it.

Subagent autoCompactWindow Can Lower the Window

A subagent’s autoCompactWindow now lowers the window set by CLAUDE_CODE_AUTO_COMPACT_WINDOW, where before it had no effect. It still never raises that window.

Cloud Session Names Come from the Server

Cloud sessions started from the CLI now get their names and branch names from the server.

What’s New

  • oidc.user_id_claim for the Claude apps gateway. The gateway can now identify people by an id_token claim other than sub, such as Microsoft Entra ID’s oid.
  • Click to send. In fullscreen, clicking the “to send now” hint under a queued message sends it right away, as its key does.
  • Effort for cloud routines. The model picker now offers an effort level when you create or edit a routine that runs in the cloud.
  • A Bash editor for cloud setup scripts. The setup script box in cloud environment settings is now a Bash editor with colors, line numbers and a Copy button.

Effort Changes Made Mid-Task

Three entries cover picking a new effort level while Claude is working:

  • The spinner, OpenTelemetry effort values and transcripts named the newly picked level before the model applied it. They now show the level in force.
  • The prompt’s effort indicator now says a change made mid-task may wait for your next message, and the note clears when it no longer applies.
  • The /model and /effort cache warning no longer says the re-read waits for your next message, since a change made while Claude is working can trigger it sooner.

Files, Skills and Sessions

  • Large instruction files. Claude could overwrite a very large CLAUDE.md, rules file or @-included file in a subdirectory after seeing only its start. Write now asks Claude to read it all or edit in place.
  • Skills after cd. Per-directory and paths: skills were not found after a Bash cd deeper into a git repository.
  • PDF pages. The Read tool sometimes failed on PDF pages with “pdftoppm failed: Could not write image” when the clean-up of old session files ran at the same time.
  • Resumed sessions. In a rare case, the first reply after resuming a session in the terminal could be missing the next time the session was resumed.
  • Command loading. A command with an invalid name stopped all commands from loading, which could leave claude -p with no output.
  • Waiting status. Some sessions showed as waiting on you when the last message only mentioned items waiting on you mid-sentence.

Terminal and VS Code

  • Agent view restored input text on the next launch after it was cleared with Ctrl+C just before exiting, and reopened in shell mode after exiting with Ctrl+D from an empty ! input.
  • In vim mode, d, c and y with a gj or gk count larger than the lines left deleted or copied text. Like Vim, they now only move the cursor.
  • /verify showed a long description meant for Claude in /help and the / command menu instead of a short one.
  • After signing in from the VS Code extension, managed settings and organization policy were not fetched for the rest of the session.
  • In VS Code, sessions ended on a bare exit code when your organization’s settings couldn’t be loaded or were refused at startup. The tab now says why and offers Retry or Sign in again.

Cloud Sessions and Remote Control

  • WebFetch errors in cloud sessions now explain a host that does not resolve as possibly outside the allowed network domains, so Claude names the host to allow.
  • Opening the step shown when Claude adds a repository to a cloud session now shows a short table of what happened instead of raw JSON.
  • Resending an unchanged message after a failed send in a cloud session sometimes ran it twice.
  • A failed cloud environment creation showed its error only as a toast outside the open dialog. The error now appears inside the dialog.
  • Edit in a routine’s menu on the Routines page went to the routine’s page without opening its edit dialog.
  • An unarchived Remote Control session showed as working until a computer reconnected. It now shows as idle.

Claude Tag and Code Review

  • Claude Tag’s retry notice in Slack now names the model in use, or says rate limits were hit, instead of a generic API error.
  • A Claude Tag channel’s on/off switch and agent settings fell back to workspace defaults when an older private Slack channel went public and got a new ID.
  • Claude in Slack did not reply in channels whose environment has network access set to None, and sometimes posted a file in the wrong thread when it was answering in another thread of the same channel.
  • Code Review reviewed an outdated commit, or none at all, when GitHub delivered a push event late. It now reviews the pull request’s current commit.

How to Update

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