Skip to content

test(commandbar): judge CB-22's budgets on the best of up to three rounds - #17

Merged
siyabendoezdemir merged 5 commits into
mainfrom
lead/budgets
Oct 10, 2026
Merged

siyabendoezdemir merged 5 commits into
mainfrom
lead/budgets

Conversation

@siyabendoezdemir

@siyabendoezdemir siyabendoezdemir commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

CB-22's budget tests fail full runs on the shared test machine often enough to need a rerun in most merge gates. This PR judges them on the best of up to three measuring rounds (D46), and times the ranking bench in its thread's CPU time (D51). The budgets themselves don't change. It's stacked on PR #16 and changes test code only.

Why

  • Gate runs share a 16-core machine with up to three agents' test runs, at load averages of 25–50. Other work there can only add delay.
  • CB-22 failed the full runs of chrome's and settings' fix rounds and several of the lead's runs, and each time passed alone. The media lane's review saw main fail it 7 of 9 times on this machine.
  • In this PR's own check, at load 28, round 1 missed the paint budget (p95 64.8 ms against 50) and round 2 met it. The old test would have failed that run.

What

  • commandbar.spec.ts, "[CB-22][CB-07][FL-17] at 500 tabs and 10,000 history entries…":
    • The test measures in rounds. A round is four opens of the bar, with a query typed each time, as the whole test did before.
    • A round that misses any budget (results ≤ 30 ms per keystroke, painted ≤ 50 ms, open ≤ 50 ms) is measured again, up to three rounds. The test passes on the first round that meets them all; if none does, it fails on the last round's numbers.
    • Each retry runs in a fresh launch of the same seeded profile (2c9e366, review M1). The test closes Orbit, launches it again on the same 500 tabs and 10,000 history entries, and waits for history and the idle warm-up. Every round is then the bar's first use after a launch, as a user meets it. The test's timeout is 120 s.
    • The bar keeps only its last 100 timings, so each round clears them before it starts. Each round's numbers are logged.
  • commandbar.test.ts, "[CB-07][CB-22] ranks 500 tabs and 10,000 history entries in ≤ 30 ms per keystroke":
    • A run that misses the budget is measured again, up to three runs. The first run's warm-up round stays.
    • Each keystroke is timed in the thread's CPU time (process.threadCpuUsage()), and the same samples' wall p95 is logged beside it (D51, 9d9c314). Ranking never waits, so its CPU time is its whole cost; wall time on a loaded machine also counts other processes' turns. The e2e test still times the app in wall time.
    • On a Node before 23.9, which lacks threadCpuUsage, the bench uses the process's CPU time instead (engines allows Node 22). Its comment notes what CPU time can't see: a blocking wait, or work on another thread. It also notes that the clock moves in 1 ms ticks here (review F3–F5).

Test

Scratch variants (removed) kept main busy 40 ms in every 50:

Variant Result p95 keystroke → results (budget 30 ms)
Old e2e test, main busy during its one measurement fails 48.2 ms
First version (retries in the same app), main busy in round 1 only passes 46.6, then 11.2 ms
New e2e test, main busy in every round fails after 3 rounds 48.1, 45.7, 48.0 ms

Review M1. The review found that a retry in the same app measured a warmer app. With nothing injected, round 1 was slower than round 2 in 6 of 6 runs, so a slowdown confined to the first use after launch passed on round 2. The positive control for the fix keeps main busy 40 ms in every 50 during the first round after each launch:

Variant Result p95 keystroke → results
Same-app retries passes on round 2 52.3, then 13.4 ms
Fresh-launch retries (2c9e366) fails after 3 rounds 50.3, 51.8, 47.0 ms

