Repository navigation
fix(chat): closed-session notice names the link text and keeps the full stop - #20214
Conversation
|
CI triage on head 3eed4ec:
[operator: bolichen97] |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check one thing: the punctuation pass is now needed only where there is no paragraph slot (tight list items, headings, table cells). Keep it only if those places need it. What this change shipsInventory (10 items) — 10 justifiedIntent: when a reader clicks a link to a closed session and it can't be opened, the notice should name what they clicked, leave the sentence whole and say when the session was deleted. This is a FIX (Closes #18588).
[FIRST-PRINCIPLES-REVIEWED] 10a8182 Description read[DESCRIPTION-READ] a89d9d926e231acdbd9089bd7875572ceecfa35c893895df46d833db9aef5679 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. Suggestions
[DESIGN-REVIEWED] 10a8182 Description read[DESCRIPTION-READ] 4ad7d3d3789b76db36b7639c310827c614750540f4c95da39a828c18c58f4834 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 |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Check shot-04: one session raises two notices with two different names ("the old run" and "chat-7-1784661951"), and the blind reader couldn't tell whether that was one failure or two. [UX-REVIEWED] 10a8182 Description read[DESCRIPTION-READ] c1c12e2f50ef856797822645f9e16a7b5926eec44e523bc60f194446403358dc That sha256 names everything this verdict read: the PR description, plus the 11 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 — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
3eed4ec to
9e7a2e7
Compare
[operator: bolichen97] |
[operator: bolichen97] |
[operator: bolichen97] |
[operator: bolichen97] |
9e7a2e7 to
5fa9786
Compare
[operator: bolichen97] |
[operator: bolichen97] |
[operator: bolichen97] |
[operator: bolichen97] |
5fa9786 to
0c57b38
Compare
[operator: bolichen97] |
[operator: bolichen97] |
[operator: bolichen97] |
[operator: bolichen97] |
[operator: bolichen97] |
[operator: bolichen97] |
[operator: bolichen97] |
[operator: bolichen97] |
[operator: bolichen97] |
0c57b38 to
10a8182
Compare
[operator: bolichen97] |
[operator: bolichen97] |
[operator: bolichen97] |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (12 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: the closed-session notice names the link text and renders below the paragraph, so the sentence keeps its full stop; covered by new MarkdownRenderer tests.
Problem / Motivation
Goal: When a link to a closed session cannot be opened, the reader sees a notice that names the link they clicked, keeps the sentence whole, and tells them when the session was deleted.
Three defects in the inline notice a
?sid=link shows when the closed session's check fails:Couldn't open chat-7-1784661951.for a link whose text isthe old run. The reader never saw that key.Why it matters
A reader who clicks a link in an old transcript is told about a key they cannot match to anything, reads a sentence split by a red notice with its period orphaned, and after a retry that meets a deleted session gets no answer at all, so they cannot tell whether the retry worked. The same deleted session clicked as a chip already gets a "was deleted" banner; the retry path should say the same.
Not a goal
What changed (motivation → approach → change)
useSessionChiptakes an optionallabel(the link's visible text). A failed target'stitleis the probed title when a probe answered, else that label, else the key, andMdAnchorhands thattitletoClosedSessionNoticeinstead of the key.A new rehype pass,
rehypeSessionRefPunctuationintreeTransforms.ts, runs after the sanitizer. For a session reference (an anchor whose href names a chat session, or a code span whose whole text is a session key) it moves the sentence punctuation at the start of the next text node onto the element asdata-session-trailing.MdAnchorandInlineCoderender that text right after the link or chip and before the notice, in every branch they can return;InlineCodereads it before itsdata-session*filter, so it never reaches the DOM. An authoreddata-session-trailingin raw HTML is stripped first, the waydata-fencedis, so a message cannot make a reference print text it does not end with.ClosedSessionNoticerenders below the paragraph. A paragraph that holds a session reference (holdsSessionRef) draws an emptydiv[data-paragraph-notices]right after itself and provides it throughParagraphNoticeSlotCtx; the notice portals into it, so the paragraph's text is never interrupted, whether the reference ends a sentence or sits in its middle. Where no paragraph provides a slot (a tight list item, a heading, a table cell) the notice renders in place as a line of its own, after the reference's trailing punctuation. Other paragraphs keep their exact DOM; the golden DOM snapshot pins the slot on the two fixtures that hold a session link.A definite "gone" is shared: when one reference's click or retry finds the session deleted, every mounted chip or link for that key drops together, notice included, so no second notice keeps offering Try again for a session the banner just called deleted.
In the retry, a fresh lookup that answers "no such session" goes through
ClosedSessionCtx.openwith the display title, the same call a click on a deleted chip makes. The chat page'sopenshows the "was deleted" banner and answersgone, which drops the target as before.useSessionChipis shared, so a backticked session chip's Try again takes the same hand-off, named by its key (the text the chip shows).textOfinmarkdown/elements.tsxis exported so the anchor can read its label.website/capture/closed-session-notice.*is the isolated capture entry andshoot-closed-session-notice.mjsthe script that produced the screenshots below.Backwards compatibility
Compatible: every existing call of
useSessionChippasses two arguments and gets the same answers; the rehype pass only touches text that directly follows a session-shaped?sid=href, and the moved punctuation is rendered back in place by the anchor, so rendered text is byte-identical when no notice is up.Removes nothing: the diff adds a parameter, a plugin and a prop; it deletes no path, key, record or public function.
Tests
website/src/test/MarkdownRenderer.closedSessionChip.test.tsx:?sid=link's notice names the link text (Couldn't open the old run.), not the key;?sid=link with no prose label falls back to the key;?sid=link stays the link's own next sibling, the notice follows it, and the rest of the sentence follows the notice;data-session-trailingin raw HTML is dropped, not printed;ClosedSessionCtx.openwith{ key, title: 'the old run' }and the chip drops;flex, notinline-flex).MarkdownRenderer.domGolden.test.tsx: the two fixtures holding a session link now pin the empty notice slot after their paragraph.Red on the base for the three defects (4 of the new cases fail on
origin/main), green with the fix: 32/32 in the file. The 60 MarkdownRenderer / InlineCode / ChatPage.closedSessionProvider test files (950 tests) pass;tsc -p tsconfig.app.jsonand eslint are clean.Manual verification
Captured with
node capture/shoot-closed-session-notice.mjsagainst this branch and againstorigin/mainwith the same harness: click the link, click the backticked key, then Try again, at 820px and 420px, dark and light.Screenshots / video
Before, 420px: the notice quotes the key and the period sits on its own line.
After, 420px: the period stays with the link; the notice names the link text and follows the sentence.
After, 820px: the notice sits below the paragraph; the sentence reads whole.
After, 820px, the same session as a backticked key: its period stays with the chip, its notice below its paragraph.
After, Try again on a deleted session: the page's "was deleted" banner, then the chip drops.
More
Before, 820px:
Before, Try again on a deleted session: nothing is said, the chip just drops.
After, light theme, 820px:
Related Issues
Closes #18588
Pattern harvest
Rule candidate: review-prompt
Pattern: an inline notice rendered as a React sibling of an anchor or chip splits the sentence; render it below the paragraph (portal to a slot the paragraph owns), with in-place-after-punctuation as the fallback.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)