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
- In every Agent SDK hook callback registration, set onFailure: "block" so a callback that fails blocks the action instead of letting it run.
- On self-hosted runners that still need
claude -pinside a session to reuse that session's ID and transcript, set CLAUDE_CODE_DISABLE_NESTED_SESSION_ID=1; otherwise leave it unset so nestedclaude -pno longer writes into the parent transcript or sends a title to that session. - Update CI to treat
claude -pexit 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. - After
/schedulecreates a cloud scheduled task, read the extra-connectors warning and remove any connectors the task received that you did not ask for. - 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 costPaste 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
- In every Agent SDK hook callback registration, set onFailure: "block" so a callback that fails blocks the action instead of letting it run.
- On self-hosted runners that still need
claude -pinside a session to reuse that session's ID and transcript, set CLAUDE_CODE_DISABLE_NESTED_SESSION_ID=1; otherwise leave it unset so nestedclaude -pno longer writes into the parent transcript or sends a title to that session. - Update CI to treat
claude -pexit 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. - After
/schedulecreates a cloud scheduled task, read the extra-connectors warning and remove any connectors the task received that you did not ask for. - 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
- Restate the change in one sentence.
- Propose a minimal plan for my repo (or a throwaway pilot).
- Implement only what I approve; prefer small diffs and tests.
- Call out risks (permissions, breaking APIs, cost).
Start by confirming you understood the proposal.
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.