Without anything injected, at load 26–37, the fixed test passed 3 of 3. One run needed a retry: round 1 painted at 50.3 ms against 50, and round 2 passed in its fresh launch at 41.7 ms.

  • Before D51, the unit test passed with a slow first run and failed after three slow runs (p95 43.6, 40.4, 39.7 ms).
  • D51 (9d9c314):
    • The stack's gate on 42c9819 failed the wall-time bench in all three runs at load 39 (p95 54.5, 30.3 and 51.6 ms). Alone it then passed 4 of 4.
    • Timed in CPU time, it passed alone and in four full unit runs at load 17–31: CPU p95 6.3–8.8 ms, while the same samples' wall p95 was 15.7–36.3 ms.
    • With a scratch 35 ms of CPU added to rank() for queries of 14 or more characters, all three runs fail at a CPU p95 of 39.3 ms.
  • commandbar.spec.ts: 36 passed. commandbar.test.ts: 30 passed. Lint and typecheck: exit 0.

Merge gate (D42)

Run locally on the Linux VPS on this PR's head, 581dbb1. It contains PR #16's head e4486e4, and merging main after #16 lands won't change its tree:

npm run build; npm run typecheck; npm run lint; ./node_modules/.bin/vitest run
xvfb-run -a -s "-screen 0 1440x900x24" ./node_modules/.bin/playwright test --workers 1 --retries 0 --reporter=line

Review

🤖 Generated with Claude Code


Note

Low Risk
Test-only changes to measurement and retry logic; no production command bar or ranking behavior is modified.

Overview
Stabilizes CB-22 performance gates on shared CI without changing the 30 ms / 50 ms budgets.

The e2e [CB-22][CB-07][FL-17] test now runs up to three measurement rounds (four bar opens + typing each). A round that misses any budget is retried after a fresh Orbit launch on the same seeded profile (500 tabs, 10k history), with launch / settle helpers and per-round clearing of __orbitCommandBar timings. The test passes on the first round that meets all budgets, otherwise fails on the last round; timeout is raised to 120s.

The unit ranking bench for 500 tabs / 10k history now asserts on thread CPU time (process.threadCpuUsage, with process.cpuUsage fallback) instead of wall clock, logs CPU and wall p95 per run, and re-runs up to three times if CPU p95 exceeds 30 ms.

Reviewed by Cursor Bugbot for commit 2c9e366. Bugbot is set up for automated code reviews on this repo. Configure here.

…unds (D46)

Gate runs share a 16-core machine with other agents' test runs, at load
averages of 25-50. Other work there can only add delay, and CB-22's budget
tests failed full runs often enough to need a rerun in most gates.

The e2e test now measures in rounds of four opens with a typed query each.
A round that misses any budget is measured again in the same app, up to three
rounds, and the test passes on the first round that meets them all. The bar
keeps only its last 100 timings, so each round clears them first. The unit
ranking benchmark does the same with up to three runs. The budgets are
unchanged.

Checked with main kept busy 40 ms in every 50 (scratch variants, removed):
- the old e2e test fails when main is busy during its one measurement
  (p95 to results 48.2 ms against 30);
- the new one passes when only its first round is slowed (46.6 ms, then
  11.2 ms);
- it fails when every round is slowed (48.1, 45.7, 48.0 ms).
The unit test passes with a slow first run and fails after three slow runs.

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

cursor Bot commented Oct 10, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 46cd1ffa-fc6e-4d5d-92bb-b2af6d881fcd)

No conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
siyabendoezdemir added a commit that referenced this pull request Oct 10, 2026
No conflicts.

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

cursor Bot commented Oct 10, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 679936bc-9b75-4efe-99a6-315c59b6cfc7)

… (D51)

The stack's gate on PR #19's head (42c9819) failed this bench. At a load average of 39, beside vitest's
other workers, all three runs missed the 30 ms p95 in wall time (54.5, 30.3 and 51.6 ms; medians 9-17 ms).
Alone it passed 4 of 4. Ranking is synchronous and never waits, so its cost is its thread's CPU time; wall
time on a loaded machine also counts the turns other processes get. The bench now times each keystroke
with process.threadCpuUsage() and logs the wall p95 of the same samples beside it. The e2e CB-22 test
still times the app in wall time, and the best of up to three runs stays (D46).

