Skip to content

prompt-hook runs on Claude Code <agent-message> subagent hand-backs and hits the 30s hook timeout #2184

Description

@tippmar-nr

Follow-up to #1832.

v1.6.1 skips prompts that are a single <task-notification>...</task-notification> envelope (isTaskNotification, #1884). Claude Code also delivers subagent results to the parent session as UserPromptSubmit prompts in a different envelope:

<agent-message from="<agent-id>">
[Subagent hand-back] ...full report text...
</agent-message>

These prompts are not user input. They are also usually long, because they carry a subagent's full report. prompt-hook runs a full explore on them. In one session, two hand-backs of about 5-8 KB each made the hook go past Claude Code's default 30 s hook timeout:

UserPromptSubmit hook [codegraph.cmd prompt-hook] timed out after 30s -- output discarded.

When the hook finishes in time, the injected context is unrelated to the prompt (symbols matched from words in the prose report).

Expected: prompt-hook exits immediately on <agent-message ...>...</agent-message> prompts, the same way it does for <task-notification>.

Suggested fix: extend isTaskNotification (or add isAgentMessage) to match ^\s*<agent-message\b[^>]*>[\s\S]*<\/agent-message>\s*$.

Environment: Windows 11, Claude Code CLI, CodeGraph v1.6.0 (the #1884 fix in v1.6.1 does not match this envelope; checked against the PR diff).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions