Skip to content

fix(codeql): accept queued pre-cutover scan-dispatch payloads - #2009

Merged
seonghobae merged 1 commit into
mainfrom
fix/codeql-legacy-dispatch-payload
Sep 7, 2026
Merged

fix(codeql): accept queued pre-cutover scan-dispatch payloads#2009
seonghobae merged 1 commit into
mainfrom
fix/codeql-legacy-dispatch-payload

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Why

#2008 squash-merged required_jobs as the only wake-identity contract on codeql-scan-dispatch.yml. repository_dispatch always runs the default-branch file, so every payload that lined up before that merge still carries the old scalars (required_job_id + required_language) and a one-shard matrix. Those runs now fail closed at validate, and the required CodeQL job they were meant to wake stays failed in the pending handoff.

This is the cutover hole, not a product change. The new one-dispatch-per-PR payload stays the preferred path.

What

  • New contract is unchanged: required_jobs is a 1:1 map of language to canonical job id, matrix length >= 1, unique languages.
  • Legacy contract: when required_jobs is empty (null or []) and required_language + required_job_id are present and the matrix length is 1 and the language matches, validate synthesizes required_jobs=[{language, job_id}] and accepts.
  • A present required_jobs array ignores leftover scalar fields, even when they conflict.
  • Both missing, language mismatch, matrix length != 1 with only scalars, or a non-canonical job id still fail closed.
  • Concurrency group stays {workflow}-{repository}-{PR} with no language suffix.

Tests

python3 -m pytest tests/test_codeql_scan_dispatch_workflow_contract.py tests/test_codeql_pr_workflow_contract.py tests/test_scheduler_and_codeql_dispatch_runner_image_contract.py tests/test_required_workflow_queue_contract.py tests/test_docs_only_pr_runner_admission.py -q

116 passed.

Chicken-and-egg: this is not a product PR. It is a structural workflow repair so queued pre-#2008 dispatches can validate on the default-branch handler. If the 60-job ceiling keeps this repository's own required checks from starting, admin bypass squash merge is the documented recovery for this class of change.

Developer experience: a queued single-language codeql-scan dispatch validates instead of failing closed after the cutover; a current multi-language required_jobs payload is unchanged.
User experience: required CodeQL compatibility checks for those in-flight pull requests can still complete instead of remaining failed because the handler rejected a payload shape it used to accept.

#2008 made required_jobs mandatory on the default-branch handler.
repository_dispatch runs that file, so payloads that lined up before
the merge still carry required_language + required_job_id and a
one-shard matrix. Validate now synthesizes required_jobs from those
scalars when the array is empty, the matrix length is 1, and the
language matches. A present required_jobs array still wins; missing
or mismatched identity still fails closed. Concurrency stays
{workflow}-{repository}-{PR} with no language suffix.

Developer experience: queued single-language dispatches validate
instead of all failing closed after the cutover.
User experience: required CodeQL compatibility checks for those
in-flight PRs can still complete.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 37 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: c322bbea-508d-4287-b11d-0d063c76ac15

📥 Commits

Reviewing files that changed from the base of the PR and between dd7ea81 and 0fbd26c.

📒 Files selected for processing (2)
  • .github/workflows/codeql-scan-dispatch.yml
  • tests/test_codeql_scan_dispatch_workflow_contract.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Bypass merge evidence (chicken-and-egg, structural workflow repair, not a product change).

  • Local python3 -m pytest tests/test_codeql_scan_dispatch_workflow_contract.py tests/test_codeql_pr_workflow_contract.py tests/test_scheduler_and_codeql_dispatch_runner_image_contract.py tests/test_required_workflow_queue_contract.py tests/test_docs_only_pr_runner_admission.py -q: 116 passed on 0fbd26c091fbccda0ebf6606523ce497cf005041.
  • Live head re-fetched before merge: 0fbd26c091fbccda0ebf6606523ce497cf005041 (base dd7ea8133e90653e3baf748315ad08367239388b).
  • mergeable_state=blocked because this PR's own required checks are queued behind the 60-job ceiling (CodeQL PR, Security Scan, SAST Semgrep, Python Security, Required OpenCode bootstrap, Required Noema, Strix, merge scheduler all queued; in_progress on this head: none; .github queued total_count=144, in_progress=9).
  • Already-queued pre-fix(codeql): dispatch one current-head scan per pull request #2008 dispatch runs are left in place; this merge does not cancel them. After it lands, the default-branch handler will synthesize required_jobs from those scalar payloads instead of rejecting them.

@seonghobae
seonghobae merged commit 78a4937 into main Sep 7, 2026
5 of 15 checks passed
@seonghobae
seonghobae deleted the fix/codeql-legacy-dispatch-payload branch September 7, 2026 07:47
seonghobae added a commit that referenced this pull request Sep 7, 2026
…ed claim

Three review findings on the Actions ceiling section, all valid.

The heading read `2026-09-07` while the only measurement window in the section
is `2026-09-06T12:00:00Z..19:00:00Z` and the other reference is 2026-09-04. The
commit was `2026-09-07 05:07 +0900` = `2026-09-06T20:07Z`, so the heading
carried the local calendar date rather than the measurement's. KST rolls the
date nine hours before UTC; date a measurement section by the measurement.

The planning sentence said `#1929` converts "368 cheap no-ops per 7 h" while
the measurement two sentences above is 354, which is also the figure the 20.9%
ratio is computed from (354/1691). 368 appears nowhere else in the document as
a measured value. The sentence now names the same 354 explicitly, so the two
cannot drift apart again.

The two fenced blocks this section added carried no language info string
(MD040). Both are now `text`, matching the document's existing precedent. Three
further bare blocks predate this change and are left alone: no markdownlint
gate runs in this repository, so this is consistency with the reviewer's point
inside this change's own scope rather than a document-wide sweep.

Verifying the third finding showed the section's own "not duplicates" reasoning
has expired: `#2008` removed `required_language` from the dispatch concurrency
group, which was still language-keyed at `2396ddca`, the last `main` inside the
measured window. The replacement paragraph records that, the measured collapse
that followed (`06:16Z..08:15Z`: 86 of 100 runs cancelled, median lifetime
39.1 min, no success since `03:58:07Z`, validation failures 204 to 0 across
`#2009`), and that the cause is not established.

It first recorded a cause -- legacy single-language payloads colliding in the
language-free group -- and that was withdrawn before this commit. The
coordinator on current `main` builds one pending-language matrix and emits a
single dispatch carrying all of it with no `required_language`, so the group
needs no language term and current dispatches cannot collide with themselves.
The candidate survives only for payloads queued before the cutover, which is
what `#2009` exists to validate, and no cancelled run can be shown to carry one
because a cancelled run serves no logs. A mass cancellation at `07:40:40Z` that
crossed several concurrency groups in one second argues against it outright.
The paragraph now states the measurements and leaves the mechanism open.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
seonghobae added a commit that referenced this pull request Sep 7, 2026
Bring in CodeQL one-dispatch-per-PR (#2008) and required_jobs
synthesis (#2009) so this remaining Strix push coalesce can sit
on current main without rewriting those contracts.

Signed-off-by: Seongho Bae <me@seonghobae.me>
seonghobae added a commit that referenced this pull request Sep 8, 2026
Preserve the #2002 host-scoped credential delta while integrating the #2008/#2009 current-head CodeQL coordinator and pre-cutover payload compatibility fixes. No force update; both exact parent SHAs are recorded.
seonghobae added a commit that referenced this pull request Sep 8, 2026
The completed-scan fallback matched only repo#PR@head plus language, so a
same-head retarget could consume a predecessor-base scan and a different
waiting required run could satisfy this shard. Encode live base SHA and
required_run_id in the public dispatch run-name, look up that identity
from the required shard, and POST the live base on later attempts.
Concurrency stays repository+PR per #2008/#2009.
seonghobae added a commit that referenced this pull request Sep 8, 2026
* fix(codeql): keep a clean dispatch scan when status publish 403s

opencode-agent is installed with statuses:read, so POST /statuses to a
target repo returns HTTP 403 after the SARIF gate already passed. Treat
the completed dispatch scan job as terminal evidence and let the
required shard consume that public run on rerun instead of fail-closing
a clean scan.

* fix(codeql): dispatch remaining languages on workflow reruns

Attempt 2 of .github#2028 skipped Dispatch current-head because the
coordinator required github.run_attempt == 1, so no codeql-scan was
posted. Later attempts still skip when every language already has a
terminal opencode-agent verdict.

* test(codeql): require paginated dispatch evidence lookup

* test(codeql): require paginated dispatch job lookup

* fix(codeql): paginate exact dispatch evidence

* test(codeql): parse paginated gh endpoint options

* style(codeql): normalize pagination fixture spacing

* test(codeql): match paginated empty dispatch fixtures

Signed-off-by: Seongho Bae <me@seonghobae.me>

* fix(codeql): bind dispatch fallback to live base and required run

The completed-scan fallback matched only repo#PR@head plus language, so a
same-head retarget could consume a predecessor-base scan and a different
waiting required run could satisfy this shard. Encode live base SHA and
required_run_id in the public dispatch run-name, look up that identity
from the required shard, and POST the live base on later attempts.
Concurrency stays repository+PR per #2008/#2009.

---------

Signed-off-by: Seongho Bae <me@seonghobae.me>
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.

1 participant