Repository navigation
test(control-ui): pin repeated same-method e2e waits with after-cursor - #125439
Conversation
waitForRequest(method) is satisfied by ANY prior request of that method
and returns the latest match, so a second same-method wait in one page
context can return a stale earlier request on slow runners. Add the
opt-in { after: priorCount } cursor (same shape as PR #125107's helper
change) and pin the 11 genuinely stale-prone waits: chat-composer-
capability-menu, claude-sessions (3), desktop-panel, model-providers (3,
replacing expect.poll count workarounds), session-management.group-
defaults (3). Skipped: cloud-workers-settings (owned by PR #125107),
chat-attachment-read-lifecycle (ring asserted empty), login-gate (waits
follow app-initiated stale-build reloads, which restart the ring).
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 7:26 PM ET / 23:26 UTC. ClawSweeper reviewWhat this changesThe PR adds an optional request-count cursor to the Control UI mock Gateway wait helper and applies it to repeated same-method E2E waits so they require a newly issued request. Merge readinessNo blocking correctness finding. This protected maintainer PR remains necessary because current main still lets repeated waits resolve against prior requests; wait for the remaining exact-head UI E2E shard before normal merge handling. Priority: P3 Review scores
Verification
How this fits togetherControl UI E2E tests run the web application against an in-page mock Gateway that records outgoing requests. Test actions wait on that request ring before asserting UI state or request payloads. flowchart LR
A[Control UI test action] --> B[Mock Gateway request ring]
B --> C[Wait helper]
C --> D{After cursor supplied}
D -->|Yes| E[First new matching request]
D -->|No| F[Latest matching request]
E --> G[E2E assertion]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +13, Tests +19. Total +32 across 6 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the opt-in cursor as the canonical repeated-request wait primitive and land it once exact-head CI is green. Do we have a high-confidence way to reproduce the issue? Yes—current main’s helper accepts any earlier matching request, and the modified flows create repeated requests in one page context; the source path is high-confidence although this read-only review did not execute it. Is this the best way to solve the issue? Yes—the helper owns the request-ring contract, and the optional cursor fixes repeated waits without changing existing one-shot wait semantics. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 44e8b6f12b0c. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
openclaw#125439) waitForRequest(method) is satisfied by ANY prior request of that method and returns the latest match, so a second same-method wait in one page context can return a stale earlier request on slow runners. Add the opt-in { after: priorCount } cursor (same shape as PR openclaw#125107's helper change) and pin the 11 genuinely stale-prone waits: chat-composer- capability-menu, claude-sessions (3), desktop-panel, model-providers (3, replacing expect.poll count workarounds), session-management.group- defaults (3). Skipped: cloud-workers-settings (owned by PR openclaw#125107), chat-attachment-read-lifecycle (ring asserted empty), login-gate (waits follow app-initiated stale-build reloads, which restart the ring).
What Problem This Solves
Resolves a Control UI e2e flake where a repeated same-method gateway request wait could be satisfied by an earlier request from the same page context on slow runners. The shared mock-gateway helper returned the latest matching request from the whole request ring, so the second wait did not prove that a new request had occurred.
Why This Change Was Made
This adds an opt-in
waitForRequest(method, { after: priorCount })cursor and uses it for the 11 genuinely stale-prone repeated waits found by sweeping all Control UI e2e files. The helper hunks are byte-identical to the same change in #125107, so whichever PR lands second can rebase cleanly. Existing one-shot waits retain their current behavior.The pinned waits cover the second MCP-server save, three
chat.historypages, adesktop.launchretry, threeconfig.patchsaves, and threesessions.groups.listrefetches. In the model-provider tests, the cursor replaces the formerexpect.poll(count).toBe(n + 1)workaround with the canonical wait primitive.User Impact
No production runtime behavior changes. Control UI e2e tests now wait for the request caused by the action under test instead of occasionally accepting stale request history, reducing slow-runner flakes while preserving existing test intent.
Evidence
node scripts/check-changed.mjs -- ui/src/test-helpers/control-ui-e2e.ts ui/src/e2e/chat-composer-capability-menu.e2e.test.ts ui/src/e2e/claude-sessions.e2e.test.ts ui/src/e2e/desktop-panel.e2e.test.ts ui/src/e2e/model-providers.e2e.test.ts ui/src/e2e/session-management.group-defaults.e2e.test.tspassed (format, Control UI tsgo typecheck, lint, and i18n verification).ui/src/e2e/login-gate.e2e.test.tsas an untouched control, usingnode scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner <file>: 168 test executions, 0 failures.gpt-5.6-sol, high) reported no accepted/actionable findings.cloud-workers-settingscursor pins are owned by feat(control-ui): persistent Ask OpenClaw companion with global toggle #125107.chat-attachment-read-lifecycleasserts that the ring contains zerochat.sendrequests before its second wait, so that wait cannot match stale history.login-gatesecond-connect waits follow app-initiated stale-build reloads that reinstall the init-script gateway and restart the request ring; pinning those waits would break the tests.it()opens a new page.