Skip to content

[CI] Speed up terminal probe tests with controlled policy clocks - #26327

Merged
nwparker merged 1 commit into
mainfrom
nwparker/terminal-wait-policy-clocks
Oct 7, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/terminal-wait-policy-clocks

Conversation

@nwparker

@nwparker nwparker commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Two terminal approval tests now advance a controlled clock instead of waiting for real two-second probe deadlines. The same 27 tests and production behavior remain covered.

What Changed

After each test creates its terminal pane, fake only Date, setTimeout and clearTimeout while checking the injected foreground probe that intentionally never answers. Advance the existing production timeout constant, await the original results, and restore real timers in finally and afterEach. Other 25 test callbacks and every case name remain unchanged. Production code, native setup and real process checks are untouched.

Why

The probes are fully injected; elapsed desktop time adds no evidence to their timeout policy. Advancing that policy clock preserves the full deadline and single-flight assertions while removing roughly six seconds of deliberate waiting. Shorter production deadlines or dropped tests would weaken coverage.

Linked Issue

N/A — internal test performance work.

Visual Proof

N/A — test-only change; no rendered UI or interaction behavior changes.

Testing

  • Typecheck (pnpm tc:node), targeted formatting, changed-code quality and diff checks pass on base 0f9f1993223f90991db9c60fe6e30ce2b7abcb78.
  • Isolated Linux ARM qualification: Node 24.21 / Bun 1.4.2, Vitest 5.0.3, two shuffled seeds each; original → shipping → boundary audit, all 12 commands pass all 27 cases. Exact case identities/statuses, source, routes, settings and natural-close evidence agree. The audit also checks all three waits remain pending at 1,999ms and settle after the final millisecond, with no remaining fake timer records. It does not claim the intentionally wedged underlying probe settles.
  • Measured held-runner trial: all six whole-pnpm test samples pass all 27 cases; all source/configuration/routing and natural-close checks pass. Root independently replays the preserved collector and verifies every raw artifact hash.
  • Current-main full PR CI and exact-head bot review pass. All 35 contexts are successful or stock-skipped; package checks are skipped for this test-only change. No local native runtime tests launched; real native contracts stay in isolated CI. All CI tests use ORCA_BACKGROUND_LAUNCH=1.

Before/after measurements

Three counted pairs on one held Linux ARM runner with four CPUs, stock four workers, isolation enabled, six setups, and Vitest filesystem module cache disabled. Node 24.21, Bun 1.4.2 (744846f84), Vitest 5.0.3; frozen measured source 29ad785b1cd000b580ba3b3da87affb835a601ad.

Pair Before (seconds) After (seconds) Less time
1 19.822240 14.131238 28.71%
2 20.104343 14.051790 30.11%
3 19.997765 14.143293 29.28%
Mean 19.974783 14.108774 29.37% (1.416×)

Order: before/after, after/before, before/after. Every first command and slow sample is retained; no warmup, retry, discard or report normalization. Commands share Bun/runtime and OS caches, so arms are not independently cold even with Vitest filesystem cache off. These measurements apply to this single-file cohort; they do not establish a full-suite speedup, fleet latency or the overall 2× goal. The current target and relevant runtime dependencies retain the measured bytes; unrelated Node runtime registry additions are retained on current main. Full current integration still needs CI.

Review

Clock ownership, original assertions, timeout boundary, rejection observation and restoration were independently checked. No production timer, process cleanup, runtime contract or test exclusion changes.

Agent skill upstream boundary

  • Not applicable.

Notes

The test policy is platform-independent and uses the existing runtime harness. No SSH host ownership, folder workspace, mobile or wire behavior changes. Linux ARM runtime qualification is measured; Windows/macOS execution is not inferred from it.

Checklist

  • Small and focused; before/after, mechanism and alternatives explained.
  • N/A visual proof explained.
  • Self-reviewed for correctness, security and performance.
  • Cross-platform and SSH impact considered.
  • Full PR CI and exact-head review complete before merge.

Final integration and review evidence

Full run 37687898131, attempt 1, tests synthetic source 3981dbe4c44c956373adad2321fd7780058a1222 with parents current main 0f9f1993223f90991db9c60fe6e30ce2b7abcb78 and shipping head d504992b80552ef3d21a5290c57181cbaf6d765d. Its tree equals the shipping tree; only the one qualified test file differs from incoming main. The measured original/candidate test bytes remain exact.

Root read all ten raw logs and assignment/timing artifacts and compared them with actual stock discovery: 11,700 physical files appear exactly once, 11,560 passed and 140 stock-skipped; 112,846 passed cases, three expected failures and 1,052 skips, with zero failed cases or unhandled errors. The changed file runs under Bun and passes all 27 cases. Upstream main adds 14 paths and retires 29 between the earlier 7b revision and this base; those main changes are preserved, and none are deleted by this PR. Counts do not imply full cross-revision named-case equivalence: stock full-CI artifacts provide aggregates, while complete original/candidate target identities were separately checked in the 12-command runtime qualification.

CodeRabbit explicitly reviews 0f9f1993… → d504992b… and reports zero actionable comments. The final review-thread query has zero threads and no omitted page. Independent peers and root separately verify every six-sample raw measurement/source/configuration/routing/natural-close gate; the table above is already present before merge, and all samples remain retained. These are cohort measurements on their frozen source, not a new measurement from this integration run.

Actual merge source

Merged at 21:38:56 UTC as 31a5b42b0d272526c405458154eea932cd0ded8e. Two concurrent upstream PRs, #26071 and #25947, advanced main after the qualified CI base; the actual squash parent is 661cba999e65350f7abdbdb98988fe55af4c2d5c. The merged tree therefore differs from the earlier tested synthetic tree. Root confirms this merge changes only the one qualified test file relative to that actual parent, preserves the exact shipping candidate bytes, and retains every named dependency/configuration guard from the premerge source assessment. The qualified CI coverage counts above remain observations on 3981dbe4…; they are not a claim that additional concurrent upstream tests ran in that earlier run. The before/after table was published and verified before merge and remains unchanged.

@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: 0c823f7f-fdf5-4862-a539-03319bab2360
📥 Commits

Reviewing files that changed from the base of the PR and between 0f9f199 and d504992.

📒 Files selected for processing (1)
  • src/main/runtime/terminal-interactive-wait-visibility.test.ts

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


📝 Walkthrough

Walkthrough

The interactive-wait visibility tests now use fake timers to reach the configured probe timeout. The concurrent-request test still checks that only one foreground probe runs. The wedged-probe tests check that the wait resolves to undefined and that showTerminal omits agentWait. An afterEach hook and finally blocks restore real timers.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to d5049

The timeout tests retain their stated assertions while avoiding real-time waits. No identified issue prevents merging after normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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.
Title check ✅ Passed The title clearly and concisely describes the main change: speeding up terminal probe tests by using controlled policy clocks.
Description check ✅ Passed The description is detailed and covers the change, rationale, testing, performance measurements, visual proof, review notes, compatibility considerations, and checklist. It marks the linked issue as n…
✨ Finishing Touches
📝 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 merged commit 31a5b42 into main Oct 7, 2026
35 checks passed
@nwparker nwparker changed the title Speed up terminal probe tests with controlled policy clocks [CI] Speed up terminal probe tests with controlled policy clocks 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