Skip to content

[CI] Fix unsafe test fixtures and the Bun version pin - #26051

Merged
nwparker merged 8 commits into
mainfrom
nwparker/ci-shard-two-runner-shutdown
Oct 7, 2026
Merged

nwparker merged 8 commits into
mainfrom
nwparker/ci-shard-two-runner-shutdown

Conversation

@nwparker

@nwparker nwparker commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

The runner memory fix is already on main in #26049. This follow-up prevents test fixtures from signalling unrelated processes, makes CI honor its Bun version pin, verifies that the optimized import check retains the original dependency records, and makes a transcript fixture apply full replacement snapshots correctly.

The import-check implementation, its existing tests, and the structured-session host match main exactly.

What Changed

  • Verify an interruption target is the apply-script fixture's own ancestor before signalling it. Reject empty, failed, invalid and unrelated process lookups. Mock fictional provider process-group signals, including the default ESRCH path.
  • Apply transcript replacement snapshots as authoritative windows in the fixture, matching desktop and mobile consumers. Count append deliveries separately and retain the larger-rewrite, followup and message-uniqueness checks. Add a controlled timestamp-only replay case.
  • Rename the canonical pin to config/.bun-version, a filename the pinned setup-bun action recognizes. Update both workflows and contributor guidance.
  • Add a regression comparing the original and optimized CommonJS input records, including conditional packages, dynamic imports, Electron subpaths, require.resolve, native addons and injected imports. Main already supplies the shared-output bound test.

Before/after measurements

Safe reproduction / check Before After Improvement
Empty, failed, zero, negative or unrelated ancestor census; five VM scenarios, all signals intercepted 5 unsafe signal requests 0 signal requests All five unsafe requests refused
Legitimate fixture-owned ancestor census 1 signal to the owned PID 1 signal to the owned PID Interruption/recovery coverage retained
Controlled timestamp-only replay under both runtimes Valid replay fails the cumulative UUID-once assertion One visible new message, zero new append deliveries Fixture matches the authoritative replacement contract
Workflow version-file settings recognized by the exact setup-bun parser 0/2 2/2 resolve 1.4.2 with zero warnings Both workflows honor the canonical pin

A controlled metadata replay also reproduced the old transcript assertion under both Bun and Node: two valid full replacement snapshots containing the same ID were accumulated as two appends. The corrected fixture replaces its current window and checks append deliveries separately. This reproduces a valid interleaving, not proof of the precise CI interleaving or a Bun defect.

These measure fixture safety and version selection. This follow-up claims no additional suite-speed improvement; #26049 owns the landed memory optimization and its before/after measurements.

Why

We verified eight runner shutdowns across four PRs, 250.877–355.201 seconds after test-step start, without a preceding logged assertion failure. Failed and completed attempts used the same Node and Bun versions.

Temporary instrumentation captured an esbuild process reaching 12.75 GiB RSS before a kernel-generated kill signal and systemd termination of the runner. A corrected qualification run completed all five shards, with maximum sampled esbuild RSS 327 MiB and over 10.9 GiB sampled available memory. See the captured failure and corrected qualification. These runs preceded this branch adopting the equivalent optimization now on main; they are investigation evidence, not a new performance claim for this PR. Five-second samples can miss peaks, and the initiating OOM or hosting policy was not recorded.

The unsafe fixtures are separate hazards. Both were outside shard 2 in the PR 25430, 25624 and 26034 snapshots; an older PR 26006 assignment included the provider fixture on shard 2. They cannot explain the repeated pattern by themselves. The fixture checks reject unsafe targets without changing production teardown. The graph regression protects the CommonJS coverage retained by #26049; ESM splitting was rejected because it dropped require.resolve metadata.

The investigation recorder is removed from this PR. Review found that cancellation of its direct Node child could leave Bun descendants running. Since it has already supplied the incident evidence, shipping a new process-tree cleanup feature would add unnecessary scope. Ordinary CI continues to use its existing test command directly.

The first reduced-scope CI run completed all 11,365 selected files exactly once: 11,229 passed, 135 skipped, one failed, and zero unhandled errors. Four shards and every non-unit check passed. The sole failure was the unchanged transcript fixture described above; the final run after correcting it passed, as recorded below.

Linked Issue

Slack incident report. Related fix: #26049.

Visual Proof

N/A — test fixtures and CI version selection have no rendered UI change.

Testing

  • After merging current main, five focused files passed 87/87 cases under both Bun and Node, with identical case/status outcomes and no skips or failures. This includes the real-tree baseline, injected Electron rejection and fixture interruption/recovery.
  • Node typecheck passed after reconciling main; every incoming main change is preserved.
  • After removing the recorder, unchanged timing reporting and preflight phase contracts passed 42 cases. Changed-code quality passed with zero new findings across eight code files after the transcript fixture correction.
  • Exact pinned setup-bun parser: both workflow paths resolve 1.4.2 without warnings. Live preflight confirms the hidden version file is read successfully.
  • Historical 04ba qualification: the corrected full selection retained all previous 11,352 files plus the new graph file, reported each exactly once, and passed all five shards with zero unhandled errors. Windows boundary checks also passed. This is historical evidence, not final-head CI clearance.
  • Corrected transcript fixture: all four modes pass under both Bun and Node with identical outcomes and zero skips. Controlled before/after traces retain two full replacement publications, zero new-message appends and one followup append; the current view contains each final message once. The old cumulative-history assertion fails this valid replay; the corrected view/raw-append assertions pass.
  • Final head 975d226 automated review: CodeRabbit explicitly reviewed this commit, found no actionable comments, and all threads are resolved.
  • Final full CI, synthetic source 9fd0ec2: all five unit shards passed. All 11,368 selected files were reported exactly once: 11,233 passed, 135 existing skips, zero failures and zero unhandled errors. Every previous 11,365 file remains, plus three new main tests. The corrected watcher passed all four cases; both graph regression modules passed.
  • Final static/typechecks, mobile bundle, Linux and Windows packaging, and all non-unit contracts passed. The combined CI source retains all 70 incoming main paths, and both workflows read the hidden Bun pin successfully.

