Skip to content

feat(chat): pinned-prompt banner sticks in ChatPane too (chat-core P5-d) - #9538

Merged
chenmingwei23 merged 1 commit into
mainfrom
feat/chat-core-p5b-pinned-prompt
Sep 9, 2026
Merged

chenmingwei23 merged 1 commit into
mainfrom
feat/chat-core-p5b-pinned-prompt

Conversation

@CrysisDeu

@CrysisDeu CrysisDeu commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Closes #9527

Summary

The main chat pins the current turn's user prompt under its title row as you scroll (PinnedPrompt); ChatPane — Crew Members DM threads and split-view panes — had none of it. This PR sinks the banner into ChatPane (chat-core RFC P5-d, "ChatPage-only chrome sinks into the shared surfaces" — labelled P5-b when opened; renumbered after #8733/#9577 took P5-b/P5-c on main) with zero behaviour change on ChatPage.

  • pages/chat/usePinnedPrompt.ts (new) — the DOM-driven pin geometry extracted verbatim from useChatPageTranscriptEarlyController: updatePinnedPrompt, rAF-coalesced onScrollPin, pinnedJumpChrome, expanded/collapsed state, fold + card refs, displayItemsRef. Plus jumpToPinnedPromptInPlace: the self-driven converging glide for an UNVIRTUALIZED transcript (every row mounted), aborted by user scroll intent.
  • useChatPageTranscriptEarlyController now calls the hook and returns the same shape; only the virtualized jump (mountIndex → navToDisplayIndex) stays page-side. Same DOM, same class names, same data-testid="pinned-prompt"; existing pinned tests untouched.
  • app-sdk/ChatMessageList gains an opt-in seam: onDisplayItems reports the grouped list from a layout effect (rows are in the DOM when the host reads it) and turns row indexing on — each display item is wrapped in a data-display-index block; hiddenRow names the ONE row to hide (the bubble the banner stands in for; ts-keyed with an index fallback, the rule living in the list once rather than in every host). Off by default — the embed SDK's DOM is byte-identical.
  • ChatPane mounts the hook + <PinnedPrompt> in a zero-height band between the top edge fade and the scroller. Fold = the scroller's top edge: under the pane's own title bar in split view, under the HOST header in frameless mode (Members DM) — the band is anchored inside the pane root, so it can never paint over that header. Honours chatConfig.pinLastPrompt; resets on slot switch; row hide is identity-keyed by ts exactly as ChatPage does; pinnedImageUrl thumbnails come for free.
  • RFC §4.2 gets a P5-d row.
  • Rebased onto main after fix(chat): keep the pinned banner on the row that opened the turn #9594 (steer rows no longer count as prompts — isPrompt in utils/pinnedPrompt.ts, consumed unchanged by the shared hook) and refactor(chat-core): drop ChatPage's duplicate stop_event / notice / mcp_oauth rows (P5-c) #9577 (P5-c).

Respects the #8714 revert: the banner is main's current full-card form, not the minimized corner chip.

Screenshots (real pod, seeded member DM with 6 turns)

light dark
Members DM — prompt scrolled behind the fold pins under the host header; its bubble row hidden
Image prompt — inline thumbnail via pinnedImageUrl
Expanded (chevron)
After clicking the banner — glided back to the prompt
Split view — both panes pin under their own title bars

Recording (motion cannot be judged from a still): 06-members-dm-pin-and-jump-light.webm — the Members DM scrolled by wheel steps through the bubble→banner hand-off and push-out, then the click-to-jump glide (9 s, trimmed to the on-tape load).

Harness: website/scripts/capture-chatpane-pinned-prompt.mjs (asserts before every frame: banner text, hidden row, band anchoring, thumbnail count, jump direction; records the .webm with Playwright and trims the priming navigation with Playwright's own ffmpeg).

Review dispositions

  • First Principles (CONCERNS, rowStyle generalized for one consumer) — adopted: rowStyle?: (item, index) => CSSProperties replaced by hiddenRow?: { ts?: string | null; index: number }; the ts-vs-index shift rule now lives in ChatMessageList once, and the SDK barrel publishes a narrow hidden-row key instead of arbitrary per-row CSS.
  • UX (CONCERNS, no recording) — adopted: .webm above, committed and SHA-pinned.
  • First Principles round 2 (CONCERNS, indexRows redundant with the two props that consume it) — adopted: the flag is gone; row indexing is inferred from onDisplayItems != null || hiddenRow != null. Hosts passing neither (ChatEmbed, SideChat, spec-builder) keep the byte-identical DOM.
  • UX rounds 2–3 (CONCERNS, dark-theme thumbnails read as a rendering defect) — adopted in the shared PinnedPrompt: the thumbnail ring was ring-inset, and an inset box-shadow paints BELOW an <img>'s replaced content, so on an opaque image it never showed at all; an outset ring-border-strong (round 2) was still too faint on the dark card. Round 3, as the lane suggested: a solid bg-muted plate showing through the image's own padding (p-px inline, p-0.5 in the expanded strip) — a real frame an opaque bitmap cannot cover, mid-grey in both themes, inside the element's box so bubble parity is untouched. This is the one deliberate shared-component change in this PR (ChatPage's thumbnails gain the same frame). All frames + recording re-shot; the seeded image is now a landscape screenshot so the thumbnail's aspect is representative.
  • UX round 4 (CONCERNS, expanded card shows the authored blank line under the hoisted image strip) — not changed here: promptBody preserves the user's own paragraph breaks by design (its docblock), and altering it changes the main chat's expanded card too, outside this PR's zero-ChatPage-change contract. Recorded on #9569 alongside the other two shared-component items.
  • UX watch items (jump affordance only hinted by hover title; thumbnail click jumps rather than enlarges) — both inherited from the shared PinnedPrompt the main chat already ships, and this PR's contract is zero ChatPage behaviour change; filed as #9569 on the shared component rather than fixed as a pane-only divergence.

Tests (written, CI runs them)

  • src/test/usePinnedPrompt.test.tsx — geometry-derived pin (text + images), rAF coalescing, disable/re-enable, no-prompt case, in-place glide landing (row.top − chrome), user-scroll abort, unmounted target.
  • src/test/ChatPane.pinnedPrompt.test.tsx — data-display-index rows + fold sentinel, pin + row hide on scroll, pinLastPrompt=false, frameless anchoring, click-to-jump.
  • ChatPage's existing pinned tests (useChatPageTranscriptEarlyController.coverage, PinnedPrompt.nudgeExpand, pinnedPrompt.pasteTokens) unchanged.

Local: tsc -b clean, eslint clean on every touched file, I18N_BASE_REF=origin/main node website/scripts/i18n-check.mjs passes (no new strings — the banner reuses pages.chat.pinnedPrompt.*).

@CrysisDeu
CrysisDeu requested review from a team and buluoray September 8, 2026 20:49
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 342b1acdbbd8227e7649b99ec1a37b2c09db6b02 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verbatim hook extraction plus an opt-in, review-narrowed SDK seam — the right shape for RFC P5-d, with real evidence (tests, recording, real-pod frames).

Suggestions

  • The ts-vs-index hidden-row predicate now exists twice — ChatPage.tsx:7220 (virtualized path) and ChatMessageList.renderDisplayItem — while the new prop docblock claims the rule "lives here once". The "two stacked boxes" bug this rule fixed can now regress in whichever copy a future edit misses; extract the three-line match into utils/pinnedPrompt.ts beside its sibling helpers and call it from both.

[DESIGN-REVIEWED] 342b1ac

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 342b1acdbbd8227e7649b99ec1a37b2c09db6b02 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Verify the THUMB_FRAME thumbnail plate on the main chat's banner — the one declared exception to this PR's zero-ChatPage-change contract.

What this change ships

Inventory (8 items) — 8 justified

