Repository navigation
fix(chat): two causes of flaky chat e2e (follow after a sideways swipe, caret placed a frame late) - #152
Merged
Conversation
Chromium sometimes scrolls the chat by a sideways swipe's few px of vertical noise, and onScroll took that upward move as the reader going back: the "Scroll to the latest message" button showed and follow stopped. This is the intermittent chat.spec.ts:299 CI failure (main runs after #146 and #148). For 150 ms after a mostly sideways wheel the chat's own upward scroll is ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a frame later The ↑ recall and the `/` menu pick moved the caret in the next animation frame. That frame could land between a select-all and the typing that replaces it (Playwright's fill, or a fast user), collapsing the selection so the new text was added after the old: CI saw "second promptline one" and "second prompt/" (no `/` menu) in chat-history.spec.ts. The caret is now placed in a layout effect, right after React put the text in the box, in the same task as the key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the two intermittent chat e2e failures that turned main red today. Both are real app bugs, not just test timing.
1.
chat.spec.ts:299: a sideways swipe paused follow (main runs after #146 and #148)The test swipes sideways (
wheel(-40, -3)). The chat's wheel handler doesn't count that as scrolling up, but Chromium sometimes still scrolls the chat by the 3 px of vertical noise;onScrollsaw an upward move, paused follow and showed "Scroll to the latest message". Now, for 150 ms after a mostly sideways wheel, the chat's own upward scroll doesn't pause follow.2.
chat-history.spec.ts: caret placed a frame late (main after #150, and this PR's first CI run)↑ recall and the
/pick moved the caret in the next animation frame. That frame could land between Playwright's select-all and its insert, collapsing the selection so the text was appended: CI receivedsecond promptline one\nline two(:87) and, the same way,second prompt/with no/menu (:94). A fast user could hit the same. The caret is now placed in a layout effect right after React commits the text, in the same task as the key.Tests: typecheck, lint, 483 unit tests. Locally under parallel load,
:299failed 1 of 18 before and 0 of 36 after;chat-history60/60 after. Full e2e: 49 passed, 1 failed inresponsive.spec.ts:131(Settings nav in a small window, untouched here), which passed 3/3 on rerun; noted indocs/TODO.md.🤖 Generated with Claude Code