Skip to content

Prompt-based SubagentStop hooks send feedback but don't prevent termination #20221

@ddehart

Description

@ddehart

Summary

Prompt-based SubagentStop hooks correctly evaluate and send feedback to the subagent, but do not actually prevent the subagent from terminating. The subagent receives the feedback as a user message but never gets another turn to respond.

Expected Behavior

According to the hooks documentation:

Stop/SubagentStop Decision Control

  • "block" prevents Claude from stopping. You must populate reason for Claude to know how to proceed.

When a prompt-based SubagentStop hook returns {"ok": false, "reason": "..."}, the subagent should continue working with the provided feedback.

Actual Behavior

  1. Subagent completes its response
  2. SubagentStop hook fires correctly
  3. Haiku evaluates and returns {"ok": false, "reason": "..."}
  4. Feedback is sent to the subagent as a user message with isMeta: true
  5. Subagent session terminates anyway - no additional turn is given

Reproduction Steps

  1. Add a SubagentStop hook in .claude/settings.json:
{
  "hooks": {
    "SubagentStop": [
      {
        "hooks": [
          {
            "type": "prompt",
            "prompt": "Check if output contains 'REQUIRED'. If yes: {\"ok\": true}. If no: {\"ok\": false, \"reason\": \"Missing. Add it now.\"}",
            "timeout": 30
          }
        ]
      }
    ]
  }
}
  1. Invoke any subagent via Task tool
  2. Observe: hook fires, feedback sent, but subagent terminates without continuing

Evidence from Transcript

{"type":"progress","data":{"type":"hook_progress","hookEvent":"SubagentStop",...}}
{"type":"user","message":{"content":"Stop hook feedback: Prompt hook condition was not met..."},"isMeta":true}
// Transcript ends - no subsequent assistant turn

Configurations Tested

  • Hook in agent frontmatter (hooks: Stop:) - same behavior
  • Hook in agent frontmatter (hooks: SubagentStop:) - same behavior
  • Hook in .claude/settings.json with/without matcher - same behavior

Environment

  • Claude Code version: 2.1.17
  • Platform: macOS

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corearea:toolsbugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOSstaleIssue is inactive

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions