Skip to content

fix(ui): keep chat image browser checks stable during concurrent tests - #132066

Merged
steipete merged 1 commit into
mainfrom
fix/chat-responsive-order-leak
Aug 28, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/chat-responsive-order-leak

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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.expect for both polling assertions in the existing tiny-image test. Its imported global expect.poll depended 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 lanes followed by keeps 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-context expect closes 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 4788f764f578b28c6ab26ee19b941a940632ffe0 in #131811 on 2026-08-28 (code/PR author and merger: @vyctorbrzezowski). The subsequent failed-attachment polling is behind FULL_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.

Execution Before After
Full file, default concurrency 110 passed, tiny-image failed with expect.poll() must be called inside a test 111 passed, three consecutive runs
Tiny-image isolation 1 passed 1 passed
Narrow-image + tiny-image pair, default concurrency Narrow-image passed; tiny-image failed 2 passed
Same pair, --maxConcurrency=1 (diagnostic only) 2 passed Concurrency is unchanged by the patch

Temporary diagnostic trace, removed from the patch:

TRACE before count keeps managed image actions anchored around tiny rendered images
PASS keeps attached images within narrow message lanes
TRACE after hover undefined
FAIL keeps managed image actions anchored around tiny rendered images
Error: expect.poll() must be called inside a test

Commands:

node scripts/run-vitest.mjs ui/src/pages/chat/chat-responsive.browser.test.ts
node scripts/run-vitest.mjs ui/src/pages/chat/chat-responsive.browser.test.ts -t 'tiny rendered'
node scripts/run-vitest.mjs ui/src/pages/chat/chat-responsive.browser.test.ts -t 'keeps attached images within narrow message lanes|tiny rendered'
node scripts/run-vitest.mjs ui/src/pages/chat/chat-responsive.browser.test.ts -t 'keeps attached images within narrow message lanes|tiny rendered' --maxConcurrency=1
for run in 1 2 3; do
  node scripts/run-vitest.mjs ui/src/pages/chat/chat-responsive.browser.test.ts || exit $?
done
node scripts/check-changed.mjs
git diff --check

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.mjs exited 0, including typechecking and lint. The first implementation used destructured expect, passed browser proof, but hit eslint(no-shadow); the final patch uses the existing sibling convention context.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.

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.
@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label Aug 28, 2026
@steipete
steipete marked this pull request as ready for review August 28, 2026 19:51
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Aug 28, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 28, 2026
@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 3:58 PM ET / 19:58 UTC.

ClawSweeper review

What this changes

The 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 provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep 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
Reviewed head: d8e27c71d07451ddb87be84ea8c1bb7e5b49c4b2

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, locally consistent repair with supplied before/after test evidence and no identified patch defect.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored, test-only PR is outside the external-contributor proof gate; its body nevertheless supplies a reduced failing pair and three successful full-file after-fix runs.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored, test-only PR is outside the external-contributor proof gate; its body nevertheless supplies a reduced failing pair and three successful full-file after-fix runs.
Evidence reviewed 6 items Introduced test-only repair: The verified introduced delta changes only the tiny managed-image test: its callback accepts the test context and both asynchronous polls use that context; no production path is modified.
Current-main baseline remains affected: The PR base still uses ambient expect.poll at both relevant positions, so the proposed change is not already implemented on current main.
Existing in-file context convention: A separate concurrent browser test already uses context.expect.poll after an awaited hover, supporting this narrow use of the test-context API without adding a parallel assertion mechanism.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

  • Resolve merge risk (P1) - The supplied review context omits the body of the newest ClawSweeper comment, so its rank-up moves must be checked before landing.
  • Resolve merge risk (P1) - Some exact-head UI jobs were still in progress in the supplied check snapshot.
Agent review details

Security

None.

PR surface

Tests +2. Total +2 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 5 3 +2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 5 3 +2

Review metrics

Metric Value Why it matters
Production versus test delta production +0/-0; test-only +5/-3 (net +2) The change is confined to an existing browser regression test and does not alter shipped UI behavior.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    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.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best 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.

Labels

