Skip to content

test: pay the Pi fixtures' first exec before timing them - #16028

Merged
austinywang merged 1 commit into
mainfrom
15488-pi-fixture-priming
Sep 30, 2026
Merged

austinywang merged 1 commit into
mainfrom
15488-pi-fixture-priming

Conversation

@austinywang

@austinywang austinywang commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

The Pi extension tests no longer lose a race with macOS's first-run check. tests/test_pi_extension_dispatch.py failed three times on fleet minis with FAIL: timeout harness missed a serialized command: ['start second', 'end second'], and tests/test_pi_extension_install.py once with generated Pi extension is not importable. In each case a freshly written fixture's first exec was held past the extension's timer. Each fixture now pays that check before any timed run. This is the Pi part of #15488.

Cause

macOS holds the first exec of every newly written file while syspolicyd assesses it. On this Mac a fresh script's first exec takes about 200 ms, and later ones take 5–20 ms. First execs happening at the same time queue about 185 ms apart, so a few fresh executables anywhere on a loaded mini push one past a second.

  • Dispatch, check_timeout_serialization: the extension times each child from spawn and sends SIGTERM at CMUX_PI_HOOK_TIMEOUT_MS=1000. The fake timeout-cmux logs start before it installs its SIGTERM handler. A log of ['start second', 'end second'] with no overlap second therefore means the first child was killed by SIGTERM's default action before its first line ran.
  • Install: the real stderr in run 36632828304 was timed out waiting for hooks pi prompt-submit, a 5 s wait. The fresh fake cmux runs for the first time inside that wait.

Failures on the fleet:

Change

make_executable in both files adds a guard right after the shebang, in bash, node or Python form, so the fixture exits at once when CMUX_TEST_PRIME_EXEC is set. It then runs the fixture once that way, with only PATH and that key set. This is the pattern #15768 and #15955 use. No timeout, budget or assertion changes.

Verification

The dispatch checks ran under bun on this Mac, against the extension source assembled from the CLI/ strings; nothing was built.

Scenario Before After
Timeout check, 1.5 s artificial first-exec delay 3 of 3 fail with the CI message 3 of 3 pass
Timeout check, 10 fresh scripts exec'd at the same time (real queueing, no emulation) 2 of 2 fail with the CI message 2 of 2 pass
All 35 checks, 5.5 s delay on every fixture 13 fail all pass
Full dispatch file, no delay pass, 27.3 s pass, 30.0 s

An artificial first-exec delay of 5.5 s reproduces the install test's exact error, and the fixed file passes under the same delay. The whole install file needs a built CLI, so it wasn't run here.

Coverage. Both files run only in the macOS CLI product tests lane, which this PR skips because it changes only Python tests. The #15488 full-suite validation ran them with this change on cmuxs-mac-mini-5, where both had failed in run 36632828304: tests/test_pi_extension_install.py ok in 22.4s and tests/test_pi_extension_dispatch.py ok in 30.7s, with all 84 lane tests passing (job).

Changelog

  • none

🤖 Generated with Claude Code

The dispatch test's timeout-serialization check failed three times on the
fleet (runs 36477723258, 36632828304 and validation run 36713362165) with
['start second', 'end second']: the extension's 1000 ms hook timer sent
SIGTERM to the first fake cmux before it ran a line, because macOS held the
freshly written script's first exec while syspolicyd assessed it. Measured
here, a fresh script's first exec takes about 200 ms and a second about 5-20
ms, and concurrent first execs queue about 185 ms apart, so a few fresh
executables anywhere on a loaded mini push one past 1 s. The install test's
"generated Pi extension is not importable" failure (run 36632828304, stderr
"timed out waiting for hooks pi prompt-submit") is the same class: the fake
cmux's first exec lands inside a 5 s wait.

Every fixture now exits at once when CMUX_TEST_PRIME_EXEC is set and is run
that way as soon as it is written, as #15768 and #15955 did for the Hermes
and Claude wrapper fixtures. No timeout, budget or assertion changes.

Refs #15488

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: manaflow-ai/cmux/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: b49625d6-af93-485d-b1e9-775e7f430fc8

📥 Commits

Reviewing files that changed from the base of the PR and between aed397a and 166be47.

📒 Files selected for processing (2)
  • tests/test_pi_extension_dispatch.py
  • tests/test_pi_extension_install.py

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 dispatch and install test modules now prime generated executable fixtures. Each fixture includes a language-specific early-exit guard and runs with a priming environment variable, suppressed standard streams, and a 120-second timeout.

