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

1 month 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.

Ask about 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
  1. 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.

    Slide text
    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
  2. 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.

    Slide text
    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
  3. Claude Code now supports the Program Status Protocol. Terminals that implement it can show whether Claude Code is working, waiting on you, or done.

    Slide text
    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
  4. 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.

    Slide text
    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
  5. 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.

    Slide text
    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
  6. 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.

    Slide text
    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
  7. 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.

    Slide text
    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
  8. The full list, including fixes for the VS Code extension, Claude in Slack and Code Review, is in the Claude Code changelog on GitHub.

    Slide text
    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

What happened in AI today, in your inbox

One short email each evening. Read it and you’re caught up.

Built with ❤️ in New York