Skip to content

test(webviews): B2 waits for conditions, not fixed times (110 waits) - #23454

Merged
teamleaderleo merged 7 commits into
feat-cmux-nextfrom
fixed-waits/b2
Oct 21, 2026
Merged

teamleaderleo merged 7 commits into
feat-cmux-nextfrom
fixed-waits/b2

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Batch B2 of the fixed-wait sweep: 18 webview test files wait for the condition they assert instead of a fixed time. 110 waits removed (124 → 14 in these files on the ratchet baseline).

What the waits became:

  • Daemon messages: tests wait for the exact message they expect (steer, seen, btw, suggested-tasks, recap-card, reopened-chat-history). "Nothing was sent" checks first wait for a later signal on the same socket (the page's refetch after a lag notice, a drawn failover note or a marker chunk), so the forbidden message would have arrived first.
  • Fake clock: steer's 5 s Stop grace and focus-content's activation settle and press window run on Playwright's page.clock.
  • Painted frames: layout settles use the shared helper from webviews tests: frame tests read layout after the frame paints #23374 (installPaintedFrames, cmuxPaintFrame): animations finished, then two painted frames (edited-copy, recap-card, step-rows, model-picker, reasoning-chip, thin-scrollers, latency-harness).
  • DOM state: turn-footer waits for opacity 0 or 1, working-counts for the row in view, diff-find reads until the state holds.

Left: 14 counted waits, all frame waits in agent-pane-stream-jitter.test.ts, where scroll glides run in JS and finished animations don't mean the view is at rest. Two new // fixed-wait: markers: the chunk cadence in stream-jitter is the input under test, and dev-server-stop polls the process table, since nothing reports when a grandchild process exits.

Verification: every changed file ran 3 times with CMUX_BROWSER_TESTS=1, one file at a time; all passed. The one failure was a single steer run during a concurrent bun run check, in a test this PR doesn't change (a 1.6 s window). Breaking the behavior on purpose (steer's Stop grace, focus-content's press window, recap's toggle and Not now, seen's view after attach) made the affected tests fail. check:fixed-waits (882), bun run check, scripts/web-lint.sh and the prepush gate pass. The independent review ran all 17 changed browser files once more: all pass.

check:fixed-waits may be red here until #23452 lands: #23094 added 9 fixed waits to base after the guard merged.

Agent session: huge-blue

🤖 Generated with Claude Code


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


Summary by cubic

Replaces fixed-time sleeps in 18 webview browser-test files with waits on the conditions they assert, removing 110 fixed waits (124 → 14 on the ratchet baseline).

What the waits became

  • Daemon round trips wait for the message they expect (cancel, prompt, view, /btw) and fail naming what never arrived.
  • "Nothing was sent" assertions first wait for a later positive signal — the page's refetch, a drawn failover note, or a marker chunk — so a forbidden message would have arrived first.
  • Stop's 5 s grace and the composer's activation settle run on Playwright's page.clock instead of sleeping through them.
  • Layout settles finish the page's finite animations, then wait for painted frames via the shared installPaintedFrames helper.
  • The turn footer waits for opacity 0 or 1; working-counts wait for the row in view; diff-find reads until its state holds.
  • The 14 waits left are frame waits in agent-pane-stream-jitter.test.ts (scroll glides run in JS) plus four marked fixed waits: the chunk cadence under test, dev-server-stop's process-table poll, and two 3 s frame-watch observation windows added by the webviews tests: frame tests read layout after the frame paints #23374 merge.
  • Each changed file ran 3 times, and an independent review reran all 17 changed files: all passed.

Written for commit 551daa0. Summary will update on new commits.

View guided diff Turn on auto-fix

teamleaderleo and others added 3 commits October 21, 2026 12:53
#23374 merged after the fixed-wait ratchet (#23365) ran CI, and it added a
3 s waitForTimeout in two tests, which puts feat-cmux-next over its baseline.
Both waits are observation windows: the test records every painted frame for
3 s after the chat opens and asserts none jumped, so the time is the test.
They carry a fixed-wait marker instead of a raised baseline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15c78-27ca-7140-a6c7-95f0db83b18c&host=huge-blue
Removes the fixed sleeps from the B2 batch's 18 browser-test files.

- Daemon round trips: the stand-in acpmux daemons wake a bounded `until`
  on each message they take, so a test waits for the cancel, prompt, view
  or offer reply itself, and fails naming what never came.
- Absence checks (no cancel, no prompt, no /btw, no armed stop, no second
  view, no card) wait for a later positive signal first: the page answers
  a lag notice sent after the input with its refetch, or draws a record
  sent after it (a failover note or a reply chunk), so anything it would
  have sent or drawn has arrived before the assertion. Counts of exactly
  one also wait for that signal.
- Stop's 5 s grace and the composer's activation settle run on
  Playwright's page.clock: the steer and focus-content tests move past
  them instead of sleeping through them.
- The turn footer waits for the footers' opacity to reach its end value;
  the diff find and working counts read until the state holds (bounded).
- Layout settles convert to the shared painted-frame helper
  (support/paintedFrames.ts): two painted frames after a mount or a font
  load, the page's finite animations finished first after a fold, a
  hover, a focus or a resize, and 20 painted frames for the latency
  probe's frame budget. thin-scrollers waits for data-cmux-scrolling.
- reopened-chat-history waits on the daemon's answers (nothing in flight,
  an older read answered) instead of a 250 ms quiet window.