Changes

Executable Fixture Priming

Layer / File(s) Summary
Prime generated executable fixtures
tests/test_pi_extension_dispatch.py, tests/test_pi_extension_install.py
Both test modules add a helper that runs generated executables with a priming environment variable. Their fixture builders insert an early-exit guard and prime each executable after writing it and setting permissions.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to 166be

The change primes generated fixtures while preserving their ordinary test behavior. No merge-blocking risk is established.

🚥 Pre-merge checks | ✅ 24 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (24 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Cmux Cloud Persistent Session And Early Input ✅ Passed PASS: The diff only changes two Pi extension test helpers. It adds fixture priming via prime_first_exec and an early-exit environment guard before timed test runs. It does not change Cloud terminal …
Cmux Swift Actor Isolation ✅ Passed PASS: The reviewed diff changes only tests/test_pi_extension_dispatch.py and tests/test_pi_extension_install.py. It adds Python test-fixture priming logic and makes no production Swift changes, so…
Cmux Swift Blocking Runtime ✅ Passed PASS: The pull request changes only two Python test files and adds deterministic fixture priming via subprocess.run; it introduces no production Swift changes. The custom check explicitly passes tes…
Cmux Browser Automation Off-Main ✅ Passed PASS: The pull request changes only tests/test_pi_extension_dispatch.py and tests/test_pi_extension_install.py. The diff adds executable priming for test fixtures and contains no browser.* socke…
Cmux Expensive Synchronous Load ✅ Passed PASS: The pull request changes only two Python test files: tests/test_pi_extension_dispatch.py and tests/test_pi_extension_install.py. It adds executable priming helpers and fixture guards. It add…
Cmux Cache Substitution Correctness ✅ Passed PASS: The authoritative PR diff changes only tests/test_pi_extension_dispatch.py and tests/test_pi_extension_install.py, both Python test files. It does not change production Swift, TypeScript, or…
Cmux No Hacky Sleeps ✅ Passed PASS. The PR changes only tests/test_pi_extension_dispatch.py and tests/test_pi_extension_install.py. The new subprocess.run(..., timeout=120) priming and immediate-exit fixture guards are expli…
Cmux Algorithmic Complexity ✅ Passed PASS. The PR changes only tests/test_pi_extension_dispatch.py and tests/test_pi_extension_install.py. The added prime_first_exec and make_executable logic is test-only fixture scaffolding. The…
Cmux Swift Concurrency ✅ Passed PASS: The pull request changes only tests/test_pi_extension_dispatch.py and tests/test_pi_extension_install.py, both Python files. The diff introduces no cmux-owned Swift code and therefore does n…
Cmux Swift @Concurrent ✅ Passed The pull request changes only tests/test_pi_extension_dispatch.py and tests/test_pi_extension_install.py, both Python files. It introduces no Swift code or @concurrent annotations, so this Swift…
Cmux Swift Package Boundaries ✅ Passed The pull request changes only two Python test files: tests/test_pi_extension_dispatch.py and tests/test_pi_extension_install.py. The review-scoped diff contains no Swift, SwiftPM, or Package.swift cha…
Cmux Swiftpm Lockfiles ✅ Passed PASS: The PR changes only tests/test_pi_extension_dispatch.py and tests/test_pi_extension_install.py. It does not change a SwiftPM package, Package.swift, .gitignore, workflow, dependency pin,…
Cmux Swift Logging ✅ Passed The pull request changes only two Python test files: tests/test_pi_extension_dispatch.py and tests/test_pi_extension_install.py. The diff contains no Swift or Objective-C files and adds no product…
Cmux User-Facing Error Privacy ✅ Passed PASS — The pull request changes only tests/test_pi_extension_dispatch.py and tests/test_pi_extension_install.py. The added CMUX_TEST_PRIME_EXEC handling and syspolicyd references are confined …
Cmux Full Internationalization ✅ Passed PASS: The authoritative diff changes only tests/test_pi_extension_dispatch.py and tests/test_pi_extension_install.py. The changes add test-fixture priming and do not modify production user-facing …
Cmux Swiftui State Layout ✅ Passed The pull request changes only two Python test files. The authoritative diff contains no Swift files and no SwiftUI state or layout constructs. The SwiftUI state-layout check is therefore not applicabl…
Cmux Architecture Rethink ✅ Passed PASS: The diff changes only two Python test files. It adds executable priming before timed test runs. The rule explicitly allows test-only synchronization. The diff adds no Swift code, UI lifecycle ow…
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PASS. The pull request changes only two Python test files: tests/test_pi_extension_dispatch.py and tests/test_pi_extension_install.py. The diff contains no Swift or window implementation changes. …
Cmux Source Artifacts ✅ Passed The PR changes only tests/test_pi_extension_dispatch.py and tests/test_pi_extension_install.py. The diff adds hand-written test helpers and fixture setup for macOS first-exec priming. It does not …
Cmux No Test Or Debug Seam In Production Source ✅ Passed PASS: The pull request changes only tests/test_pi_extension_dispatch.py and tests/test_pi_extension_install.py. It adds Python test-fixture priming code and changes no Swift file under a productio…
Title check ✅ Passed The title clearly and concisely describes the main change: priming Pi test fixtures before timed execution.
Description check ✅ Passed The description clearly explains the failure, root cause, implementation, verification results, affected files, and internal-only changelog. It uses a Verification section instead of the template's Te…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@austinywang
austinywang merged commit e0d5c5e into main Sep 30, 2026
55 of 56 checks passed
@austinywang
austinywang deleted the 15488-pi-fixture-priming branch September 30, 2026 16:00
@github-actions

Copy link
Copy Markdown
Contributor

Merge receipt for 166be47e9d: every check was green at merge (12 verified; 16 skipped by policy). Full suite runs on main after merge.

rustybret pushed a commit to rustybret/bmux that referenced this pull request Sep 30, 2026
e709b69 fix(cloud): stop reconciling panes a Cloud workspace already shows (manaflow-ai#16025)
d13dde3 Diff viewer: viewed state, file filter, generated and large diffs collapsed (manaflow-ai#15536)
e0d5c5e test: pay the Pi fixtures' first exec before timing them (manaflow-ai#16028)
e2e0b61 ci: disable unstable UI test dispatch lane (manaflow-ai#16075)
15996b0 ci: sweep side lanes instead of rescuing workflow runs (manaflow-ai#16076)
3dcf462 Recover terminal chat when transcript files are replaced (manaflow-ai#16045)
272d069 fix(agent-chat): let Stop cancel a queued or starting ACP turn (manaflow-ai#15925)
30bd116 test: cover invalid unquoted Xcode extension paths (manaflow-ai#16054)
a24a1b5 Make GitHub references in the agent chat transcript clickable (manaflow-ai#15916)
86d1cfc Reap failed Codex app-server startups before retrying (manaflow-ai#15977)
890cd1e fix(sidebar): expose workspace close button to accessibility (manaflow-ai#15965)
faf4c8f docs: define agent fan-out and reusable Cloud work environments (manaflow-ai#15836)
ab20b79 ci: cut cmux-tui Testbox warmup hold time (manaflow-ai#15557)
31fb228 Promote devbox images with cmux-tui 7d17754 (VT replay blank-cell fix) (manaflow-ai#16072)
e0da0a6 feat(acp): cmux as a read-only ACP host, phase 1 (manaflow-ai#15976)
3ed1d77 Reap failed ACP startups and temporary catalog probes (manaflow-ai#15979)
f5c3567 Add a Focus TextBox Input item to the View menu (manaflow-ai#15730)
b3a1ca1 Document the 32 CLI verbs the contract table was missing, and guard it (manaflow-ai#15993)
3bba04e Say which app-host result file could not be read (manaflow-ai#15997)
7ef6d3a Resume Cloud Codex chats after app-server restart (manaflow-ai#15915)
a803f36 fix: surface simulator process output reader failures (manaflow-ai#15880)
f6a0163 Keep terminal approval notices from moving the composer (manaflow-ai#15886)
b8ab767 test: isolate feature flag defaults between runs (manaflow-ai#15587)
5150a9b Keep unsent cloud prompts recoverable (manaflow-ai#15902)
233bd6d Restore terminal attention when transcript chat reconnects (manaflow-ai#15891)
573f998 Resolve a dogfood menu path against the direct children of each open menu (manaflow-ai#15923)
7b7a1b2 test(ci): assert the registry guard's exit code, and handle merge_group (manaflow-ai#16017)

# Conflicts:
#	.github/workflows/ci-guards.yml
#	.github/workflows/ci-owned-pool-rescue.yml
#	.github/workflows/ci-ui-tests.yml
#	.github/workflows/ci.yml
#	.github/workflows/cmux-tui-testbox-warmup.yml
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