Alone and in three full unit runs at load 27-31: CPU p95 6.3-8.8 ms (p50 4.0 ms), while the same samples'
wall p95 was 15.7-26.3 ms; 435 of 435 each time. With a scratch 35 ms of CPU added to rank() for queries of
14 or more characters, all three runs fail at a CPU p95 of 39.3 ms ("expected 39.285 to be less than or
equal to 30").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
siyabendoezdemir added a commit that referenced this pull request Oct 10, 2026
…ead/harness2

No conflicts.

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

cursor Bot commented Oct 10, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 3ecb2667-75b3-4eef-a3b1-84249970ea57)

siyabendoezdemir and others added 2 commits October 10, 2026 10:09
No conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ound is a first use (PR #17 review M1)

Review M1: a retry in the same app measured a warmer app. Round 1 is the bar's first use after launch;
rounds 2 and 3 ran on caches and JIT that round 1 had warmed, so a slowdown confined to the first use
after launch passed on round 2. A user meets that first use after every launch. Each retry now closes
Orbit, launches it again on the same seeded profile (500 tabs, 10,000 history entries), waits for
history and the idle warm-up, and measures. The test's timeout is 120 s for the relaunches.

Positive control (scratch, not committed): main busy 40 ms in every 50 during the first round after
each launch. With this change all three rounds miss (p95 to results 50.3, 51.8, 47.0 ms against 30)
and the test fails. Without it the test passes on round 2 (round 1 52.3 ms, round 2 13.4 ms).
Without the scratch, at load 26-37, the test passed 3 of 3; one run needed a retry (round 1 painted
50.3 ms against 50), which passed in its fresh launch (41.7 ms).

Review F3-F5, the unit bench: falls back to process.cpuUsage() on a Node before 23.9, which lacks
process.threadCpuUsage() (engines allows Node 22), and notes what CPU time can't see (a blocking wait,
work on another thread) and that it moves in 1 ms ticks here. D46 and D51 are updated to match.

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

cursor Bot commented Oct 10, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: a74761b5-f428-41c2-a8c0-2191cd499786)

siyabendoezdemir added a commit that referenced this pull request Oct 10, 2026
One conflict, in tests/e2e/core.spec.ts: both sides added a test after TB-22's quit-timer test.
Kept both: PR #16's cancelled-quit test first, beside the other quit test, then this branch's
evaluate test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@siyabendoezdemir
siyabendoezdemir changed the base branch from lead/quit-task to main October 10, 2026 11:38
@siyabendoezdemir
siyabendoezdemir merged commit f6879e8 into main Oct 10, 2026
1 check passed
siyabendoezdemir added a commit that referenced this pull request Oct 10, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
siyabendoezdemir added a commit that referenced this pull request Oct 11, 2026
…D51)

Timing budgets that one sample judged now take the best of up to three rounds, as the command bar's
CB-22 test already did (D46): other work on this shared machine can only add delay. Each round is
logged, so a slow machine shows in the output rather than in a failure.

- archive: the Library's first open, and its open and search at 10,000 entries; media: the floating
  player's open, and with reduced motion its open, glide and return; Peek's open and close; Settings'
  appearance switch; SV-13's long tasks while dragging a divider.
- CB-22's first open after a launch is judged on its own, and the rest by their upper median (PR #17
  review F2); the typing test judges the median keystroke, leaving the worst to the budget tests.
- SV-26's growth also needs its settle within budget for a round to count.
- SV-17 waits until the shell has drawn the close before comparing views and panes; SV-13's mid-drag
  wait says, when it stalls, whether the pane card stopped too and whether the divider held the pointer.
- The archive search unit test times each search in thread CPU time (D51).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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