Repository navigation
fix(ui): keep chat image browser checks stable during concurrent tests - #132066
Conversation
Trace the full-file failure to overlapping completion of the narrow-image case: Vitest clears its ambient current-test slot while the tiny-image case awaits hover, so global expect.poll loses its owner. The reduced pair fails before this fix while isolation and serial execution pass. Use context.expect for both polls, preserving every assertion, timeout, and concurrent scheduling. The image test originated in #131811; thanks @vyctorbrzezowski for the managed-image coverage.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 3:58 PM ET / 19:58 UTC. ClawSweeper reviewWhat this changesThe PR binds two concurrent browser-test polling assertions to their individual Vitest test context so managed-image layout checks do not lose assertion ownership while another test completes. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readinessKeep open for normal maintainer review: this protected, member-authored test-only repair has no introduced correctness or security finding, but exact-head CI and the latest review’s rank-up moves still govern landing. Priority: P3 Review scores
Verification
How this fits togetherThe Control UI’s concurrent chat-layout browser suite creates pages with a shared browser context and checks the rendered managed-image controls. Its assertions feed CI confidence for chat image presentation; this PR changes only their test assertion context. flowchart LR
A[Concurrent chat browser tests] --> B[Managed-image layout test]
B --> C[Hover and poll]
C --> D[Per-test assertion context]
D --> E[Rendered layout checks]
E --> F[UI CI result]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +2. Total +2 across 1 file. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain this narrowly scoped per-test assertion binding, then land only after the exact-head UI checks pass and any latest review rank-up moves are addressed or explicitly skipped. Do we have a high-confidence way to reproduce the issue? Yes, source and the supplied execution trace identify a focused concurrent path: the tiny-image test performs ambient polling after an awaited hover while sibling tests can complete. This review did not rerun it because the read-only checkout lacks installed dependencies. Is this the best way to solve the issue? Yes. Reusing the file’s existing context.expect.poll convention fixes assertion ownership at the polling boundary without serializing the suite, changing timeouts, or altering browser lifecycle. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bb51e903325f. 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
|
|
Landing proof for The failing order reduced to the narrow-image test completing while tiny-image awaited hover. Temporary tracing showed Vitest's ambient current test changed from tiny-image to undefined; callback-bound
The completed ClawSweeper review has no code/security findings. Both before-merge requests and the Rank-up move are satisfied: I read the complete latest review, and the remaining exact-head UI jobs are now green. No behavior-changing push followed the review. |
|
Merged via squash.
|
Trace the full-file failure to overlapping completion of the narrow-image case: Vitest clears its ambient current-test slot while the tiny-image case awaits hover, so global expect.poll loses its owner. The reduced pair fails before this fix while isolation and serial execution pass. Use context.expect for both polls, preserving every assertion, timeout, and concurrent scheduling. The image test originated in #131811; thanks @vyctorbrzezowski for the managed-image coverage.
…2066) Trace the full-file failure to overlapping completion of the narrow-image case: Vitest clears its ambient current-test slot while the tiny-image case awaits hover, so global expect.poll loses its owner. The reduced pair fails before this fix while isolation and serial execution pass. Use context.expect for both polls, preserving every assertion, timeout, and concurrent scheduling. The image test originated in openclaw#131811; thanks @vyctorbrzezowski for the managed-image coverage.
Related: #131811 (chat image presentation and controls).
Additional instructions
Maintainer-requested test repair; this branch is in the upstream repository and maintainers can push to it.
What Problem This Solves
Resolves a problem where the full responsive-chat browser test file fails in
checks-node-compact-large-9, while the tiny-image case passes in isolation. The test loses its Vitest assertion context after an overlapping sibling finishes.Why This Change Was Made
Use
context.expectfor both polling assertions in the existing tiny-image test. Its imported globalexpect.polldepended on Vitest's ambient current-test slot, which any concurrent sibling completion clears. All polling, geometry assertions, browser cleanup, timeouts, and concurrent scheduling remain unchanged; no production code changes.The reduced failing pair is
keeps attached images within narrow message lanesfollowed bykeeps managed image actions anchored around tiny rendered images. The narrow-image test completes normally with awaited cleanup; it does not leak an unfinished browser continuation. The test defect is the tiny-image test producing assertions from shared ambient state after awaited browser operations. Installed Vitest 4.1.11 source confirms the runner clears that slot on completion, whereas callback-contextexpectcloses over the owning task. This uses the existing Vitest test-context API, also used by the concurrent Retry-color test in this file.Provenance: introduced by
4788f764f578b28c6ab26ee19b941a940632ffe0in #131811 on 2026-08-28 (code/PR author and merger: @vyctorbrzezowski). The subsequent failed-attachment polling is behindFULL_APP_TEST_OPTIONS.concurrent: false; the toast changes do not introduce the assertion race.User Impact
No user-visible behavior changes. Developers retain the full managed-image layout checks without an order-dependent CI failure. Production LOC: +0/-0. Tests: +5/-3, including the explanation of assertion ownership.
Evidence
Baseline:
54f0322557d38123febe934b482e019e16758511.expect.poll() must be called inside a test--maxConcurrency=1(diagnostic only)Temporary diagnostic trace, removed from the patch:
Commands:
Final-patch full-file durations: 41.85s, 44.45s, 42.31s; all 111 tests passed each time. The existing browser test supplies regression coverage; no duplicate test or production seam was added. No visual artifact is needed because rendered behavior is unchanged.
Changed gate:
node scripts/check-changed.mjsexited 0, including typechecking and lint. The first implementation used destructuredexpect, passed browser proof, but hiteslint(no-shadow); the final patch uses the existing sibling conventioncontext.expect, without a lint suppression.Codex autoreview: exit 0, no accepted/actionable findings. AI-assisted repair; the dependency contract and original execution-order trace were inspected directly.