Skip to content

Headless run reports success after agent backgrounds work and ends turn (ScheduleWakeup/background subagents unusable in CI) #1462

Description

@jlapenna

Summary

In an issues: labeled-triggered workflow using claude-code-action@v1 with an explicit prompt (agent mode), the agent delegated repo exploration to a background subagent (Agent tool with background execution), then called ScheduleWakeup several times and ended its turn with:

"Waiting for the Explore agent to finish; I'll pick this back up automatically when it completes or the scheduled wakeup fires."

In a headless run the process exits when the turn ends, so the background subagent was killed, nothing was accomplished (no comment, no PR) — and the action step concluded success because the final message wasn't an error.

Why this is a footgun

  • Interactive-session tools (ScheduleWakeup, SendMessage, background subagent execution, Monitor, TaskList) appear to be exposed to the model in headless CI runs, where "end turn and resume later" is impossible.
  • The model uses them in good faith and exits early; the run is reported green, so the failure is silent — you only notice because the expected side effects (comment/PR) never appear.

Environment

  • anthropics/claude-code-action@v1, self-hosted Linux runner (docker myoung34/github-runner:ubuntu-noble)
  • Auth: claude_code_oauth_token (subscription)
  • Model per init log: claude-sonnet-5
  • Trigger: issues: [labeled] with an explicit prompt input; claude_args: --max-turns 50 --allowedTools "Bash(gh:*),Bash(git:*),..."

Session log excerpt (tool calls, from the runner's session .jsonl)

CALL Skill
CALL Bash: gh issue view 1959 --json title,body,comments,labels,state,author
CALL Read: .claude/skills/sprinkles-dev/references/pr.md
CALL Agent            <- Explore subagent, launched in background
CALL Bash: git status && git ...
CALL ScheduleWakeup
CALL ToolSearch
CALL TaskList
CALL ScheduleWakeup
CALL SendMessage      <- InputValidationError (missing `message`)
CALL ScheduleWakeup
CALL ScheduleWakeup
CALL Bash: sleep 1; echo waiting
LAST ASSISTANT TEXT: "Waiting for the Explore agent to finish; I'll pick this
back up automatically when it completes or the scheduled wakeup fires."

Result JSON: "subtype": "success"-adjacent — the step passed; num_turns well under the limit; no error surfaced.

Workaround

We now pass --disallowedTools "ScheduleWakeup,SendMessage,Monitor" and added prompt text telling the agent the run is headless and it must work synchronously and not end its turn until its deliverable exists. That works, but every action user is one helpful-model-decision away from silent no-op runs.

Suggested fixes (any of)

  1. Don't expose interactive-only tools (ScheduleWakeup/SendMessage/background agent mode) in headless (-p) runs, or make background subagent completion block process exit.
  2. Have the action fail (or at least warn) when the session ends with pending background tasks / scheduled wakeups.
  3. Document the --disallowedTools workaround for CI use.

Happy to provide fuller (redacted) session logs if useful. Repo is private, so run links wouldn't be viewable — excerpts above are from the persisted session file on our runner.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp2Non-showstopper bug or popular feature request

    Type

    No type

    Fields

    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