LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-vega
createdAtOct 23, 2026, 9:33 AM
updatedAtOct 23, 2026, 1:29 PM
githubUrlhttps://github.com/neomjs/neo/issues/20035
authorneo-opus-vega
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtOct 23, 2026, 1:29 PM
milestonev13.3.1

The CodeQL extraction guard fails on a jobs-API lag it could wait out

neo-opus-vega
neo-opus-vega commented on Oct 23, 2026, 9:33 AM

Context

Three CodeQL workflow runs on 2026-10-23 failed in the CodeQL extraction guard job with the same message, while their Analyze (javascript) leg had completed successfully seconds earlier:

Run Head Analyze (javascript) completed Guard started Guard read the jobs endpoint
39915969169 dev abcfac68b4 07:14:52Z 07:14:55Z ≈07:15:01Z (+9 s)
39916009057 dev 3317a124d9 07:13:32Z 07:13:34Z ≈07:13:39Z (+7 s)
39916733521 PR #20032 09a84f2458 07:19:17Z 07:19:38Z 07:19:46Z (+29 s)

Each log reads:

check-codeql-extraction: could not read an Analyze-leg log — refusing to certify clean from an unread surface.
  Analyze leg "Analyze (javascript)" is in_progress, not completed
<h2 class="neo-h2" data-record-id="3">[error]Process completed with exit code 2.</h2>

The guard had passed on every run since 2026-10-22 23:38Z (eight runs). All three failed jobs were rerun after this diagnosis; the reruns read the same run's Analyze log once the endpoint had caught up.

Why it matters today: the v13.3.1 release PR (#20022, AC-5) must pass dev's required checks including CodeQL. A guard red on that PR means a rerun or a ruleset bypass, the thing the two-phase release path (#19637) exists to avoid.

Design authority: the guard's own contract in buildScripts/util/check-codeql-extraction.mjs. Its fail-closed rule ("a single leg's fetch failure throws — an unread leg is an uncertified leg, never a silent pass") is kept in full. Its premise "A needs: analyze guard runs after all legs finish, so each leg's log is available" (docblock of fetchAnalyzeJobLogs) is what today's runs falsify at the Actions REST API's read time: the workflow engine had finished the leg, the jobs endpoint still said in_progress.

The Problem

The GET /repos/{repo}/actions/runs/{run}/jobs view is eventually consistent. For 7, 9 and 29 seconds after the leg's recorded completed_at, it reported the leg as in_progress. The guard reads that view once (check-codeql-extraction.mjs:124-134) and throws on the first non-completed status. The bounded retry that #16088 added for the same class of race on the log fetch (:139-155) runs only after that check, so it never applies. The memory trail has the class on record: on 2026-07-27 the guard failed eight seconds after the leg completed, on the log fetch; #16075 → #16088 retried the log fetch; the status read in front of it stayed a single shot.

The Architectural Reality

  • .github/workflows/codeql-analysis.yml:75-93: extraction-guard with needs: analyze, actions: read, runs node buildScripts/util/check-codeql-extraction.mjs. The dependency is satisfied by the workflow engine; the guard then re-derives the leg's state from the REST view.
  • buildScripts/util/check-codeql-extraction.mjs, fetchAnalyzeJobLogs: one jobs read → filter legs by name → if (leg.status !== 'completed') throw → per-leg log fetch with retryDelays (default [1000, 2000, 4000]) and sleep seams.
  • test/playwright/unit/buildScripts/util/check-codeql-extraction.spec.mjs:228-239 pins today's behaviour as "an incomplete Analyze leg is terminal and never fetches its log". That arm encodes the false premise and turns around with the fix.

The Fix

buildScripts/util/check-codeql-extraction.mjs, fetchAnalyzeJobLogs:

  • While any matching leg is not completed, re-read the jobs endpoint on the same backoff seams (sleep, retryDelays); only an exhausted wait throws, naming the leg, its last status, the number of reads and the elapsed window, and no log is fetched for it. The log fetch then runs as today.
  • Raise the default retryDelays to [1000, 2000, 4000, 8000, 16000, 32000] (63 s bound) so the default covers the longest lag measured today (29 s) with margin; a CodeQL leg takes two to five minutes, so the bound costs CI nothing it notices. The docblock states the premise correctly: the engine has finished the leg, the REST view may trail it.
  • Spec: replace the terminal arm with two: a leg reported in_progress on the first read and completed on the second is certified from its log after exactly one backoff (red on today's code); a leg that never reaches completed within the backoff stays fail-closed, names it, and never fetches its log.

Acceptance Criteria

  • AC-1: Unit arm, red on dev 3317a124d9: jobs read 1 reports Analyze (javascript) as in_progress, read 2 as completed; fetchAnalyzeJobLogs resolves with the leg's log and the sleep seam recorded exactly the first delay.
  • AC-2: Unit arm: every jobs read reports in_progress; the call rejects with a message naming the leg, the status in_progress, the number of reads and the elapsed milliseconds, and the log endpoint was never fetched.
  • AC-3: The #16075 arms (transient 404 retried, terminal 403 immediate, 503 exhaustion fail-closed, malformed payload terminal) pass unchanged.
  • AC-4: The default bound is stated in the docblock and exceeds 29 s, the longest lag measured in this ticket's Context.
  • AC-5 (cut-side): the fix is on dev before the v13.3.1 release PR opens, so that PR's CodeQL run carries the patched guard; recorded on #20022.

Out of Scope

The Analyze job and the CodeQL action; the alert gate (ruleset 19087298); the log parser (findCodeqlExtractionErrors); any continue-on-error on the guard job.

Avoided Traps

  • A fixed sleep step before the guard: guesses the lag, the check-fixed-sleeps class.
  • continue-on-error: true on the guard job: turns a fail-closed gate into a silent pass, the exact failure #15370 was filed to stop.
  • Reading the check-runs API instead of the jobs API: the same eventually consistent store.
  • Folding the guard into the Analyze job as a final step: a job cannot read its own completed log while it runs.

Related

#15370 → #15420 (the guard) · #16075 → #16088 (the log-fetch retry) · #20022 (the v13.3.1 cut record, AC-5) · #19637 (the two-phase release path) · PR #20032 (the run that surfaced it today)

Live latest-open sweep: checked latest 20 open issues at 2026-10-23T07:30:57Z; no equivalent found. A2A claim sweep: latest 30 messages, all read-states, at 07:31Z; no claim on the guard. Memory Core rationale sweep: my own 2026-07-27 turn recorded the same race class on the log fetch and the retry remedy that became #16075; nothing decided against waiting on the leg status. Own-assignment sweep: #20023, #20022, #20009, #17918, #17416, #16212; none overlapping. Structure-map gate: N/A (build script and workflow, not Agent OS).

Retrieval Hint: "CodeQL extraction guard in_progress jobs API lag backoff"

tobiu closed this issue on Oct 23, 2026, 1:29 PM
tobiu referenced in commit ff1a8f0 - "fix(ci): the CodeQL extraction guard waits out a trailing jobs view before reading a leg's log (#20035) (#20038) on Oct 23, 2026, 1:29 PM