Anthropic Releases Claude Code v2.1.295 with Strict Hook Controls, Gateway Filters, and MCP Fixes
What changed
Anthropic has released Claude Code v2.1.295, bringing stricter execution controls for automated hooks, expanded enterprise gateway settings, and critical bug fixes for Model Context Protocol (MCP) integrations.
Key additions and fixes in this release include:
- Hook Failure Safeguards: Command and HTTP hooks now support
onFailure: "block". If a configured hook fails to start, times out, or exits with an unexpected code, Claude Code explicitly halts the downstream action instead of letting it execute. - Gateway Upstream Model Routing and Timeouts: Enterprise gateway upstream configurations now support an optional
modelsarray with wildcard (*) matching to restrict which models route to specific backends. Upstreams on Amazon Bedrock, Google Vertex AI, Palantir Foundry, and others can settimeouts.upstream_ttfb_msto bound initial stream response times before triggering failover or returning a 502 status. Unmanaged environments can enforce custom gateway logins viaforceLoginMethod: "gateway"andforceLoginGatewayUrlin user settings. - Audit Traceability: Gateway
inferenceaudit events now outputupstream_request_id(sourced from Bedrock, Anthropic, or other upstreams), and successful gateway responses append a matchingrequest-idheader to align local telemetry with backend logs. - Terminal and UI Enhancements: Added support for the Program Status Protocol (OSC 7501) to signal terminal emulators whether Claude Code is active, waiting, or finished. Mods gain
$.ui.notifyfor native system notifications and expandedButtonsupport accepting nested strings andTextchildren. - Retry Watchdog Limits: Introduced
CLAUDE_CODE_RETRY_WATCHDOG_MAX_WAIT_MSto cap how long unattended watchdog retries wait during persistent 429 and 529 provider rate-limit errors. - Automatic 1M Context Fallback: If a proxy, Bedrock, Vertex, or Foundry upstream rejects the
[1m]extended context beta, Claude Code automatically resends the prompt without the beta header rather than throwing an error. - MCP and Agent Process Fixes: Remote MCP connections in headless and SDK modes now use exponential backoff (up to 30 seconds) on repeated drops instead of thrashing reconnect loops. Fixed file extension classification so MCP tools returning CSS, JS, XML, fonts, or icons are no longer stored as
.binfiles. Addressed a timing bug inCLAUDE_AUTO_BACKGROUND_TASKSwhere subagents were moved to the background before queued edit or shell calls completed.
Why it matters
Configuring automated agent actions requires deterministic safeguards. Prior to this update, a failed pre-execution validation hook could silently let commands run. Supporting onFailure: "block" closes this gap, continuing the trend of enterprise controls seen in earlier plugin mods and protocol updates.
For teams deploying Claude Code through private API gateways or multi-cloud infrastructure, fine-grained model routing arrays and explicit time-to-first-byte limits prevent hanging requests and model mismatches across Bedrock and Vertex backends. Syncing upstream_request_id across response headers and telemetry event streams also simplifies tracing failure modes in production.
Finally, the MCP stability fixes resolve connection churn during temporary network outages, building on previous session stability and telemetry improvements.
What to do next
- Update the CLI: Install or update to
v2.1.295through your preferred package manager. - Enforce Hook Fail-Closed Rules: Update command and HTTP hook definitions in your project configuration to include
onFailure: "block"for security-critical steps. - Configure Gateway Upstreams: If running a custom proxy gateway, update your upstream definitions with specific
modelslists and definetimeouts.upstream_ttfb_msto manage backend failover behavior. - Set Unattended Watchdog Limits: Define
CLAUDE_CODE_RETRY_WATCHDOG_MAX_WAIT_MSin headless CI/CD environments to prevent automated agent runs from blocking indefinitely during extended upstream outages.
Limitations and Caveats
When Claude Code falls back after an upstream rejects the [1m] beta header, the request proceeds using standard context boundaries, which may truncate extremely long prompt contexts. Additionally, while claude plugin validate now prints missing installation lines for plugin READMEs, it explicitly maintains a zero exit code—even when executed with --strict—meaning it will not break CI validation pipelines automatically.
Sources
Share Article
If this article helped you, please share it with others!