Skip to content

fix(auditor): degrade gh-aw subprocess timeouts to deferred evidence - #78232

Merged
pelikhan merged 3 commits into
mainfrom
pelikhan/auditor-gh-etimedout
Nov 16, 2026
Merged

pelikhan merged 3 commits into
mainfrom
pelikhan/auditor-gh-etimedout

Conversation

@pelikhan

@pelikhan pelikhan commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

The Auditor's collect_failure_evidence job has crashed with an unhandled spawnSync gh ETIMEDOUT in 2 of 2 recent runs (43792678875, 43786667975; auto-filed as #78216 and #78204). A single slow per-run query took down the whole collection step.

Root cause

For each backlog run, the collect script calls gh aw logs <wf> --after-run-id N-1 --before-run-id N+1 --count 2. That window can only ever match one run, so the CLI never reaches its count. It keeps paging backward through old history, up to 20 small pages with a rate-limit check on each one. The CLI's --timeout 2 (minutes) equals the 120000ms execFileSync timeout, so Node kills the subprocess before the CLI can report, and the resulting ETIMEDOUT was never caught. In run 43792678875 this happened on backlog run 43669824841 ("Update Astro"), while the CLI was paging past 2026-11-07.

Fix

CLI (pkg/cli): pagination now stops once a fetched page reaches --after-run-id. Run IDs increase with creation time and pages arrive newest-first, so older pages cannot match. listWorkflowRunsWithPagination records the oldest fetched run ID before filtering, and the batch loop checks it for both empty and non-empty batches.

Workflow (.github/workflows/auditor.md, lock regenerated):

  • Per-run logs and audit queries use --count 1. The subprocess timeout is 150s, 30s more than the CLI's own timeout, so the CLI can report its own timeout.
  • A logs or audit ETIMEDOUT, or a CLI Timeout reached continuation, now defers that run. The run stays pending, a warning is logged, the agent is not activated, and the remaining runs keep processing. Audit deferral reuses the existing pending/unseen logic.
  • A gh aw health ETIMEDOUT goes through the existing time_budget retry path (300, then 600, then up to 900s).
  • Other incomplete evidence (partial reports, coverage gaps, non-timeout continuations) still fails closed, as before.
  • The prose describing deferral behavior is updated to match.

Build the CLI from source: the collect job used to install the latest released CLI, so CLI fixes only applied after a release. It now runs actions/setup-go (pinned) and go build against the checkout, installs the result with gh extension install . (same pattern as craft.md), and versions it as source-<sha>. The CLI pagination fix therefore takes effect immediately. The collect job timeout goes from 20 to 25 minutes so the build does not cut into the 18-minute evidence deadline, which is measured from script start.

Notes for reviewers

  • Per-version query caches are keyed by gh aw version. With source-<sha> the key changes on every commit to main. This only affects fresh or deferred runs, which are queried within a single collection. Backlog reports are read without a version check, so no backlog evidence is re-fetched.
  • --count 1 makes the first page smaller (3 runs instead of 6), so the CLI looks back less far for runs in high-frequency workflows. In practice the timeout already limited how far back it reached.

Validation

  • New Go test TestCollectProcessedWorkflowRunsStopsAtAfterRunIDBoundary fails without the fix (2 and 20 fetch calls instead of 1) and passes with it.
  • scripts/auditor-workflow.test.cjs: 56/56 pass, including new cases for a logs subprocess timeout, a CLI timeout continuation, an audit timeout and a health timeout.
  • make recompile, make fmt and make agent-report-progress all pass.
  • No workflow runs were dispatched.

pelikhan and others added 2 commits November 15, 2026 19:25
The Auditor collect step crashed with an unhandled `spawnSync gh ETIMEDOUT`
(runs 43792678875, 43786667975). Per-run `gh aw logs --after-run-id N-1
--before-run-id N+1 --count 2` can only ever match one run, so the CLI kept
paginating up to 20 tiny pages of older history looking for a second match.
Its `--timeout 2` equalled the 120s execFileSync timeout, so Node killed it
before it could report.

CLI: stop pagination once a fetched page reaches --after-run-id (run IDs are
monotonic and pages are newest-first), so older pages cannot match.

Workflow: request --count 1, give the subprocess 30s slack over the CLI's
timeout, defer a run (leave it pending) on ETIMEDOUT or a CLI "Timeout reached"
continuation instead of crashing, and route a health subprocess timeout
through the existing bounded time_budget retry path. Other incomplete
evidence still fails closed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The collect job installed the latest released CLI, so collection fixes in
pkg/cli (such as the --after-run-id pagination boundary) only applied after
a release. Build the CLI from the checked-out source with setup-go, install
it as a local gh extension, and version it as source-<sha> so per-version
query caches stay consistent within a collection. Raise the job timeout to
25 minutes so the build does not eat into the 18-minute evidence deadline.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review November 16, 2026 03:38
Copilot AI adaptive review requested due to automatic review settings November 16, 2026 03:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

@github-actions

Copy link
Copy Markdown
Contributor

✂️ Ponytail Reviewer has started processing this pull request

@github-actions

Copy link
Copy Markdown
Contributor

🔎 PR Code Quality Reviewer is reviewing code quality for this pull request...

@github-actions

Copy link
Copy Markdown
Contributor

🚀 PR Specification Reviewer has started processing this pull request

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Design Decision Gate 🏗️ is checking for design decision records on this pull request...

@github-actions

Copy link
Copy Markdown
Contributor

🔬 Test Quality Sentinel is analyzing test quality on this pull request...

@github-actions

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer is reviewing this pull request using Matt Pocock's engineering skills...

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Triage of the automated reviewer start notices on this PR:

  • 6906614655 (Ponytail Reviewer, run 43799416023)
  • 6906614833 (PR Code Quality Reviewer, run 43799416014)
  • 6906614936 (PR Specification Reviewer, run 43799415868)
  • 6906615234 (Design Decision Gate, run 43799415971)
  • 6906616138 (Test Quality Sentinel, run 43799415831)
  • 6906618507 (Matt Pocock Skills Reviewer, run 43799415828)

These are automated "started processing" notices with no review feedback. All six runs failed during agent startup because of a transient model-provider outage (model routing failed with provider_unavailable, model catalogue 403 at about 03:41 UTC on 2026-11-16) before producing any review. No code change is needed; these workflows should be re-run once the provider is available.

@pelikhan
pelikhan merged commit 4f3ece5 into main Nov 16, 2026
50 checks passed
@pelikhan
pelikhan deleted the pelikhan/auditor-gh-etimedout branch November 16, 2026 04:32
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.3.0

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants