Claude Code: hooks can now block an action when they fail

3 days ago

What changed in Claude Code 2.1.294 and 2.1.295: command and HTTP hooks can block an action when they fail, hooks written as instructions block what they name, terminals that support the Program Status Protocol show when Claude Code is waiting on you, 1M-context models stop failing behind gateways that refuse the beta, three terminal freezes are fixed, remote MCP servers reconnect in headless runs, and claude -p prints every turn. https://github.com/anthropics/claude-code/releases/tag/v2.1.294 https://github.com/anthropics/claude-code/releases/tag/v2.1.295 https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md

Ask

Ask about this presentation

Answers are generated from this presentation.

Chapters

  1. 0:00Hooks that fail closed
  2. 0:13Hooks written as instructions
  3. 0:25Status in your terminal
  4. 0:341M-context models behind a gateway
  5. 0:47Terminal freezes
  6. 1:00Remote MCP reconnects
  7. 1:15Print mode output
  8. 1:28The full changelog
Show transcript

Hooks that fail closed

Claude Code

Hooks can now block an action when they fail

onFailure: "block" for command and HTTP hooks

Can't start
the action is blocked
Times out
the action is blocked
Unexpected exit code
the action is blocked
Claude Code 2.1.295 release notes · anthropics/claude-code

Command and HTTP hooks can now fail closed. Set on failure to block, and a hook that can't start, times out, or exits with an unexpected code stops the action instead of letting it through.

Hooks written as instructions

Claude Code

>Hooks written as instructions now block what they name

Prompt and agent hooks
“Block commands that…” no longer lets those commands through
Stop and SubagentStop
“Carry on if the build is broken” is judged better, so Claude stops early less often
Claude Code 2.1.294 release notes · anthropics/claude-code

Prompt and agent hooks written as instructions, such as block commands that do something, could allow what they should block. That's fixed, and Stop hooks written that way make Claude less likely to stop early.

Status in your terminal

Claude Code

>Your terminal can show when Claude Code is waiting on you

Protocol
Program Status Protocol (OSC 7501)
States
working, waiting on you, or done
Claude Code 2.1.295 release notes · anthropics/claude-code

Claude Code now supports the Program Status Protocol. Terminals that implement it can show whether Claude Code is working, waiting on you, or done.

1M-context models behind a gateway

Claude Code

>1M-context models stop failing every request behind a gateway

Where
a gateway, Bedrock, Vertex or Foundry that refuses the context-1m beta
Before
every request on a [1m] model failed
Now
Claude Code resends the request without the beta
Claude Code 2.1.295 release notes · anthropics/claude-code

If a gateway, Bedrock, Vertex or Foundry refuses the one-million-token context beta, every request on a one-million-token model used to fail. Claude Code now resends the request without it.

Terminal freezes

Claude Code

>Long replies no longer freeze the terminal

Tens of thousands of lines
froze the terminal and ignored Ctrl+C
Quotes nesting deeper and deeper
froze it for seconds on gigabytes of memory
Highlighting very long lines
stalled it for seconds or minutes
Claude Code 2.1.295 release notes · anthropics/claude-code

Three terminal freezes are fixed. A reply tens of thousands of lines long no longer locks up the screen, deeply nested quotes no longer eat gigabytes of memory, and very long lines highlight without stalling.

Remote MCP reconnects

Claude Code

>Remote MCP servers reconnect after an outage in headless runs

Headless and SDK sessions
reconnect after an outage longer than 15 seconds
A server that drops each connection
retries back off, up to 30 seconds
Claude Code 2.1.295 release notes · anthropics/claude-code

In headless and SDK sessions, remote MCP servers now reconnect after an outage longer than 15 seconds. A server that drops every connection gets retries that back off up to 30 seconds, instead of a tight loop.

Print mode output

Claude Code

>claude -p prints every turn's response

Background work
a new turn no longer drops earlier responses
Run stays open
a line on stderr says what it is waiting for
Claude Code 2.1.295 release notes · anthropics/claude-code

In print mode, text output no longer drops earlier responses when background work starts another turn. And when a run stays open after its last turn, a line on standard error says what it's waiting for.

The full changelog

Claude Code

Every change is in the Claude Code changelog

https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md

CHANGELOG.md in anthropics/claude-code
Claude Code 2.1.295 release notes · anthropics/claude-code

The full list, including fixes for the VS Code extension, Claude in Slack and Code Review, is in the Claude Code changelog on GitHub.

Up next

1:46

Claude Code v2.1.296: Claude can read a large file in one call

@claude-code · 2 days ago

1:39

Claude Code v2.1.293: Claude Haiku 5.5 becomes the default Haiku model, and finished work stays finished after a compaction

@claude-code · 4 days ago

1:32

Claude Code: subagents run at the effort you ask for, plugins install from a marketplace in one command, and network-path reads ask first

@claude-code · 5 days ago

1:23

Claude Code v2.1.290: WebSearch refills by the hour, WebFetch says what it left unread, and scheduled tasks stop going missing

@claude-code · 6 days ago

1:25

Claude Code v2.1.289: Bash deny rules hold under sandbox auto-allow, and a failing plugin no longer ends your session

@claude-code · 1 week ago

1:40

Claude Code v2.1.288: Up restores a prompt cleared with Ctrl+C, and mid-response timeouts no longer fail the turn

@claude-code · 1 week ago

1:46

Claude Code v2.1.287: Claude Mods let plugins change deeper behavior, and 1M context is the default on Bedrock and Vertex

@claude-code · 1 week ago

3:04

Claude Code v2.1.286: resumed sessions keep every turn, refused models fall back, and secrets stay masked

@claude-code · 1 week ago

3:06

Claude Code v2.1.285: claude --desktop, a provider allowlist, and time limits on background commands

@claude-code · 1 week ago

3:08

Claude Code v2.1.284: Sonnet 5.5 by default, auto mode on every plan, and an Ultracode toggle

@claude-code · 1 week ago

2:49

Claude Code v2.1.283: prompt audit, exact model pinning, MCP and plugin fixes

@claude-code · 1 week ago

3:03

Claude Code v2.1.261

@claude-code · 1 month ago