Job hangs ~20-25 min with no output after a Task-delegated subagent reports completion (repository_dispatch trigger)
Describe the bug
When the top-level agent delegates work to a custom project-defined subagent via Task (e.g. subagent_type: some-custom-agent), and that subagent's task reaches status: completed, the parent session appears to hang indefinitely afterward — no further JSON stream events, no final "type": "result" block, and no PR comment is posted despite the prompt instructing one. The GitHub Actions job eventually exits ~20–25 minutes later with conclusion: success but nothing was actually produced (no comment, no commit, no visible output).
This has reproduced twice in a row, in separate workflow runs. The second time, show_full_output: true was enabled to capture the raw stream, which pinpoints exactly where it stops.
A plain local_bash background task (not a Task-delegated subagent) completed and the session continued normally within ~2 seconds in the same run — so this is not "any Task-based flow hangs," it's specific to the subagent-delegation case.
To Reproduce
Set up a workflow triggered by
repository_dispatch, runningclaude-code-action@v1withclaude_args: --allowedTools "Read,Grep,Glob,Bash,Edit,Write,Task".Define a project
.claude/agents/*.mdcustom subagent.Prompt the top-level agent to delegate a real, multi-step piece of work to that subagent via
Task(in our case: severalBashtool calls investigating repository state, taking ~11 minutes of real visible work).Instruct the top-level agent (in the same prompt) to, after the subagent's work, post a comment on a target PR via
gh.Observe: the subagent's
task_updated/task_notification(status: "completed") system events appear in the log, and then the JSON stream stops — no further assistant/user/result messages, no comment posted — until the job exits roughly 20–25 minutes later.Go to '...'
Click on '....'
Scroll down to '....'
See error
Expected behavior
The top-level session should continue after the Task-delegated subagent reports status: completed, produce a final "type": "result" message, and (per the prompt) post the PR comment via gh — completing within roughly the time the visible work actually took (a few minutes), not 20–25 minutes later with no output.
Screenshots T+~1m {"type":"system","subtype":"task_started","task_id":"bvnw44ydr","tool_use_id":"...","description":"Re-establish current HEAD SHAs for all ledger repos","is_backgrounded":false,"task_type":"local_bash", ...} T+~1m {"type":"system","subtype":"task_notification","task_id":"bvnw44ydr","tool_use_id":"...","status":"completed","output_file":"","summary":"Re-establish current HEAD SHAs for all ledger repos", ...} (session continues normally within ~2 seconds)
...~11 minutes of normal assistant/user/tool_use/tool_result messages inside a Task-delegated subagent (subagent_type: )...
T+~12m {"type":"system","subtype":"task_updated","task_id":"ad6906e5e3c847473","patch":{"status":"completed","end_time":<epoch_ms>}, ...} T+~12m {"type":"system","subtype":"task_notification","task_id":"ad6906e5e3c847473","tool_use_id":"...","status":"completed","output_file":"/tmp/claude-1001/.../tasks/ad6906e5e3c847473.output" <-- this is the LAST line in the entire log. No matching closing content for this JSON object was captured, no further stream lines at all. T+~35m (job log jumps directly to the action's own "Post job cleanup" steps — nothing in between)
Workflow yml file
name: Trigger Industrialisation
on:
repository_dispatch:
types: [some-custom-event]
permissions:
contents: write
jobs:
run-agent:
name: Run custom orchestrator agent
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT }}
fetch-depth: 0
- name: Run agent
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
show_full_output: true
github_token: ${{ secrets.GIT_PAT }}
prompt: |
Use the <custom-orchestrator-agent> agent.
[... project-specific instructions describing the source
event payload from github.event.client_payload.*, telling
the agent to delegate analysis work to project-defined
subagents via Task, and to post a final comment on a
target PR via gh once done ...]
claude_args: |
--allowedTools "Read,Grep,Glob,Bash,Edit,Write,Task"API Provider
[ X] Anthropic First-Party API (default) [ ] AWS Bedrock [ ] GCP Vertex
Additional context
- This is a project-specific (non-built-in) subagent defined under
.claude/agents/*.md, invoked viaTaskwith a matchingsubagent_type. - Trigger type is
repository_dispatch, notpull_request/issue_comment/workflow_dispatch— we have not tested whether this reproduces under those other trigger types. is_error: falsein the one occurrence where aresultblock appeared, and no tool/permission errors anywhere in either log — this doesn't look like a crash, more like the process being alive but stuck (e.g. blocked reading/writing the subagent'soutput_file, or waiting on a stream/handle that never closes).- We reduced our job's
timeout-minutesfrom 90 to 25 to bound the wasted Actions runtime per occurrence — that's a mitigation for the symptom, not a fix. - Happy to share the full (sanitized) JSON log for the second occurrence, or attempt a minimal from-scratch reproduction, if either would help narrow this down.
Source: anthropics/claude-code-action