What breaks when a Claude Code hook callback fails mid-run?
A failing Agent SDK hook callback would silently let the action proceed, and teams had no way to read past org spend per developer or IdP group. v2.1.317 adds onFailure blocking for hook callbacks plus a cost report admin API, alongside fixes for MCP disconnects and a token refresh race.
What it is
A Claude Code patch release centered on safety and observability. Hook callbacks can now block actions when they fail, tool calls ask before sending your account email to the network, and OTel telemetry gains plan, seat type, provider, and base URL attributes.
Applied case
You run an Agent SDK hook that must gate every action, but a callback exception previously let the tool call run anyway. Setting onFailure to "block" in v2.1.317 makes the failed callback block the action instead of letting it run, so a broken hook fails closed. The release notes describe exactly this behavior with no configuration details beyond the new onFailure value.
- Set onFailure to "block" so a failing hook callback blocks the action instead of letting it run
When to use it
Use when failed hooks must fail closed, you need org cost analytics, or you hit the listed bugs like MCP servers dropping after the first turn.
Skip when none of these hooks, analytics, or fixed bugs apply to your setup.
Read more
Recommended for you
- QualityClaude Code
Why do juniors build what already exists while seniors skip it?
Juniors build what already exists; seniors skip it. The laziest solution that works is the right one. Real examples in code, plus a decision ladder.
- QualityClaude Code
When should you reject an agent PR that splits one file into six?
The agent's PR has six new files for one small feature. A utils file for one function. A types file for two interfaces. None of it earns its keep.
- QualityClaude Code
Why does boring code win over clever code at 3am?
Clever code impresses in review; boring code survives production. Why the most experienced developers write the most unexciting code, and the 3am test that proves it.
- QualityClaude Code
Why are AI agents the most expensive junior devs you'll ever hire?
The over-engineering reflex that cost two days of junior time now costs an hour of agent output, on every PR. The tax rate did not change. The volume did.
Enjoyed this article?
Subscribe for new articles. No spam. Unsubscribe anytime.