Label changes:

  • add P3: This repairs developer-facing test stability without changing user-visible runtime behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored, test-only PR is outside the external-contributor proof gate; its body nevertheless supplies a reduced failing pair and three successful full-file after-fix runs.

Label justifications:

  • P3: This repairs developer-facing test stability without changing user-visible runtime behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored, test-only PR is outside the external-contributor proof gate; its body nevertheless supplies a reduced failing pair and three successful full-file after-fix runs.

Evidence

What I checked:

  • Introduced test-only repair: The verified introduced delta changes only the tiny managed-image test: its callback accepts the test context and both asynchronous polls use that context; no production path is modified. (ui/src/pages/chat/chat-responsive.browser.test.ts:2280, d8e27c71d074)
  • Current-main baseline remains affected: The PR base still uses ambient expect.poll at both relevant positions, so the proposed change is not already implemented on current main. (ui/src/pages/chat/chat-responsive.browser.test.ts:2320, bb51e903325f)
  • Existing in-file context convention: A separate concurrent browser test already uses context.expect.poll after an awaited hover, supporting this narrow use of the test-context API without adding a parallel assertion mechanism. (ui/src/pages/chat/chat-responsive.browser.test.ts:4286, d8e27c71d074)
  • Concurrent owner and cleanup boundary: The suite is explicitly concurrent, while each static fixture receives its own page and closes it in finally; the repair targets assertion ownership rather than changing scheduling or browser lifecycle. (ui/src/pages/chat/chat-responsive.browser.test.ts:784, d8e27c71d074)
  • Feature-history owner: The related merged UI change appears in the file history immediately before this repair and is identified in supplied GitHub context as the feature that added the managed-image coverage. (ui/src/pages/chat/chat-responsive.browser.test.ts:2280, 4788f764f578)
  • Dependency signal and local limitation: The UI package pins Vitest 4.1.11, and the affected file supplies an established context.expect precedent. Direct installed Vitest source was unavailable because this read-only checkout has no node_modules and its promisor remote could not resolve; this is a reviewer limitation, not missing contributor proof. (ui/package.json:60, d8e27c71d074)

Likely related people:

  • vyctorbrzezowski: The related merged feature PR and local file history identify this contributor as the author of the managed-image test surface that this repair stabilizes. (role: introduced managed-image coverage; confidence: high; commits: 4788f764f578, 8bd895862d13; files: ui/src/pages/chat/chat-responsive.browser.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Confirm the latest ClawSweeper rank-up moves and let the remaining exact-head UI jobs finish green.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

steipete commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Landing proof for d8e27c71d07451ddb87be84ea8c1bb7e5b49c4b2:

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 context.expect fixes that ownership error. No assertion, timeout, concurrency setting, browser cleanup, or production code changed. Production +0/-0; tests +5/-3.

node scripts/run-vitest.mjs ui/src/pages/chat/chat-responsive.browser.test.ts failed before the patch (110 pass, 1 context error), then passed three consecutive times (111/111 each), plus once on the rebased head. The same command with -t 'tiny rendered' passed before and after; with -t 'keeps attached images within narrow message lanes|tiny rendered' it failed before and passed after. The pre-fix pair with --maxConcurrency=1 passed, confirming the concurrency trigger. node scripts/check-changed.mjs and git diff --check exited 0. Final Codex autoreview exited 0 with no accepted/actionable findings.

node scripts/watch-pr-ci.mjs 132066 d8e27c71d07451ddb87be84ea8c1bb7e5b49c4b2 exited 0 with GREEN and no pending checks. Exact-head CI run 33205670276 completed successfully. Native review-init, baseline/head inspection, review guard, artifact initialization, and artifact validation are complete. Proceeding through OPENCLAW_TESTBOX=1 scripts/pr prepare-run 132066 and scripts/pr merge-run 132066.

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. OPENCLAW_TESTBOX=1 scripts/pr prepare-run 132066 completed successfully, verified hosted gates, and kept the same PR head. No screenshot or provider proof gap: this is a test-only repair with unchanged rendered behavior.

@steipete
steipete merged commit 66dd003 into main Aug 28, 2026
157 checks passed
@steipete
steipete deleted the fix/chat-responsive-order-leak branch August 28, 2026 20:02
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Aug 28, 2026
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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 29, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant