Claude Code v2.1.317 Adds Cost Analytics API, OTel User Attributes, and Block-on-Failure Hooks
Claude Code v2.1.317 is a maintenance release with a handful of additions aimed at teams running the app through a gateway, monitoring via OpenTelemetry, or building on the Agent SDK.
Gateway cost reporting
The Claude apps gateway admin API now exposes GET /v1/organizations/analytics/cost. It returns past spend over a date range, broken down in total, per developer, per day, or per IdP group. To support the IdP grouping, gateways with admin: set now keep a daily record of each developer's IdP groups, retained for admin.identity_retention_days.
OpenTelemetry attributes
Four new attributes are attached to OTel metrics, events, and spans:
anthropic.plananthropic.seat_typeanthropic.provideranthropic.custom_base_url
If you already scrape Claude Code telemetry into a dashboard, these let you split traces by subscription tier or by which provider/base URL the request went through.
Agent SDK hook behavior
Hook callbacks now accept onFailure: "block". Previously a failing callback let the action proceed; with this set, the failure blocks the action instead.
Privacy and scheduling guards
Two new prompts reduce surprise data exposure:
- A check asks before a web or shell tool call sends your account email address over the network.
/schedulewarns when a new cloud scheduled task picks up connectors you didn't request, and tells you how to remove them.
Also new: notices in Claude Desktop's Code tab when your organization's remote managed settings haven't loaded yet, and when they have. Auto mode now surfaces a notice when its check has no answer for a subagent's tool call, instead of leaving the main view empty.
Self-hosted runner escape hatch
Set CLAUDE_CODE_DISABLE_NESTED_SESSION_ID=1 on a self-hosted runner to make claude -p inside a session use that session's ID and transcript, restoring the pre-change behavior.
Notable fixes
- Project and local MCP servers disconnecting after the first turn in some desktop sessions.
- Auto mode failing every turn when an LLM gateway base URL returns 403/422 to the server-side safety check (403 with
apiKeyHelperis unchanged). claude auth statusexiting before a slow token refresh saved, which could sign you out on the next run.claude --from-prreporting "No conversations found" for older linked sessions in projects with many sessions.claude -pexiting 0 when a full disk or quota lost its transcript or~/.claude.jsonwrites; it now prints an error and exits 1 in text and json output. Full NFS exports may be missed.- Edits to settings files made in the first second or so after launch not taking effect until another settings change.
- Old transcripts not cleaned up when runs skip cleanup, e.g. with
--setting-sources. - Claude apps gateway hiding Bedrock's "Input is too long." error, which left sessions failing every turn with "upstream rejected the request" instead of compacting.
There are another dozen fixes for agent teams, /team-onboarding, /loop wakeups, cloud session titles, skills synced from claude.ai, and screen reader verbosity—the full list is in the release notes.
📖 Read the full source: GitHub Claude-Code
👀 See Also

Claude Code v2.1.139 Adds Agent View, /goal Command, and Major MCP Improvements
Claude Code v2.1.139 introduces a new agent view for session management, a /goal command for multi-turn tasks, expanded hook capabilities, and fixes for MCP server memory issues and terminal corruption.

Claude MAX Plan Now Includes 1M Token Context Window at No Extra Cost
The Claude MAX plan has been automatically upgraded to include a 1 million token context window without additional API-based usage charges, with users reporting significantly reduced token usage and elimination of context window management overhead.
Claude Code v2.1.210 Fixes Worktree Isolation, Ultracode Opt-In, and Dozens of Bugs
Highlights include subagent worktree isolation fix, ultracode keyword opt-in fix, new elapsed-time counter, and permission rule deprecations.

Stripe's Minions: Enhancing Developer Productivity with One-Shot End-to-End Coding Agents
Stripe Minions are one-shot, end-to-end coding agents designed to boost developer productivity by automating complex tasks within the Stripe ecosystem.