[KongchangAI]
· 2 min read· 1,418 words

Claude Code v2.1.312 Update: OIDC User Identification and Multiple Fixes

Claude Code v2.1.312 Update: OIDC User Identification and Multiple Fixes

Claude Code v2.1.312 adds OIDC user identity, click-to-send, and multiple stability fixes.

Claude Code released v2.1.312, continuing its high-frequency iteration pace with a focus on feature additions and bug fixes. New capabilities include `oidc.user_id_claim` support in the Claude apps gateway for identifying users via id_token claims (such as Microsoft Entra ID's `oid`), and a "to send now" click-to-send entry for queued messages in fullscreen mode. The most important fix addresses Claude potentially overwriting entire oversized CLAUDE.md, rules, or @-referenced files when only reading their beginning; it now requires a full read or in-place edit. Other fixes cover managed settings not fetched after VS Code login, directory config and skills failing in deep git directories, command loading failures causing `claude -p` to produce no output, and concurrent PDF read errors. Behavior changes include defaulting to short system prompts for unknown model names, hook concurrency limits, and renaming usage prompts to 5-hour limit.

Version Overview

Claude Code has released version v2.1.312. This release continues the project's high-frequency iteration pace, with updates focused on feature additions and bug fixes across modules including authentication, interaction experience, model adaptation, and cloud sessions. For users who rely on Claude Code for daily development, several seemingly minor changes will actually affect real-world usage, so it's worth reviewing each one.

Claude Code v2.1.312 release notes

New Capabilities: OIDC User Identity and Click-to-Send

This update adds a new oidc.user_id_claim configuration option to the Claude apps gateway. This means enterprises can identify users via claims in the id_token rather than being limited to the default sub field. The release notes specifically cite Microsoft Entra ID's oid as an example—for organizations using Microsoft's identity system, this change aligns user identification with their existing identity infrastructure and reduces extra work in the adaptation layer.

Another small improvement for daily operations is "click to send": in fullscreen mode, queued messages now display a "to send now" prompt below them. Clicking it sends the message immediately, with the same effect as pressing the corresponding keyboard shortcut. For users who prefer mouse operations or need to temporarily jump the queue, this reduces the burden of memorizing shortcuts.

OIDC and id_token Claims

OIDC (OpenID Connect) is an authentication protocol built on top of OAuth 2.0. Its core output is the id_token—a token signed by the identity provider that carries user identity information in JWT format. The id_token consists of several "claim" fields, for example sub represents the unique subject identifier for that user at the provider, while email, name, and others carry additional attributes. Different identity providers do not identify the same user in a uniform way: Microsoft Entra ID, in addition to sub, also provides oid (object ID), which remains stable within the same tenant and is often used as a cross-application user primary key. The new oidc.user_id_claim in the Claude apps gateway essentially allows administrators to specify which claim field to use as the user identifier, aligning with the enterprise's existing account mapping, auditing, and quota systems and avoiding the need to maintain an additional ID mapping table on the gateway side.

Fix Roundup: From CLAUDE.md Overwriting to PDF Reading

One fix in this release deserves separate discussion: previously, when Claude only saw the beginning of an oversized CLAUDE.md, rules file, or a file @-referenced from a subdirectory, it could directly overwrite the entire file. Now the Write tool requires Claude to read the file completely or switch to in-place editing. This type of issue is highly destructive to project configuration files, and the fix significantly reduces the risk of accidental overwrites.

Other fixes cover multiple usage paths:

  • After logging in from the VS Code extension, managed settings and organization policies were not being fetched for the remainder of the session;
  • After cd-ing into a deeper directory within a git repository in Bash, directory-specific configuration and skills defined with paths: could not be found;
  • A rare case where the first reply after resuming a terminal session could be lost on the next resume;
  • Commands with invalid names caused all commands to fail loading, which in turn caused claude -p to produce no output;
  • A pdftoppm failed error triggered by concurrent old session file cleanup and PDF reading.

Additionally, a fix was made for the issue where switching effort levels mid-task caused the spinner, OpenTelemetry, and transcript to show the new level prematurely—they now only display the level actually in effect.

CLAUDE.md and @-Referenced Files

CLAUDE.md is a project-level instruction file read by Claude Code, used to store long-term context such as coding standards, build commands, and directory conventions; placing CLAUDE.md in subdirectories creates layered configuration, and the @path syntax allows instruction files to reference the contents of other files, enabling modular splitting of context. Because these files are often substantial, the model may only read the beginning when context is limited. The Write tool previously allowed wholesale rewriting based on incomplete content, which would silently erase the unread portions. Changing to "require full read or in-place edit" effectively raises the threshold for destructive write operations to match the read scope—a tightening of the safety boundaries around tool calls.

Behavior Changes: Prompts, Hooks, and Model Recognition

Bedrock, Vertex, Foundry, and Mantle now use a shorter system prompt for model names that Claude Code cannot recognize, including custom deployment names and inference profile ARNs. Even if these names actually point to Sonnet or Haiku, the short prompt is applied. To retain the full prompt, set CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT=0.

Automatic model switching triggered after a message is flagged now also covers unrecognized model names. To disable this behavior, set CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK=1.

Regarding hook execution, prompt and agent hooks now run at most 24 concurrently per session (including subagents), with up to 12 additional hooks allowed to wait beyond the event timeout threshold; timeout values under 1 second are now treated as 1 second. These limits prevent runaway hook concurrency and have practical significance for the stability of complex automation workflows.

The wording of usage prompts has also been adjusted: the former "session limit" is now called "5-hour limit," and the VS Code side now displays the specific reset time, such as "Resets at 3:10 PM," which is more intuitive than relative time.

Bedrock, Vertex, Foundry, and Mantle

These names correspond to different hosting and access channels for Claude models: Amazon Bedrock and Google Cloud Vertex AI are model hosting services provided by cloud vendors, through which Anthropic also distributes Claude; Foundry refers to Microsoft Azure AI Foundry, and Mantle is a related deployment and inference configuration system. On these platforms, users can invoke models using custom deployment names or inference profile ARNs, so the model identifier in requests is often a platform-generated string rather than a canonical name like claude-sonnet-4. Claude Code cannot determine whether the underlying model is actually Sonnet or Haiku and can only treat it as an "unknown model." Defaulting to a shorter system prompt is a conservative strategy when model capabilities cannot be confirmed, at the cost of potentially losing some instruction detail, which is why the manual opt-out switch CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT=0 is retained.

Hooks Mechanism

Hooks are an event callback mechanism provided by Claude Code that allow users to automatically execute external commands or scripts at specific points in the session lifecycle (such as before/after tool calls or when prompts are submitted), commonly used for formatting code, running checks, logging, or injecting additional context. Hooks are categorized into command hooks, prompt hooks, and agent hooks, among others; the latter two consume additional model calls. For this reason, the concurrency of hooks directly affects resource usage and event queue behavior: once a hook runs slowly or times out, subsequent events may be blocked. The newly set limits—"at most 24 concurrent per session (including subagents)" and "an additional 12 timeout-wait quota"—form a two-tier rate limit, and raising timeouts under 1 second uniformly to 1 second prevents overly aggressive timeout configurations from causing hooks to be interrupted frequently.

Cloud Session and Integration Fixes

On the cloud session side, when creating or editing routines that run in the cloud, the model selector now includes effort level options; the setup script box in cloud environment settings has been upgraded to a Bash editor with colors, line numbers, and a copy button; when Claude adds a repository to a cloud session, it now displays a concise results table instead of raw JSON. Fixes were also made for issues where resending an unmodified message after a send failure could execute twice, and where cloud environment creation failure errors only appeared as a toast outside the dialog.

On the Slack integration (Claude Tag) side, retry prompts now explain which model was used or indicate that a rate limit was triggered; fixes were made for issues where toggles and agent settings reverted to workspace defaults after a private channel was converted to public and received a new ID, where Claude did not reply in channels with network access set to None, and where files were sent to the wrong thread when replying across threads.

Code Review fixed cases where delayed GitHub push events caused reviews of outdated commits or no review at all; it now reviews the current commit of the PR.

Summary

v2.1.312 does not introduce groundbreaking features, but OIDC user identification and enterprise-grade session stability fixes are clearly valuable for team users. For developers who rely on project configuration such as CLAUDE.md, the fix for file overwriting also reduces daily risk.

#Claude Code#v2.1.312#OIDC#CLAUDE.md#hooks#cloud sessions
Share:

Related articles