Repository navigation
fix(chat): keep the pinned prompt while reading the last reply - #15919
Conversation
|
Intent: Keep the pinned prompt card on screen while the reader scrolls through the final reply of a session, including replies taller than the viewport. |
4b4368f to
7f205fa
Compare
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that the end-of-list fallback is still right while the final reply streams: a growing last row keeps pinning the prompt before it. Suggestions
[DESIGN-REVIEWED] fa9fbf6 Description read[DESCRIPTION-READ] 2cc5efb9f27661e74f6e58962899d41d41586648e459e40d0d128b61e95e2223 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
UX Review (Opus 5.5, fork) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS No first-time reader has looked at the pinned card staying on screen through the last reply; this fork lane can't run that read, so a human should check it. Watch
[UX-REVIEWED] fa9fbf6 Description read[DESCRIPTION-READ] 4b21ea9d0807d5dfc57a68e398f948fb4146e1f7b314516134d2314f89f0284a That sha256 names everything this verdict read: the PR description, plus the 5 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The forged-index guards are hardening that rides along: no defect was reported, and they patch 4 reads in one hook while 7 identical reads in 4 other files stay unpatched. Not justified as shipped
What this change shipsInventory (3 items) — 2 justifiedIntent: keep the pinned prompt card on screen while the reader scrolls through a final reply taller than the viewport. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] fa9fbf6 Description read[DESCRIPTION-READ] 4fd99cfc3c8366b9d1117db82dd317936b90a35d2cc8e987e3ca6032ab39df65 That sha256 names the PR description this verdict read. Recompute it with |
|
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
7f205fa to
fe41d0c
Compare
|
fe41d0c to
a497260
Compare
a497260 to
369b5e0
Compare
|
issue (blocking, security): Message HTML can forge the end-of-list handoff. Fixed in 369b5e0. The scan in The new test |
|
note (non-blocking): A human should wheel through one tall final reply before merge. Accepted, and left to the merging maintainer. The automated check is a headless Chromium step-sweep. It ran an isolated gateway on a long session, wheel-scrolled through the final reply in fixed steps, and took a screenshot at each step on both the left and right edge. On main the card is gone at every step once the reply's top passes the fold. With this change it stays at every step. The PR body embeds stills from that sweep. Headless Chromium doesn't animate smooth scrolling, so the sweep can't show frame-to-frame flicker during a smooth wheel scroll. That part needs the manual pass you describe: open a session whose last reply is taller than the window, scroll down with the wheel, and check that the card stays up the whole way. |
|
Rebased on main (695 commits) as 369b5e0. There were no conflicts and the rebase itself changes no behaviour. The same push includes the fix for GPT's forged-index finding. The pinned-prompt scan now ignores |
When the final row of a transcript (usually a reply taller than the viewport) scrolled past the fold, no mounted row was left below the hand-off line, so usePinnedPrompt found no hand-off index and dropped the banner. The card vanished while the reader was inside the answer and popped back the moment the reply's top fell under the fold again. When every mounted row has reached the line and the last of them is the end of the display list, that last row is treated as the row straddling the line: it stays readable and the prompt before it is pinned. A tall final prompt with no reply yet therefore never pins itself over its own row. A last mounted row short of the list end still pins nothing.
369b5e0 to
fa9fbf6
Compare
|
Fixed in fa9fbf6. The nested-row check is now a shared New test: The other |
|
Accepted. The evidence is still frames from a headless step sweep. That sweep wheel-scrolled the whole final reply and checked that the card was present at every step, but headless Chromium doesn't animate smooth scrolling, so it can't show flicker in motion. Whoever merges this should do the manual wheel pass through a tall final reply. |
|
Accepted. As the review says, the fork lane has no first-time reader, so neither screenshot has had a cold read. I'm leaving that to the maintainer's pass. |
|
Accepted and deferred. The nested-row guard is in this PR because the GPT lane raised a forged |
|
Accepted and deferred. |
|
Accepted. The headless sweep steps the scroll position through the whole final reply and checks the card at every step, but headless Chromium does not animate smooth scrolling, so it cannot show flicker. A maintainer should wheel through a tall final reply by hand before merging. |
|
Accepted as existing behaviour. The pinned card already sits over the top of every reply in the middle of a transcript while you read it; this PR makes the final reply behave the same way instead of dropping the card. Changing how much the card covers is a design change to the pinned-prompt feature itself (open PR #14769 works in that area), not part of this fix. |
iamwhatever
left a comment
There was a problem hiding this comment.
Approving (crew-pr-reviewer). The handoff looks only at real transcript row wrappers (isTranscriptRow), so a data-display-index copy inside message content cannot steer it. It also keeps the pinned prompt while the last reply is taller than the window. This is a frontend hook change with tests. CI is green and the base is main.
Problem / Motivation
Goal: The pinned copy of your prompt stays on screen while you read the last reply in a session, even when that reply is taller than the window.
Scroll down through the final reply of a session (a long answer with a big code block, say). Once the reply's top passes the fold, the pinned prompt card disappears. Scroll back up and it pops back in the moment the reply's top drops below the fold again. The card flickering in and out under the wheel makes scrolling feel broken.
Why it matters
The last reply is the one people read most, and long replies are where the card helps: it answers "what did I ask?" while you are deep in the answer. Today that is exactly where it vanishes, on every session whose newest reply is taller than the viewport.
Not a goal
What changed (motivation → approach → change)
The card needs a hand-off index: the first transcript row whose top is still below the fold.
usePinnedPromptfound it by walking the mounted rows. When the reader is inside the final row, every row is already above the fold, so the walk found nothing, the index stayed-1, and the banner was dropped.In
website/src/pages/chat/usePinnedPrompt.ts, when no mounted row is below the line and the last mounted row is the end of the display list, that last row is treated as the row straddling the line. It stays readable and is never swapped for the banner; the prompt before it is pinned. When the last row is a reply, that is the prompt the reply answers. When it is a tall prompt that has no reply yet, it stays a readable row instead of pinning itself and hiding its own tail. When the last mounted row is short of the list end, rows below are unmounted and the boundary is unknown, so nothing is pinned, as before.The scan now skips any
data-display-indexnode that sits inside another row. Real row wrappers are never nested, and the markdown sanitizer admits arbitrarydata-*attributes, so a nested node can only come from message content. Without the skip, a forged index in the last mounted row could pass for the end of the list and pin an unmounted prompt. The same check backs the hook's three by-index lookups (the pinned row, the incoming prompt and the jump target) through onefindTranscriptRowhelper. A plainquerySelectorreturns the first match in document order, so a forged copy in an earlier row would be measured in place of the real one. The otherdata-display-indexreads elsewhere inwebsite/srcare outside this PR.Backwards compatibility
Compatible: only the case that used to show no banner changes; every case that already found a row below the line takes the same path.
Tests
website/src/test/usePinnedPrompt.test.tsx:keeps the prompt pinned while reading a final reply taller than the viewport, run withrequiresMountedHandoffboth false and true. Both fail onmain(bannernull) and pass here.never pins a tall final prompt as its own stand-in, bothrequiresMountedHandoffvalues: a last prompt taller than the space below the fold is not pinned over its own row.pins nothing when every mounted row is above the line but rows below are unmountedkeeps the unknown-boundary case unpinned.ignores a data-display-index forged inside message content, bothrequiresMountedHandoffvalues. Both fail without the nested-row skip and pass here.measures the real incoming row, not a forged index earlier in the DOM. With a plainquerySelectorthe forged node is measured and the card is pushed 24px; here the push is 0.The existing pinned-prompt suites (
ChatPane.pinnedPrompt,PinnedPrompt.*,pinnedPrompt.*,useChatPageTranscriptEarlyController.coverage,UserMessage.pinnedStandinActions) pass.Manual verification
An isolated gateway (
spawn_feature_gateway, fixtureminimal) was seeded with one session: a 9-line prompt and a reply holding a 55-line code block. Headless Chromium at 1280x900 wheel-scrolled it in 20px steps while the card height was recorded at each step. Onmainthe card is present from 20px to 260px and gone from 280px to the end of the reply. On this branch it is present from 20px to the end.Screenshots / video
Same scroll position (560px), inside the final reply.
Before, on
main: no pinned card.After: the pinned prompt stays.
Related Issues
no linked issue: reported directly with a screen recording.
Pattern harvest
Not generalizable: the defect is one missing end-of-list case in a single boundary walk; the rule "a scan for the first element past a line must handle running off the end" is too generic for a lint.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)