- Two waits keep a reasoned marker: the stream jitter test's chunk
  cadence is the input under test, and dev-server-stop polls the process
  table because nothing reports a grandchild's exit.
- The stream jitter test's remaining settle and observation windows are
  left for the frame work (scroll glides are JS-driven, so animation
  state cannot say they ended).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15c78-27ca-7140-a6c7-95f0db83b18c&host=huge-blue
@teamleaderleo teamleaderleo added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Oct 21, 2026
@cursor

cursor Bot commented Oct 21, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

…its/b2

# Conflicts:
#	webviews/test/agent-pane-recap-card.test.ts
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 551daa0: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr23454 -f ref=fixed-waits/b2 -f platform=macos -f backend_mode=local

Passes: CI passes on 551daa0676.

CI passes on 551daa0676 (run 39628970418 attempt 1).

Written by scripts/ci/classify_failures.py (ci-failure-attribution.yml); signatures are its SIGNATURES table. A machine verdict is the runner's fault, not this PR's; yours means the failing file is one this PR changes, also red on main that main's latest full suite fails the same way, seen on other PRs that it failed on another pull request's run lately.

web and size checks: green

CI fast guards passes on 551daa0676 (run). This covers only the fast guards, not CI: CI's result is ci-status.

Tour of 551daa0676 (run): no media. The tour did not run: only webview code changed (19 path(s)), which the gallery advisory run checks in Linux Chromium on the pull request (its artifact holds any captures); add the media-tour-mac label to tour it on a Mac.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Bead cx-v0au1 created for this PR by the cmux coordinator.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

cmux-next guards / defaults-snapshot is red on 23 of 23 fresh feat-cmux-next PR heads in the last 2:00:00, so it is most likely a base red, not this PR's. The base-reds lane has it; a base merge picks up the fix once it lands.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (subagent): SHIP at 1b28b43 (the later base merge only resolved recap-card's imports; recap-card 7/7). Reds are base: check:fixed-waits names five files outside this PR (fixed in #23452), defaults-snapshot (FileExplorerSectionView.swift); Web status, the shard rollup and fast-gates follow from those.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Owned by window-focus-opacity on huge-blue · session

…its/b2

# Conflicts:
#	webviews/scripts/fixed-waits-baseline.tsv
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (subagent): SHIP at 551daa0 (interdiff re-review of the base merge: same test change, and the baseline only lowers this PR's own rows). Remaining reds aren't this PR's: backend-migrations plan (this PR changes webviews test files only), plus cancelled jobs (autofix export areas, cmux-tui preflight, mux bun test).

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant