Repository navigation
fix(chat): long chats reach the latest message after a resize and a scroll to the end - #2417
Conversation
|
🦞👀 ClawSweeper review completeClawSweeper finished reviewing this revision. |
|
Codex review: passed. What this changesGive resized chats a bounded correction budget so late message remeasurement does not leave the final message below the viewport. Example: Switch to a 240-message conversation, widen the window, and use UI Automation to scroll to 100%.
Review scores
The scores reflect the reviewer's assessment. Real behavior proof is not required for maintainer- or bot-authored pull requests. ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses a concrete scrolling defect still present on fetched main, with no blocking introduced bugs found. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherReactorChatTimeline supplies transcript revisions and tail identity to InitialTailPositioner, which applies TailReflowCorrection decisions through the native WinUI ScrollView. flowchart TD
A[Transcript revision and tail identity] --> B[InitialTailPositioner]
C[Resize and extent events] --> B
D[Reader input] --> B
B --> E[TailReflowCorrection]
E --> F[Bounded correction admission]
F --> G[Native ScrollView]
Technical reviewBest possible solution: Retain the existing scroll owner and replenish its bounded correction budgets on resize while preserving reader cancellation and lifecycle fencing. Do we have a high-confidence way to reproduce the issue? Source confirms the exhausted-budget path, and the author reports matching native failures under injected remeasurement; this review did not independently execute the intermittent UI scenario. Is this the best way to solve the issue? This is a focused repair of the demonstrated budget exhaustion using the existing policy, with finite retries and unchanged reader admission, rather than requiring the broader draft ownership rewrite. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 29f0553fbed0. Provenance checked
TestingProof path: shipped entry point. 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 readiness starts with the lower of the proof and patch scores. It is capped at 3/6 if the fix is partial, the change offers little benefit, a product decision is still open, or the PR reverses an earlier decision without saying why. ✨ 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 30, 2026, 5:13 PM ET / 22:13 UTC. |
…croll to the end After a session switch the chat has no extent-growth correction left for that transcript revision, and a viewport resize granted only one correction plus the two landing retries per revision. Virtualized rows realized by a resize and a UI Automation scroll to the end keep remeasuring while a correction is in flight, so the final message could stop short of the viewport with Jump to latest shown (CI flake GatewayFixtureUiTests.SidebarSwitchesRealHistoriesAndShowsMessage240AtBothWidths). - TailReflowCorrection: bounded growth budget (MaxGrowthCorrections = 8) per content revision or viewport resize; a resize also refills the two landing retries. Native remeasurement never refills either; reader input still clears. - Growth seen while a correction waits for layout spends no credit. - UpdateTail clears a pending-correction flag whose dispatch was abandoned. - Docs and ledger state the bounded budgets and the existing UI Automation scroll-away limitation (openclaw#2126 is the structural fix). Ported from the held fix ae0867a onto current main, keeping openclaw#2319's landing retries and pinned correction anchor. Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
c62c8b7 to
f6985c9
Compare
…d test (#2424) #2417 consolidated TailReflowCorrection_ResizeGrantsTheBoundedBudgetWithoutANewRevision into TailReflowCorrection_ResizeRefillsGrowthAndLandingBudgetsWithoutANewRevision but left docs/ARCHITECTURE.md naming the old method, so ArchitectureLedgerConsistencyTests.Named_guard_tests_exist_in_test_sources fails on main. Co-authored-by: Copilot App <[email protected]>
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
f6985c99f7c4c5488e021b80162c38e7e36f6161↑ Final code passed the message-240 test 20/20 (screenshots 0 and 1, native keyboard) and 10/10 under CPU burners on Crabbox ARM64.
↑ Three policy tests each fail when one part of the fix is removed (growth refill, landing-retry reset, pending coalescing); Shared, Tray, build, timing ratchet and docs checks pass locally.
↑ Dual-model review: no CRITICAL or HIGH; both MEDIUM findings fixed and delta-reviewed.
↓ Behavior change for every resized chat: up to 8 growth corrections plus 2 landing retries per resize or revision; no visible-jitter measurement.
↑ CI green on this head (run 46545948597 attempt 2), including both Mock Gateway fixture lanes, the chat-layout UI shard and the new-test soak.
↓ Attempt 1 lost the Tray UI lane to the tracked 0xC0000409 testhost crash outside this diff; one failed-jobs rerun was used.
↓ Crabbox full shard and ReactorChatLayoutProof class have host-limited failures that also fail on clean main.
↑ Injecting one more in-flight remeasure reproduced the exact CI stack and diagnostics on main.
↓ Mechanism inferred from Crabbox traces and injection; CI runs carry no scroll diagnostics.
↓ No CI trace confirms the exhausted-budget state directly.
Related: #2126
What Problem This Solves
In a long chat, after switching sessions and making the window wider, scrolling to the end with a screen reader (UI Automation) could stop short of the last message. The final message stayed below the visible area and Jump to latest stayed on screen. CI caught this as an intermittent failure of
GatewayFixtureUiTests.SidebarSwitchesRealHistoriesAndShowsMessage240AtBothWidthson unrelated PRs (#2373, #2296).User Impact
User impact: long chats reliably reach the latest message after a window resize and a scroll to the end, including through screen readers, and the message-240 CI test stops failing for unrelated PRs.
Why This Change Was Made
The chat corrects the scroll position when messages measure taller than estimated. After a session switch, that transcript had no growth correction left, and a resize granted only one correction plus two landing retries per transcript revision. When rows kept remeasuring while a correction was moving, every budget ran out and the view stopped short.
A viewport resize now grants its own bounded budget: up to 8 growth corrections, and the 2 landing retries again. Growth seen while a correction still waits for layout spends nothing, because that correction reads the newest size. Native remeasurement never refills a budget, reader input still clears it, and a reader who scrolled away is never pulled back. This ports the held fix
ae0867aaonto current main and keeps #2319's landing retries and pinned correction anchor. The single scroll owner in #2126 remains the structural fix; this stays small until then.Cause, class and sibling sweep
Request()clearsTailReflowCorrectionafterUpdateContentRevision, so growth credit stays false for the same-revision session. The wide step relied on the resize's one correction plus both landing retries (MaxLandingRetries = 2); 9 of 10 contended runs used the last retry.TailReflowCorrection(OnSizeChanged,OnExtentChanged,ObserveGeometry,OnScrollCompleted,CancelPendingNavigation,Request,UpdateTail) were checked. Review found one sibling: a pending-correction flag left set when the tail became invalid. It is now cleared inUpdateTail.Evidence
RED, then GREEN, of the exact CI failure. An env-gated, uncommitted, host-only injection grew the tail row 48 DIP right after each of the first three correction dispatches, so rows remeasure while a correction is moving. Diagnostic logging proved each injection fired.
5e4d1986Timed out waiting for message 240 visible at wide width,messageBounds: Empty,messageOffscreen: true. Trace: both landing retries spent, no growth credit, view short (for exampleoff=41467 max=41987).off=41755.5 max=41755.5).Before (main plus injection): message 240 below the viewport, Jump to latest shown. After (fix plus the same injection):
FINAL MESSAGE 240andEND 240visible. Screenshots are kept in the run artifacts listed below.Required proof pools
windows-winui-interactive: native chat scroll behavior in the isolated WinUI app (Gateway fixture), proven on Crabbox with the shared desktop lock and isolated profile folders.Validation
./build.ps1dotnet test tests/OpenClaw.Shared.Testsdotnet test tests/OpenClaw.Tray.TestsChatTimelinePresentationTestson the final testsscripts/validate-test-timing-patterns.ps1,git diff --check,scripts/validate-docs.ps1test-gateway-fixture.ps1 -UiShard All -Screenshots -NativeInputProof -KeyboardProof)ReactorChatLayoutProofTestsclassSendAtTail…JumpFlashflakes with the same signature on both (fix 5 of 40 cases, main 7 of 40).NewestHistoryWindow(following: False)flakes on both (1 in 5).Crabbox runs used host commit
db65766d(main5e4d1986plus this change before the doc-only review edits and the rebase); the product code undersrcis identical to this head. The policy tests were later consolidated from four methods into three, with the same coverage (mutation-checked). Run folders on RTX 2:C:\oc\m240-runs\{redinj,redinj12,greeninj,fx10,fxcpu0,fxcpu1,shard,unitsoak,rclp,rclpmain,sh8fix,sh8main,sendfix,sendmain}.Review: Hanselman dual-model review (claude-opus-5.5 high; gpt-6-astra long_context high), plus a delta re-review of both fixes. No CRITICAL or HIGH. Fixed: a stale pending-correction flag (MEDIUM), and docs that overstated UI Automation precedence (MEDIUM; plus the send-landing exception both models flagged). Not changed here: no source-shape guard for the controller wiring; a landing retry can be spent while a newer correction is queued; landing verification ignores correction state; and a rare stale flag from
ObserveGeometrywhile rows are invalid (all LOW).Real behavior proof
The message-240 Gateway fixture test drives the real app: session switches, a window resize, and a UI Automation scroll to 0% then 100%. Under the in-flight remeasure injection, main reproduces the CI failure and this change reaches the final message.
CI: green on this head, run 46545948597 attempt 2. Attempt 1 hit the tracked Tray UI testhost fail-fast crash (0xC0000409, 0 failed assertions, outside this diff). c62c8b7, with identical product code, was green on its first attempt (run 46522371146): both Mock Gateway fixture lanes, the chat-layout UI shard, the new-test soak and all other required checks passed.
Not verified: no visible-jitter measurement during streaming. The repo soak script itself could not run on the ARM64 host (equivalent run above). The injection emulates late remeasurement; it is not a natural CI trace.