Skip to content

fix: time out hung gh exec in capacity wait #325

Description

@SebTardif

scripts/lib.mjs ghRaw called execFileSync(gh, ..., --paginate --slurp) with no timeout. If that GitHub CLI child never returns, waitForLiveWorkerCapacity cannot reach its 30 minute deadline and dispatch stays pinned until someone kills it.

What happens

  1. Throttled dispatch and other callers poll live worker runs through waitForLiveWorkerCapacity.
  2. Each poll uses gh api .../runs --paginate --slurp via ghRaw / execFileSync.
  3. Those children had no timeout, so a stalled gh never returns.
  4. The 30 minute capacity deadline is checked only between polls, so it never fires.

This is separate from dispatch secret/variable list timeouts (#323) and dispatch child runCommand timeouts (#324).

Proposed fix

Give ghRaw the same timeout contract as worker planner/review children:

  • CLOWNFISH_GH_EXEC_TIMEOUT_MS (default 2 minutes)
  • execFileSync(..., { timeout, killSignal: "SIGKILL" }) for capacity gh polls
  • Cap each poll by the remaining waitForLiveWorkerCapacity deadline
  • On ETIMEDOUT, keep polling until that deadline, then throw the existing capacity timeout

A source contract plus hung-gh and timely-list fixtures live in test/lib.test.mjs.

Fork branch

This repo limits pull requests to collaborators, so I could not open a PR. The patch is on my fork:

Feel free to cherry-pick that commit, or I can open a PR if you add this account as a collaborator.

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

    P1Urgent regression or broken agent/channel workflow affecting real users now.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopThis issue is about crashes, hangs, restart loops, or process-level availability.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.no-staleExempts this issue from stale automation.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions