Skip to content
Proposals/Add onFailure: "block" to Agent SDK hook callbac
proposalteamP5Worth a lookClaude Code

Add onFailure: "block" to Agent SDK hook callbacks

v2.1.317 fail-closes Agent SDK hooks via onFailure: "block", warns when /schedule adds extra connectors, confirms before sending your account email on web/shell calls, isolates nested claude -p unless CLAUDE_CODE_DISABLE_NESTED_SESSION_ID=1, and makes claude -p exit 1 on full disk or quota.

Why this loop

Claude Code v2.1.317 changes fail-open hook behavior and nested-session identity. Agent SDK hook callbacks can set onFailure: "block" so a failed callback stops the action instead of letting it run; switch to fail-closed if hooks were treated as advisory. Nested claude -p inside a cloud or self-hosted runner session no longer shares that session's ID and transcript and no longer sends its own title onto it; set CLAUDE_CODE_DISABLE_NESTED_SESSION_ID=1 only if you need the old reuse. claude -p now prints an error and, in text and json output, exits 1 when a full disk or quota drops transcript or ~/.claude.json writes, so CI that treated 0 as success will miss data loss. /schedule warns when a new cloud scheduled task gets connectors you did not ask for and how to remove them. Web and shell tool calls that would send your account email to the network now ask first; treat that prompt as a gate.

Proposed actions

  1. In every Agent SDK hook callback registration, set onFailure: "block" so a callback that fails blocks the action instead of letting it run.
  2. On self-hosted runners that still need claude -p inside a session to reuse that session's ID and transcript, set CLAUDE_CODE_DISABLE_NESTED_SESSION_ID=1; otherwise leave it unset so nested claude -p no longer writes into the parent transcript or sends a title to that session.
  3. Update CI to treat claude -p exit 1 as failure when a full disk or quota loses the transcript or ~/.claude.json writes (text and json output); v2.1.317 no longer exits 0 in that case.
  4. After /schedule creates a cloud scheduled task, read the extra-connectors warning and remove any connectors the task received that you did not ask for.
  5. When Claude Code asks before a web or shell tool call that would send your account email address to the network, refuse unless that destination is intended; do not auto-approve those calls.

Agent prompt

Paste into your agent or query via MCP (get_agent_prompt) — free, no extra AI cost

Paste into Claude Code / CLAUDE.md task

DevAgentRadar → Claude Code

You are helping me adopt a real coding-assistant change. Work only from the facts below. Do not invent features.

Context

Assistant: Claude Code Proposal: Add onFailure: "block" to Agent SDK hook callbacks Summary: v2.1.317 fail-closes Agent SDK hooks via onFailure: "block", warns when /schedule adds extra connectors, confirms before sending your account email on web/shell calls, isolates nested claude -p unless CLAUDE_CODE_DISABLE_NESTED_SESSION_ID=1, and makes claude -p exit 1 on full disk or quota. Primary source: https://github.com/anthropics/claude-code/releases/tag/v2.1.317

Why it matters

Claude Code v2.1.317 changes fail-open hook behavior and nested-session identity. Agent SDK hook callbacks can set onFailure: "block" so a failed callback stops the action instead of letting it run; switch to fail-closed if hooks were treated as advisory. Nested claude -p inside a cloud or self-hosted runner session no longer shares that session's ID and transcript and no longer sends its own title onto it; set CLAUDE_CODE_DISABLE_NESTED_SESSION_ID=1 only if you need the old reuse. claude -p now prints an error and, in text and json output, exits 1 when a full disk or quota drops transcript or ~/.claude.json writes, so CI that treated 0 as success will miss data loss. /schedule warns when a new cloud scheduled task gets connectors you did not ask for and how to remove them. Web and shell tool calls that would send your account email to the network now ask first; treat that prompt as a gate.

Suggested actions

  1. In every Agent SDK hook callback registration, set onFailure: "block" so a callback that fails blocks the action instead of letting it run.
  2. On self-hosted runners that still need claude -p inside a session to reuse that session's ID and transcript, set CLAUDE_CODE_DISABLE_NESTED_SESSION_ID=1; otherwise leave it unset so nested claude -p no longer writes into the parent transcript or sends a title to that session.
  3. Update CI to treat claude -p exit 1 as failure when a full disk or quota loses the transcript or ~/.claude.json writes (text and json output); v2.1.317 no longer exits 0 in that case.
  4. After /schedule creates a cloud scheduled task, read the extra-connectors warning and remove any connectors the task received that you did not ask for.
  5. When Claude Code asks before a web or shell tool call that would send your account email address to the network, refuse unless that destination is intended; do not auto-approve those calls.

Config surfaces this release may change

  • agent context files (high confidence) — check your repo before applying
  • context and compaction settings (high confidence) — check your repo before applying
  • skills (high confidence) — check your repo before applying
  • hooks — check your repo before applying
  • MCP servers — check your repo before applying
  • background and headless runs — check your repo before applying

After you finish

Do not report this as applied to DevAgentRadar. You cannot write the visitor's loop.

Tell the human: open https://devagentradar.com/proposals/claude-code-v2-1-317-add-onfailure-block-to-agent-sdk-hook-callbacks and mark Applied, Skipped, or Failed. Proposal id: 6e8c5b0f-b33f-4a5f-b2ca-8709469fba04

Your job

  1. Restate the change in one sentence.
  2. Propose a minimal plan for my repo (or a throwaway pilot).
  3. Implement only what I approve; prefer small diffs and tests.
  4. Call out risks (permissions, breaking APIs, cost).

Start by confirming you understood the proposal.

agentmcpmodelsecurityideRelease source ↗

Your loop

This browser · no sign-in · not shared as “you”

After you run the prompt

Only you can mark this. Agents cannot write your loop.

Your decision stays on this device. A public tally appears after a few votes.

Originating release signal

Claude Codev2.1.317Nov 3, 2026

v2.1.317

Added a warning to /schedule when a new cloud scheduled task gets connectors you did not ask for, with how to remove them · Added a check that asks before a web or shell tool call sends your account email address to the network · Added onFailure: "block" for Agent SDK hook callbacks, so a callback that fails blocks the action instead of letting it run · Added a notice in Claude Desktop's Code tab when your organization's remote managed settings haven't loaded for the session, and another once they do · +95 more changes
Verified excerpt — the source's own words

What's changed

  • Added a warning to /schedule when a new cloud scheduled task gets connectors you did not ask for, with how to remove them
  • Added a check that asks before a web or shell tool call sends your account email address to the network
  • Added onFailure: "block" for Agent SDK hook callbacks, so a callback that fails blocks the action instead of letting it run
  • Added a notice in Claude Desktop's Code tab when your organization's remote managed settings haven't loaded for the session, and another once they do
  • Added a notice when auto mode's check has no answer for a subagent's tool call, which used to leave nothing in the main view
  • Added anthropic.plan, anthropic.seat_type, anthropic.provider and anthropic.custom_base_url to OTel metrics, events and spans
  • Added a cost report to the Claude apps gateway admin API, GET /v1/organizations/analytics/cost, for reading past spend over a date range in total, per developer, per day or per IdP group
  • Added a daily record of each developer's IdP groups on Claude apps gateways with admin: set, kept for admin.identity_retention_days, which the cost report groups by

Excerpt ends here — this release continues at the source ↗.

Primary source ↗