Repository navigation
test(ui): pause fake clock before send so working-timer e2e assertions are deterministic - #115187
Conversation
…s are deterministic
|
Codex review: needs real behavior proof before merge. Reviewed July 28, 2026, 8:32 AM ET / 12:32 UTC. ClawSweeper reviewWhat this changesThe PR pauses Playwright’s fake clock immediately before sending chat messages in two Control UI end-to-end tests, so working-time assertions advance only through explicit virtual-time fast-forwarding. Merge readiness⛔ Blocked until stronger real behavior proof is added - 4 items remain Keep this PR open for normal protected-label review. The narrow test-only change plausibly removes a genuine virtual-clock timing race and introduces no concrete functional or security defect in the supplied diff, but the provided evidence does not include inspectable after-fix output for the stated delayed-run reproduction. Likely related people: steipete (high confidence, prior merged feature/test work). Priority: P3 Review scores
Verification
How this fits togetherThe Control UI chat tests simulate sending a message through the browser and then fast-forward virtual time to verify the visible working timer. The tests depend on the chat progress calculation capturing a start timestamp at send time and rendering elapsed time in the chat interface. flowchart LR
A[Control UI E2E test] --> B[Install fake browser clock]
B --> C[Pause clock before send]
C --> D[Chat send captures start time]
D --> E[Fast-forward virtual time]
E --> F[Working timer assertion]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +8. Total +8 across 2 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the pause directly before each send action, then land after the current-head UI E2E run completes and the PR includes a redacted terminal transcript or equivalent artifact showing the delayed-run reproduction no longer drifts. Do we have a high-confidence way to reproduce the issue? Unclear for a live current-main run: the PR describes a concrete delayed-send reproduction in the affected E2E tests, and the changed timing boundary is clear from the supplied diff, but no independently inspectable run output was provided. Is this the best way to solve the issue? Yes, provisionally: pausing the already-installed virtual clock immediately before the timestamp-producing send action is narrower and more maintainable than weakening the exact elapsed-time assertions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 981a3dfad302. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…s are deterministic (openclaw#115187)
What Problem This Solves
ui/src/e2e/mantis-chat-proof.e2e.test.tshas a flaky timing assertion: on PR #115123'schecks-ui-e2eattempt 2 (2026-07-28, unrelated branch) it failed withexpected '2m 57s', received '2m 59s'. The sibling test inui/src/e2e/chat-run-lifecycle.e2e.test.ts("shows compaction savings and live working time") has the identical pattern and the same latent flake.Why This Change Was Made
Both tests install a fake Playwright clock but never pause it.
page.clock.install()keeps the virtual clock ticking at real-time rate until it is paused, and the working indicator'sstartMsis captured from the page'sDate.now()at the send click (queue itemcreatedAt, min-reduced inui/src/pages/chat/chat-progress.ts). So the elapsed value the test asserts isfastForward(177_000)plus however many real seconds CI took between the send click and thefastForwardcall — on a slow runner that inflates "2m 57s" to "2m 59s".The fix pauses the virtual clock (
page.clock.pauseAt(now + 5s)) immediately before the send click, so virtual time advances only throughfastForwardand the elapsed reading is exactly 177s, deterministically. This matches the existing repo pattern inui/src/e2e/lobster-pet.e2e.test.ts.User Impact
None — test-only change. CI's
checks-ui-e2elane stops flaking on this assertion.Evidence
Both changed specs pass locally:
Determinism proof (before/after with simulated CI slowness). Injecting a real-time
await page.waitForTimeout(2_500)between the send click andfastForward(177_000)simulates the slow-runner gap that caused the observed CI failure.Before (pause removed, delay injected) — reproduces the exact flake class from PR #115123's
checks-ui-e2e:(The received value exceeds 2.5s of injected delay because the unpaused clock also ticks during the send/waitFor steps — the same mechanism that produced "2m 59s" on CI.)
After (this PR's pause in place, same 2.5s delay injected) — deterministic:
d4a8882db42b0a26191226aecdd5e908036b9d67, includingchecks-ui-e2e(https://github.com/openclaw/openclaw/actions/runs/30359089731).gpt-5.6-sol, xhigh): clean, "patch is correct (0.96)".