Skip to content

Fix Windows thread-view perf tests timing below the CPU clock tick - #5791

Merged
ymichael merged 1 commit into
mainfrom
bb/fix-red-ci-thr_9diqdhz222
Oct 19, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/fix-red-ci-thr_9diqdhz222

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Windows tests (packages-other) has failed on main since #5684 (3fcefa7), for example run 39330820112. Three ratio assertions in packages/thread-view/test/tool-call-parsing-performance.test.ts fail with AssertionError: expected 0 to be less than 0. #5684 shrank the benchmark workloads below the new 2,048-character summary cap, so each sample now uses about 0.1–30 ms of CPU. On Windows, process.threadCpuUsage() comes from GetThreadTimes, which advances in ~15.6 ms scheduler ticks. The cheap and expensive minimums both read 0, and 0 < 0 / n fails. Windows tests were skipped on #5684's PR (frontend-only selection), so the failure first showed up on main.

The other red jobs on main in the same window (app-1, app-3, server-2, Checks, Package Smoke, Provider Model Listing, Node Compatibility Smoke, Linux packages-other) are infra. The pnpm tarball download (curl: (28) Operation timed out) or Install dependencies hit their timeouts before any tests ran. One earlier Windows run also had a provider-bridge-acp-next timeout followed by EBUSY; that run did not repeat it.

What changed

  • The three ratio tests (write-first short-circuit, summary cache reuse, quoted thread-message scan) now time with performance.now(). Its resolution is sub-millisecond on every OS. The tests interleave the cheap and expensive workloads and keep each one's fastest of seven samples, so preemption and load affect both sides alike. Workloads, repeat counts, and ratio thresholds are unchanged.
  • The absolute 500 ms bound in the unterminated-heredoc test keeps threadCpuUsage; one tick does not matter at that scale.

Test-only change.

How you verified

  • pnpm exec turbo run test typecheck --filter=@bb/thread-view: 498/498 tests pass.
  • Red check: with the shell-intent cache lookup disabled in src/tool-call-parsing.ts, reuses shell summaries across repeated timeline builds fails. The cache regression the test exists for is still caught.
  • Stability: 40/40 passes of the file, run as four concurrent loops to simulate a loaded runner.
  • Measured local per-repeat costs (cheap vs expensive): 3.3 vs 50 µs (15×, asserts 8×), 16 vs 3,470 µs (220×, asserts 5×), 48 vs 299 µs (6.2×, asserts 4×).
  • A full-CI workflow_dispatch run on this branch covers the Windows shards; see the PR checks/comments.

AGENT GENERATED

🤖 Generated with Claude Code

#5684 shrank the parser benchmark workloads below the 2,048-character
summary cap, so each threadCpuUsage sample now takes less CPU than one
Windows scheduler tick (~15.6 ms). Both minimums read 0 there and the
ratio assertions fail with "expected 0 to be less than 0", turning
Windows tests (packages-other) red on main.

Measure the three ratio tests with performance.now(), interleaving the
cheap and expensive workloads and keeping each one's fastest of seven
samples so load affects both sides alike.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit a296678 into main Oct 19, 2026
75 of 78 checks passed
@ymichael
ymichael deleted the bb/fix-red-ci-thr_9diqdhz222 branch October 19, 2026 22:23
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