bench: link_right page_ms waits for the new tab; chat-open clicks a finished subagent line

TE
2d ago
+41-10

Follow-up to #36002 (#36060 F1 and the subagent bench item). Leo, 2026-11-05: "things just don't f***ing open up fast enough on the right. / links. subagents. all". These two benches are how we measure that, and both were giving wrong answers.

Part of the main-thread hang push (manaflow-ai/cmuxterm-hq#6338, comment 6597127823), where Leo also said: "i frequently see this / but claude: / and codex: / have much more useful right click things and dont get the application not responding thing".

What was wrong

  • instant-new-surfaces link_right / split_browser page_ms: Probe.anyPagePainted accepted any browser in the window that had already painted. So a page that was already showing could end the wait before the new pane painted, and the number came out too low. The wait now skips the browser tabs that were shown before the press.
  • chat-open subagent: the bench clicked the element whose text was the subagent's name alone. Since #34529, a finished subagent's line reads its task first ("Subagent finished: Audit area 3: ..."), so nothing matched. Every open came back no visible element matches or timed out, even though the chat rendered (13 rows), so no open was ever timed. When no name matches, the bench now clicks the finished line's button (button.cv-subagent-done).
  • Not changed: the quick arm skips link_right by design, because there is no key for it (arm_quick: "timed by the warm arm alone"). Leaving it out is deliberate. A second link opened from the same pane goes into the existing right column, not a new split, so the bench's "visible" test would not apply.

Tests (red at base, green at head)

  • scripts/cmux-next/tests/test_chat_open_bench.py:
    • SubagentClickTests.test_a_line_that_reads_its_task_first_is_clicked_by_its_selector and test_no_shown_line_keeps_the_error error at base and pass at head.
    • OpenTests has 4 tests that fail the same way at base and at head (test_a_refused_open_shows_nothing, test_a_refused_switch_falls_back_and_says_so, test_open_shows_the_workspace_it_created, test_open_with_no_created_ref_falls_back_to_the_last_workspace). They are base reds and this PR does not touch them.
  • The page_ms change is debug-only bench code. It is checked by the bench runs below.

Performance

This PR changes only the measurement, not the app. The re-measured before/after of #36002 with the fixed benches, run on one host per bench, goes on #36002 when the runs finish.

metricbeforeafterdeltaharness
chat-open subagent valid opens (base 1afb16d5, n=10)0pendingstep 640ffa59 → rerun

Risk

Low. The change is in debug and bench code only (#if DEBUG || CMUX_BENCH_HOOKS) plus a Python script. It adds no timers or observers.

Changelog

  • None (bench only).

Agent session: agent session

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes two benchmark measurements that were reporting wrong numbers for the link-open-to-the-right and subagent-chat-open benches. Both gave low or missing results: the page wait ended on any already-painted page, and subagent opens were never timed once a finished line reads its task before its name.

  • link_right and split_browser page_ms now skip the browser tabs shown before the keypress, so the wait ends only when the new pane's page paints.
  • The subagent bench now clicks the finished line's button (button.cv-subagent-done) when no line matches the name alone, unblocking timed opens.
  • Changes are debug and bench code only; the app is unchanged.