Review

Fixture signal ownership, replacement-snapshot semantics and import-record coverage passed independent reviews. The optional recorder and all reporting/workflow instrumentation have been removed to address its cancellation finding. Main's landed implementation is preserved. No production teardown or remote-execution behavior changes.

Agent skill upstream boundary

  • Not applicable; no upstream skill code or registry content copied.

Notes

The new interruption checks run inside the existing guest-shell fixture and signal only its verified owned process. The version-file rename preserves Bun 1.4.2. Linux, macOS, Windows and SSH production behavior remain unchanged.

Checklist

  • Explained the observed failure, changes, mechanism and approach.
  • Before/after measurements included for this PR's actual scope.
  • Visual proof marked N/A with reason.
  • Cross-platform and SSH impact considered.
  • Main's landed optimization preserved; redundant implementation removed.
  • Investigation instrumentation removed.
  • Final aggregate and all 30 check contexts passed; merged as 76d480f8081e0ef5f6529db1506bc989f42e6cef after matching qualified head 975d226 on 2026-10-07 at 04:42 UTC.

@nwparker nwparker changed the title Safeguard test signals and capture unit runner shutdowns Avoid duplicating bundles in the runtime import check Oct 7, 2026
@nwparker
nwparker marked this pull request as ready for review October 7, 2026 03:35
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 594eb5ea-bec0-4c27-ac96-68e50886860f
📥 Commits

Reviewing files that changed from the base of the PR and between c06a026 and 975d226.

📒 Files selected for processing (1)
  • src/main/native-chat/transcript-watch-inplace-drain-race.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The changes add tests for Electron import-graph coverage, POSIX provider teardown, and transcript watcher replay. They add a shared script that validates process ancestry before signaling, then use it in generated drain-interruption shims. Contributor instructions, CI workflows, and the Vitest startup error now reference config/.bun-version.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 975d2

No actionable issue is identified in the reviewed change; it is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 50 functions across 15 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed No active directly linked issue remains. Issue #26049 is closed and completed, so it supplies background only. No linked-issue coding requirements apply.
Out of Scope Changes check ✅ Passed The changes match the PR's stated scope. The interruption script and harness verify and signal only a fixture-owned ancestor. The provider teardown test covers mocked signal behavior. The transcript t…
Title check ✅ Passed The title clearly summarizes the unsafe test-fixture safeguards and Bun version pin changes. It does not mention the additional regression coverage, but it identifies the main changes.
Description check ✅ Passed The description includes the required sections and explains the changes, rationale, linked context, testing, visual-proof status, and compatibility considerations. It also reports that final aggregate…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@nwparker nwparker changed the title Avoid duplicating bundles in the runtime import check Guard test signals and fix the Bun version pin Oct 7, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8dab7580-0b1a-4330-9bcc-007b63a01afc
📥 Commits

Reviewing files that changed from the base of the PR and between 41acd90 and b34bbfe.

📒 Files selected for processing (16)
  • .github/CONTRIBUTING.md
  • .github/scripts/unit-runner-diagnostics.py
  • .github/scripts/unit-runner-diagnostics.test.py
  • .github/workflows/pr.yml
  • .github/workflows/unit-tests.yml
  • config/.bun-version
  • config/scripts/check-runtime-electron-ratchet-graph.test.mjs
  • config/scripts/ci-unit-timing-reporter.mjs
  • config/scripts/ci-unit-timing-reporter.test.mjs
  • config/scripts/pr-preflight-gates.test.mjs
  • config/scripts/run-vitest.mjs
  • src/main/codex-accounts/legacy-wsl-runtime-auth-drain-interruption-source.test.ts
  • src/main/codex-accounts/legacy-wsl-runtime-auth-drain-interruption-source.ts
  • src/main/codex-accounts/legacy-wsl-runtime-auth-drain-script-harness.ts
  • src/main/codex-accounts/legacy-wsl-runtime-auth-drain-script-interference-shims.ts
  • src/main/provider-process/provider-process-teardown.test.ts
💤 Files with no reviewable changes (1)
  • config/.bun-version
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/CONTRIBUTING.md
  • config/scripts/run-vitest.mjs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@nwparker

nwparker commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nwparker nwparker changed the title Guard test signals and fix the Bun version pin Fix unsafe test fixtures and the Bun version pin Oct 7, 2026
@nwparker
nwparker merged commit 76d480f into main Oct 7, 2026
30 checks passed
@nwparker nwparker changed the title Fix unsafe test fixtures and the Bun version pin [CI] Fix unsafe test fixtures and the Bun version pin Oct 9, 2026
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