Repository navigation
Description
Discovered while running the mandatory post-merge CI check on main after merging PR #2305 (issue #2075, a docs-only fix to two skill markdown files with zero src//crates/ changes).
Symptom
Post-merge CI on main for commit 039141b (PR #2305) failed on Test Node 22 (macos-latest) and Test Node 22 (ubuntu-latest) with real (non-flaky-looking) assertion failures in tests/graph/cycles.test.ts — cycle member arrays coming back in reverse-alphabetical order instead of the sorted order the test expects, e.g.:
AssertionError: expected [ [ 'c.js', 'b.js', 'a.js' ] ] to deeply equal [ [ 'a.js', 'b.js', 'c.js' ] ]
This is the exact symptom issues #2064/#2067/#2076 described and PR #2292 fixed (sorting each Tarjan SCC's node array at the point it is collected, in both engines). That fix is on main — but the test run exercised behavior from before the fix.
Root cause
.github/workflows/ci.yml'sdetect-changesjob ("Detect native-relevant changes") diffsHEADagainst the last published-release tag (v$(node -p "require('./package.json').version")) to decide whethernative-host-buildneeds to run, or whether it's safe to test against the already-published npm native addon.native-host-build's guard isif: needs.detect-changes.result != 'success' || needs.detect-changes.outputs.native_changed == '\''true'\''— written to fail open (build fresh) on anything other than a clean 'no native changes' verdict, per the comment: 'a broken change-detector can'''t silently hide a real Rust regression.'- In this run,
detect-changesitself was cancelled (never acquired a runner —runner_id: 0), almost certainly due to transient GitHub Actions runner-pool congestion (this same run needed 3 rerun attempts before most jobs got runners at all; annotations included "The job was not acquired by Runner of type hosted even after multiple attempts" and "Service Unavailable"). - GitHub Actions automatically skips a job'''s dependents when a
needsjob is cancelled, regardless of that dependent job'''s ownif:expression — this bypass is specific tocancelled, distinct fromfailure, and is not something a plain!= '\''success'\''check can override; only wrapping the condition inalways()(or explicitly checkingneeds.detect-changes.result == '\''cancelled'\'') makes a job still evaluate itsif:after a cancelled dependency. Sonative-host-buildwas skipped, not fail-open-triggered, exactly the case the comment says should never happen. Test Node 22'''s "Download PR-built native addon" / "Install native addon over published binary" steps are gated onneeds.native-host-build.result == '\''success'\'', which was false (skipped), so the job fell back to whatever native addonnpm installpulls from the published@optave/codegraph-{platform}-{arch}packages — which predates PR fix(cycles): sort each Tarjan SCC's node array for deterministic order (#2064) #2292'''s Tarjan sort fix (confirmed:git diff v3.16.0 origin/main -- crates/showscrates/codegraph-core/src/graph/algorithms/tarjan.rsand dozens of other native-relevant files changed since thev3.16.0tag).
Impact
Any commit that itself touches zero native-relevant files (like a docs-only PR) can show a false-looking post-merge CI failure on main, for behavior the current source tree has already fixed, purely because an unrelated upstream job in the same run got cancelled by runner-pool congestion. This is confusing and erodes trust in the mandatory post-merge CI check, and it defeats the explicit 'fail open' design intent documented in the workflow'''s own comment.
Suggested fix
Make native-host-build'''s (and any other job depending on detect-changes) if: condition evaluate even when detect-changes is cancelled — e.g. if: always() \&\& (needs.detect-changes.result != '\''success'\'' || needs.detect-changes.outputs.native_changed == '\''true'\''), or an explicit needs.detect-changes.result == '\''cancelled'\'' branch — so a cancelled change-detector fails open exactly like a failed one already does, matching the comment'''s stated invariant.
Verification that this is unrelated to PR #2305 itself
- PR fix(skills): replace zsh-unsafe for-in-$(...) loops with while/read (#2075) #2305 changed only
.claude/skills/resolve/SKILL.mdand.claude/skills/sweep/SKILL.md— zerosrc//crates//tests/changes. - Local
npm teston the exact merged tree passed 277/277 files, 4480/4480 tests. - PR fix(skills): replace zsh-unsafe for-in-$(...) loops with while/read (#2075) #2305'''s own dedicated CI run (pull_request-triggered, which did get a successful native-host-build) passed all 26 checks cleanly, including
Test Node 22on all three platforms andEngine parityon all three platforms. - Rerunning the post-merge run's failed jobs a third time got
Engine parityto pass cleanly on all three platforms (those don'''t depend on the published-vs-fresh native addon the same way); onlyTest Node 22 (macos-latest)/(ubuntu-latest)— the ones actually exercising the stale published addon — showed the ordering mismatch.
Activity