Intent: let a reader of a long reply in a Members DM or split pane keep the turn's own prompt in view — an ADDITION (closes #9527; RFC chat-core P5 "ChatPage-only chrome sinks into the shared surfaces", with merged prior phases P5-a/P5-b).

  1. Members DM and split panes now pin the scrolled-away prompt under their header — justified
  2. Clicking the pane banner glides back to the prompt (new in-place glide; virtualization constraint keeps ChatPage's mount-then-scroll jump separate) — justified
  3. Pane banner obeys the existing Settings → Chat pin toggle; no new knob — justified
  4. Prompt thumbnails gain a mid-grey plate frame, on the main chat too — justified
  5. ChatMessageList gains opt-in onDisplayItems/hiddenRow; grepped: of 4 hosts (ChatPane, ChatEmbed, SideChat, spec-builder), 1 consumer each, non-generalized shape, DOM unchanged when unset — justified
  6. Pin geometry extracted verbatim into usePinnedPrompt (2 consumers: controller, ChatPane) — justified
  7. Capture harness + committed frames/recording — justified (repo convention: 442 sibling capture-*.mjs, 1393 files under temp-screenshots/)
  8. Feature-map and RFC §4.2 rows — justified (same-commit doc rule in AGENTS.md)

Cross-checks run: glideOnceStep/pollRowSettled in utils/searchScroll.ts do a different job (native-scroll step / converge-until-settled), so item 2 is not a second spelling; data-display-index emission stays split between ChatPage's Virtuoso wrapper and the list because virtualized rows never pass through ChatMessageList's map; item 4's provenance is the quoted UX measurement (inset ring paints below replaced <img> content), declared as the one shared-component change.

[FIRST-PRINCIPLES-REVIEWED] 342b1ac

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — 🟡 CONCERNS

UX-level review of 342b1acdbbd8227e7649b99ec1a37b2c09db6b02 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Both screenshots render cleanly — banner anchors under the host header/pane title bars, the dark-theme thumbnail frame reads correctly, no clipping or overlap. The reconciliation is complete: every added surface (pinned collapsed/expanded, image strip, after-jump, split view, frameless, both themes) is screenshotted, the bubble→banner hand-off and jump glide have a committed recording, and the blind reader correctly identified the banner and its fold. Two comprehension gaps the reader hit are exactly the two items the PR already filed as #9569.

UX-Verdict: CONCERNS

The banner itself reads perfectly cold; its two click actions don't — the blind read just turned #9569's hypotheses into confirmed misreads.

Watch

Suggestions

[UX-REVIEWED] 342b1ac

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed 342b1acdbbd8227e7649b99ec1a37b2c09db6b02 — this comment is updated in place on each push.

Review details

Both candidates die under falsification.

Candidate 1 (one-frame banner flash when the setting is OFF): the mechanism rests on the child ChatMessageList layout effect firing updatePinnedPrompt before ChatPane's passive config effect sets pinEnabledRef=false. That ordering claim is sound, but the observable outcome — a painted banner — additionally requires updatePinnedPrompt to compute a non-null pinned state on the very first layout-effect fire. That is contingent on the scroller already sitting bottom-pinned with a prompt fully behind the hand-off line at that instant, whereas on initial mount the scroller starts at scrollTop=0 and the follow controller's bottom-pin is itself a separate effect. I cannot re-derive (c) an observable wrong outcome without assuming geometry/timing I did not confirm; it stays below the bar, and its worst case is a single-frame cosmetic flicker (no crash/data/security).

Candidate 2 (per-row wrapper div causes spacing/anchor drift): the finding is stated in "possible" / "if any container relies on direct-child selectors" terms, the wrapper carries no class and takes the row's own box, indexing is gated to hosts that opt in, and the change is validated by the committed screenshots. (a) and (c) are speculative — dropped.

No new grounded finding survives in Step 2.

No findings.

[OPUS-REVIEWED] 342b1ac

Verdict parsed from the review's SHA-scoped output markers for commit 342b1acdbbd8227e7649b99ec1a37b2c09db6b02.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 342b1acdbbd8227e7649b99ec1a37b2c09db6b02: <one-sentence reason>

@CrysisDeu
CrysisDeu force-pushed the feat/chat-core-p5b-pinned-prompt branch from e56e77e to f59125a Compare September 8, 2026 21:10
@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 342b1acdbbd8227e7649b99ec1a37b2c09db6b02 and found no blocking issues.

This comment is updated in place on each push.

Review details

FINDING -- website/src/app-sdk/ChatMessageList.tsx:298 -- duplicate prompt timestamps make item.msg.ts === hiddenRow.ts hide multiple rows -> Fix: carry and match meta.mid, using the index only as a legacy fallback.

[GPT-REVIEWED] 342b1ac

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 342b1acdbbd8227e7649b99ec1a37b2c09db6b02: <one-sentence reason>

@CrysisDeu
CrysisDeu force-pushed the feat/chat-core-p5b-pinned-prompt branch 3 times, most recently from 4a1ccd7 to d4371b4 Compare September 8, 2026 22:41
@CrysisDeu
CrysisDeu force-pushed the feat/chat-core-p5b-pinned-prompt branch 2 times, most recently from 957ab59 to bfe0554 Compare September 8, 2026 23:21
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 8, 2026
@CrysisDeu CrysisDeu changed the title feat(chat): pinned-prompt banner sticks in ChatPane too (chat-core P5-b) feat(chat): pinned-prompt banner sticks in ChatPane too (chat-core P5-d) Sep 9, 2026
@CrysisDeu
CrysisDeu force-pushed the feat/chat-core-p5b-pinned-prompt branch from bfe0554 to f02eb2d Compare September 9, 2026 01:08
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Sep 9, 2026
@CrysisDeu
CrysisDeu force-pushed the feat/chat-core-p5b-pinned-prompt branch from f02eb2d to 342b1ac Compare September 9, 2026 01:51
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 9, 2026
@bolichen97
bolichen97 enabled auto-merge (squash) September 9, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chat-core P5-d: PinnedPrompt sticks in ChatPane too (Crew Members DM, split panes)

2 participants