Repository navigation
fix(tests): prevent stale chat ink captures - #2357
Conversation
Reacquire UI Automation elements while capturing each frame so transient stale references do not fail the ink stability test. Co-authored-by: Copilot App <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR reacquires chat UI Automation elements inside the existing bounded wait before capturing each ink-stability frame. Example: FindText throws ElementNotAvailableException while capturing initial-ink-00.png.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR repairs a source-confirmed test failure still present on main, with no introduced correctness or security findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe native Gateway fixture test drives Companion against synthetic chat data, locates owned UI Automation elements, captures window pixels and checks that completed messages remain readable. flowchart LR
A[Synthetic chat fixture] --> B[Companion window]
B --> C[Bounded UIA wait]
C --> D[Owned window capture]
D --> E[Pixel assertions]
Technical reviewBest possible solution: Land the focused capture retry using the existing wait and ownership checks while preserving all pixel assertions. Do we have a high-confidence way to reproduce the issue? Main visibly allows stale-element exceptions from lookup or capture to escape; the author also reports a targeted before/after injection, which this read-only review did not rerun. Is this the best way to solve the issue? The defect is capture outside the stale-element boundary; the invariant is that ownership and readable-ink failures remain fatal, and the smallest complete fix is to reacquire and capture inside the existing wait as this patch does. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 91070a21147a. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 23, 2026, 1:35 PM ET / 18:35 UTC. |
…ersion7-coordinated-2355-20261124 * commit 'f86e395d5c8edbc968d8d6e789d1ac16a1124a80': fix(tests): read chat text from complete UIA snapshots (#2364) fix: reduce typing lag in long chats (#2343) fix(tests): wait for the Sessions gallery window (#2337) fix(migration): keep the shutdown request until the receiver reads it (#2360) fix(tests): isolate settings publication tests from ThreadPool pressure (#2359) fix: keep candidate builds from contending on GitHub environment exports fix(tests): prevent stale chat ink captures (#2357)
What Problem This Solves
The chat ink stability test can fail when a Windows UI Automation element becomes stale between lookup and capture. This unrelated test failure blocks developers' CI.
User Impact
User impact: No product behavior changes. Developers get a more reliable chat ink stability test.
Why This Change Was Made
Each frame reacquires its window and text element inside the existing bounded stale-element wait. Pixel assertions remain outside the retry. The touched test and helper path, including screenshot and diagnostic paths, were swept for stale-element siblings.
Evidence
An injected stale element reproduced the
ElementNotAvailableExceptioninFindTextcalled fromAssertStableInkAsync; the same injection passed with the fix. The affected UI shard and repeated native tests passed. Two independent reviewers found no medium-or-higher issues; one noted that visibility and capture use separate lookups and that timeout diagnostics do not retain the last stale exception. Both are bounded by the existing wait; pixel assertions are not retried.Change Type
Scope
winnodeRequired proof pools
none: Test harness reliability only; no product UI, installer, architecture, gateway, or capability behavior changed.Validation
.\build.ps1: passed.dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: 5,972 passed, 29 skipped, 0 failed.dotnet build .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csprojthendotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore: 6,938 passed, 0 skipped or failed on isolated Crabbox RTX 1 (static SSH, Windows ARM64; runrun_ea2e98e2a7e6672784b45c28750adb4a).pwsh -NoProfile -File .\scripts\validate-test-timing-patterns.ps1: passed.git diff --check: passed..\scripts\Invoke-CiTestSoak.ps1 -SelectionPath <selection> -ResultsDirectory <results>: 10 of 10 passes for each screenshot setting, with 16 externally owned CPU burners throughout each run and native input enabled. Internal soak contention count was zero.Real Behavior Proof
c20185fcf535e489feb3c6346f85d79247bdb1f2: base91070a21147a2624599de21fbfa5ab2ce79704abplus the two-file candidate (diff hashc33b6e4f6b5541bc9ebd2371bc2532dceac1bf5c). Validation and review were performed before committing.ElementNotAvailableExceptioninFindTextand runInteractiveWork_DoesNotFadeCompletedMessagePixelsbefore and after the repair; remove the injection; run the affected shard and native repetitions.Yes/No/N/A): N/A. No screenshots published.Security Impact
Yes/No): NoYes/No): NoYes/No): NoYes/No): NoYes/No): NoYes, explain the risk and mitigation: N/ACompatibility and Migration
Yes/No): YesYes/No): NoYes/No): NoReview Conversations