fix(codeql): wake required jobs with the exchanged target app token - #2040
fix(codeql): wake required jobs with the exchanged target app token#2040seonghobae wants to merge 150 commits into
Conversation
Preserve the existing four-file rerun recovery delta without emitter or concurrency policy changes. Local contract verification: 144 passed, 2 failed. Existing verdict-reader fixtures still expect the pre-pagination gh invocation; these files and the requester are unchanged from bf732f9. Workflow actionlint and diff checks passed. No hosted dispatch or push performed. Signed-off-by: Seongho Bae <me@seonghobae.me>
Match exact gh arguments and page-shaped responses. Preserve trusted-publisher assertions and exercise second-page success and failure after a full page of forged statuses. Signed-off-by: Seongho Bae <me@seonghobae.me>
Request PR state in GraphQL and preserve it in REST normalization. Reject missing state and empty or malformed heads before OpenCode dispatch, Strix dispatch, or Strix job rerun. Preserve explicit positive fixtures and add fail-closed regressions. Focused RED: 17 failed, 19 passed; final scheduler regressions: 380 passed under both normal and GITHUB_ACTIONS=true environments with warnings treated as errors. No dispatch, permission, queue, or cancellation policy changes. Signed-off-by: Seongho Bae <me@seonghobae.me>
Validate selected check, job, run, workflow and publisher before rerunning Strix. Preserve PR-target base-SHA executions through association and target-title checks; defer dispatch runs without authenticated target provenance. Local mock-only regressions: 402 passed in normal and CI environments with warnings treated as errors. No token, permission, queue or cancellation changes. Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
Block terminal status publication and exact-job wake when SARIF upload does not succeed. Preserve existing finding verdicts and document the unresolved receipt boundary. Co-authored-by: Codex <codex@openai.com> Signed-off-by: Seongho Bae <me@seonghobae.me>
Compare already-fetched live base identity with event inputs before status consumption. Keep historical verdict provenance and artifact authority as unresolved follow-ups. Co-authored-by: Codex <codex@openai.com> Signed-off-by: Seongho Bae <me@seonghobae.me>
Supply the real base repository, ref and SHA required by the production dispatch shell. Preserve later-attempt redispatch coverage without weakening the live-base guard. Co-authored-by: Codex <codex@openai.com> Signed-off-by: Seongho Bae <me@seonghobae.me>
Merge exact 82ca0b8 into the handoff branch. Consolidate equivalent publication regressions and SARIF documentation while preserving live-base validation and rerun fixtures. Co-authored-by: Codex <codex@openai.com> Signed-off-by: Seongho Bae <me@seonghobae.me>
|
Additional exact-current-head settlement-race evidence (2026-09-12 UTC):
Keep fail-closed. Do not manually rerun, synthesize a status, or copy the producer into the consumer. #2040 remains the canonical owner for terminal receipt publication and exact-run settlement. |
2026-09-12 UTC settlement RED after terminal dispatch
The resulting attempt created new compatibility jobs |
Exact-head downstream settlement reproduction — 2026-09-13
The same exact head has GREEN Runtime Quality, Security, Python Security, and SAST. This is evidence for the canonical receipt/settlement owner, not a leaf-source finding and not permission to synthesize GREEN or reuse a predecessor verdict. No manual rerun was requested. |
|
Read-only prerequisite correction for downstream BandScope settlement: this PR body still names #2106 predecessor |
|
New protected-main canary for the post-bootstrap cutover: |
|
Fresh Orgmetra #64 canary reproduces the producer-after-consumer settlement ordering defect on a new exact head. Exact consumer:
Observed ordering:
Thus both required consumers terminal-failed before the exact-head producer dispatch even started. This is fresh evidence for the central bootstrap/settlement cycle; no Orgmetra no-op retrigger, copied workflow, synthetic status, or predecessor verdict is being used. Preserve this canary through the #2106 prerequisite and this canonical successor's ordinary reconciliation. |
|
Fresh immutable consumer canary from
RCA/acceptance: the exchanged target-repository App token is not sufficient authority to dispatch into the central |
seonghobae
left a comment
There was a problem hiding this comment.
Fresh consumer canary from linux-cluster-ops#307@f69ccbff0ae8178cbf0cbb79bb43a6107e1b0b2c narrows the remaining producer bootstrap failure. Required run 34724779491: Actions compatibility job 103636976617 failed its verdict read at 23:14:11Z, Python 103636976611 at 23:14:21Z; coordinator 103637179946 did not start until 23:15:17Z. More importantly, coordinator OIDC/token exchange succeeded, then the repository-scoped exchanged app token failed exactly at POST repos/ContextualWisdomLab/.github/dispatches with HTTP 403 Resource not accessible by integration at 23:15:20Z.
This proves the current leaf producer is using a target-repository credential to mutate the central .github repository, and also terminalizes compatibility consumers before that dispatch can complete. No CodeQL/SARIF source finding is implicated (linux-cluster quality/Security/SAST are GREEN on the same head).
Owner acceptance after #2106 bootstrap: central dispatch mutation must be authorized by a credential scoped to .github (or a versioned central endpoint that owns the mutation); target App credentials remain scoped to target-repository read/status/rerun duties. Then hold/wake compatibility consumers on an exact base/head/run producer receipt rather than terminal failure before producer start. Required immutable canary: same consumer repo/PR/head gets actions+python authenticated terminal verdicts, no Resource not accessible by integration, no synthetic status/no-op commit/manual rerun, and the receipt binds exact target repository, PR, base SHA, head SHA, required run and ordered language jobs.
|
Fresh Orgmetra exact-head consumer canary reproduces the producer-after-consumer settlement failure on
Thus this exact consumer again fails closed before the producer can publish/wake the terminal current-head evidence. No Orgmetra source/SARIF finding is inferred, no predecessor verdict is transferred, and no leaf no-op retrigger or synthetic status is appropriate. Please retain this as a current public-consumer fixture for the #2040/#2106 bootstrap + run-wide settlement repair. |
|
Evidence from a dispatch run on current Run 34733576667, job The scan is not the problem, and neither is validation ordering on this run. The job reaches the end of its work successfully: database built, 45 query packs loaded, It then fails at publication, on both credentials, with the same status: The refused call is # .github/workflows/codeql-scan-dispatch.yml:279-284
permissions:
actions: write
contents: read
security-events: read
id-token: write
statuses: write # Required for downscoped OIDC status publication.— and Why it matters beyond this run: the required One correction to a nearby assumption, since it changed my own reading: this is no longer the pre-runner cancellation class tracked in #1929. Those runs showed If the cap hypothesis holds, the code change in this PR cannot make the publication succeed on its own, and the two would need to land together. Your call — you have the full context on this branch and I do not. Generated by Claude Code |
Correction to my evidence above — I mislabelled the run, and the diagnosis was wrongTwo errors in my earlier comment. Retracting both before they inform anyone's work on this branch. 1. The run I cited does not target It targets naruon. I then used it to argue "this is not the cross-repo case where 2. The status-publish
Same run, same credentials, same repository, opposite outcomes. A missing What actually failed on the python shard:
What does still hold, and is genuinely separate. For a cross-repo target the wake never reaches the rerun at all — it exits earlier: Confirmed identically on the naruon run above and on
I have not verified any repository or org setting — the Still your lane; still not touching this branch. Sorry for the noise of a correction on top of the original. Generated by Claude Code |
|
Fresh Orgmetra exact-head consumer canary reproduces the protected producer-after-consumer settlement defect on 2026-09-13.
So both consumers settled fail-closed before the producer job even began. This is current exact evidence for the #2040/#2106 central bootstrap/settlement dependency, not an Orgmetra source/SARIF finding. Orgmetra did not use a no-op retrigger, predecessor verdict, synthetic status, copied workflow, or protection bypass. |
|
Fresh downstream evidence from AIP current exact Fresh canonical prerequisite read: #2106 is open Ready/mergeable at exact |
|
AIP downstream terminal follow-up: |
|
Fresh source-changing external canary for the canonical producer-after-consumer defect: Exact ordering is now unambiguous:
So the leaf consumers are not failing because a terminal CodeQL/SARIF finding was returned; their receipt deadline expires before the same workflow generation is permitted to publish the dispatch that can create that receipt. This is direct executable RED for this PR's documented producer-after-consumer prerequisite, on a real source-changing authentication repair rather than a no-op retrigger. GREEN acceptance remains: after #2106's protected bootstrap and this stack's ordinary non-force restack/cutover, the same generation must admit producer dispatch early enough for authenticated terminal receipts to settle both required consumers; no leaf sleep, manual rerun, source-neutral commit, copied workflow, predecessor receipt, or synthetic status. Gyeot remains Draft and no central source/refs were modified here. |
|
AIP consumer evidence update from Predecessor exact head AIP has moved ordinarily to exact |
seonghobae
left a comment
There was a problem hiding this comment.
AIP consumer evidence update from ContextualWisdomLab/accounting-information-platform#59.
Exact head 5a06e9a23cbcd13c7b8182ec2e3e9037fddcd3d1 now establishes the 87th consecutive receiver-before-dispatch generation in that lane. Required run 34761487213: Actions receiver 103735185408 completed FAILURE at 2026-09-13T14:11:11Z; Python receiver 103735185416 completed FAILURE at 14:13:16Z. Dispatch producer 103736427908 was created only at 14:13:17Z, then started at 14:24:42Z and completed SUCCESS at 14:24:47Z. Both required consumers were therefore terminal before their authenticated producer existed. Standalone Security 34761487209 and SAST 34761487234 are terminal SUCCESS; Accounting Foundation 34761487239 reached the intentional AIP behavior RED after PostgreSQL/setup.
AIP has since advanced by one ordinary test-only descendant to 66974820f884906fed17566958719a5e62fe1ae6; that new generation is not counted until its own chronology is terminal. This remains central producer/consumer ordering evidence, not an AIP source-analysis defect. AIP still has no copied central workflow, synthetic status, source-neutral retrigger, polling loop, PAT fallback, manual rerun loop, or gate weakening.
Owner session:
fast-mlsirm-commercializationOutcome
Canonical combined successor for the central CodeQL producer/handler cycle, exact required-run recovery, strict head-envelope validation, and stacked-PR check admission.
Current authority after non-force reconciliation:
main@fb17ef556f94f673234aa557254ae52779e9a7b0;85522306949bada2b5939608dc911f6374125f1b;fe8ca79a4fd410e68eb790258820a511fa6cdc70;Root causes and repair retained
codeql-dispatch/<language>/<base_sha>receipts.pr_headschema/types and legacy scalar fields must agree.PR_REVIEW_MERGE_TOKEN→OPENCODE_APPROVE_TOKEN→ same-repository token fallback remains explicit and authenticated..github/main, not target-PR synthetic ancestry.branchesandbranches-ignorefilters.faileddispatch keeps one top-levelrequired_jobsauthority compatible with the protected pre-cutover handler; only whole-attemptalluses the nested envelope.The branch continues to carry all valid predecessor delta from #1902, #2004, #2043 and #2044. Those predecessors are not treated as shipped merely because their delta is inherited here.
Protected-main reconciliation
Fresh review found predecessor
6706c231ab06a3c91c43fdb5b989cfcd79fff593had diverged from current protected main by 144 ahead / 32 behind. The protected-side 32 commits affected eleven effective files and did not overlap this PR's 24 effective files. A concurrent central writer then performed the same ordinary merge-forward tree that had been independently prepared here:3b2de64c2c4c95c56d2f5099a480a0825304d038;6706c231...and protectedmain@cb0872c9...;eb8d6351193519afca23d448f70b9ab59f5eb5a4;The independently prepared tree had the identical SHA
eb8d635...; its ref update was correctly rejected as non-fast-forward after the concurrent merge landed first. The concurrent commit is therefore adopted rather than rewritten or force-replaced.Verification boundary
Historical predecessor suites remain diagnostic only after the merge-forward. Local verification for tree
da7514aa...is focused9 passed, scheduler/related336 passed, repository3127 passed / 1 skipped / 21 subtests, statement/branch/public-doc coverage 100%, and diff check clean. The exact head must still obtain fresh hosted current-head workflow, security, coverage and independent-review evidence before normal merge. CodeQL run34629071379attempt 50 was a zero-jobstartup_failureon predecessor head3b2de64c...; it is evidence for this repair, not authorization for the new head.This branch is the central prerequisite lane for the producer-after-consumer Required CodeQL failure repeatedly reproduced by fast-mlsirm exact heads. Do not repair that defect in product repositories through copied workflows, synthetic statuses, no-op retriggers, or bypasses.
Exact-head replay-gate repair
Current-head OpenCode run 34684439092, coverage job
103528902332, supplied the RED: the trustedpr_head_replay_guardobserved the intentional retirement of obsolete restamp tests intests/test_pr_review_merge_scheduler.pybut no added replacement test module, so it failed before coverage measurement.The repair moves the two positive no-mutation contracts into
tests/test_pr_review_merge_scheduler_source_neutral_commit_contract.py. It retains the complete scheduler test module and makes replacement evidence structurally visible to the protected guard. A transient Git-data upload commitbe25a767...truncated the large existing test blob; it was never promoted as valid evidence and the immediate ordinary child6476b919...restored the full blob. Fresh compare froma9b18b4b...to this head is exactly 46 lines moved out of the existing test module and 60 lines added in the replacement module, with no source or workflow path changed.Exact-tree verification: focused
9 passed / 325 deselected; full3127 passed / 1 skipped / 21 subtests; statement and branch coverage 100%; public-doc coverage 100%;git diff --checkclean; and the productionpr_head_replay_guardreports PASS with one added test file and no reverted protected-main path.Latest protected-main and Runtime Quality reconciliation
Runtime Quality run
34686471090on predecessor798a5d4f...failed because its selected canonical fixturetests/test_javascript_materializer_docstrings.pywas absent. Protected main had already merged the owner contract through #2095 and the queue-history contract through #2092. Ordinary two-parent commit85522306949bada2b5939608dc911f6374125f1bnow joins predecessor798a5d4f...with protectedmain@fb17ef55...at exact treefe8ca79a...; the overlapping Runtime Quality workflow preserves both the main-side JavaScript materializer contract and this PR's scheduler selector.Exact-tree verification is focused
72 passed, repository3133 passed / 1 skipped / 36 subtests, allscripts/ci/*.pystatement/branch coverage 100% (13,155statements /5,322branches), public-doc coverage 100%, compileall PASS, and diff checks clean. Exact-head Runtime Quality34686930839, Python Security34686930820, Trusted uv Materializer34686930788, Security34686930789, and SAST34686930806are GREEN. CodeQL34686930801is terminal failure only because actions job103535474643and python job103535474644both haveDISPATCH_OUTCOME=success,VERDICT_STATE=pending; no leaf source finding is inferred.Landing gate
Current-head review at
85522306949bada2b5939608dc911f6374125f1bconfirms the merge-forward itself is valid but the protected-main pre-cutover handler and this post-cutover client cannot yet validate one another. Keep Draft until a backward-compatible protected bootstrap, provenance-bound temporary legacy discovery, one run-wide settlement owner with split-wake fixture, ADR-0025/gap removal condition, ordinary restack, and fresh terminal CodeQL evidence are present. Normal merge requires terminal applicable checks, zero valid unresolved findings, and a qualifying independent current-head approval. No self-approval, auto-merge authorization, protection bypass, manual-rerun loop, synthetic status, force update, destructive rebase, source-neutral commit, predecessor-success transfer, or valid-delta close.Exact protected-handler prerequisite — 2026-09-12
The canonical owner prerequisite is now #2106 at exact head
50adc03d2afbe4a370782e9b7985636f0fcf12fc, based on protectedmain@fb17ef556f94f673234aa557254ae52779e9a7b0; its two parents are the prior canonical head2c163e92983156739bdeeac87bd8c21383c38145and complete overlapping predecessor #2105 headfde889ad611054cad0c1be5a14289b7eb881b124. It stages the backward-compatible v1/v2 handler, one shared concurrency owner, one run-wide settlement mutation, exact producer/base/head/ordered-parent provenance, split-language evidence, legacy-removal condition, and the credential-response isolation repair. Overlapping #2105 is Draft and remains evidence-preserving until protected integration is verified.Keep this consumer/producer stack Draft. After #2106 lands through ordinary protection, non-force merge-forward this branch onto the new protected tip, switch the producer to the versioned event, and require fresh exact-head terminal CodeQL plus independent review. The queued runs created by the corrected Ready transition do not waive this dependency and cannot authorize merge.