Repository navigation
feat(chat): open links to closed sessions through a per-key lookup - #18303
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that the per-key probe cache is cleared or updated when a session closes during the page's lifetime. If not, a chip for a session closed later may stay plain text. [DESIGN-REVIEWED] 0c8d2cd Description read[DESCRIPTION-READ] 84874b6bdb6e79404c87c0764021b7ea685edff81e50c46bfa62a16818e1be49 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 |
First Principles Review (Opus 5.5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The click-time re-check, the chip shown when the probe fails, and the inline Try-again notice add a second failure UI next to the one Not justified as shipped
What this change shipsInventory (8 items) — 5 justifiedIntent: let a reader open a closed session from a link or key in chat. This is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 0c8d2cd Description read[DESCRIPTION-READ] 33323eefd7b7a0b4639ee6e4e1146a81ebbe040650f5987ff24a341c52f54ba1 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS The failure notice names the raw key ( Watch
Suggestions
[UX-REVIEWED] 0c8d2cd Description read[DESCRIPTION-READ] bc9cca84a594f60b6131afef84baa475fa15914c642b707ac9c6b9bc3dabe92d That sha256 names everything this verdict read: the PR description, plus the 9 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: |
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: |
|
Addressed at 7b931bb:
|
7b931bb to
96a52c1
Compare
|
At 96a52c1 (rebased on current main):
|
96a52c1 to
08d7cbb
Compare
|
At 08d7cbb (rebased on current main):
|
08d7cbb to
9f0fbf6
Compare
|
|
|
|
|
|
Backend Lint & Type Check is red on main too (isort on |
Add GET /api/sessions/{key}/meta, which answers one session's list row
from a stat and its first line, or 404 when no transcript exists. App
callers see only transcripts they own, as on every /api/sessions read.
Chat chips and ?sid= links that miss the open roster now probe that one
full key and, when it exists, resume it the way the sidebar does.
Closes #9915
… link The meta probe re-reads app ownership with the row under the transcript lock, answers busy on a lock timeout, and returns only key and title. The chip's background probe stays silent. A click checks again: a session deleted since says so and drops its chip, and a failed check, in the click or in the earlier probe, shows an inline notice at that chip or link with a Try again action. The feature map gets its own row for closed-session links.
36e7b0d to
0c8d2cd
Compare
|
Rebased: main moved in files this PR touches since its last head, and #18999 fixed the main-side isort red ( |
|
|
|
|
|
|
|
|
iamwhatever
left a comment
There was a problem hiding this comment.
This makes a chat link or a backticked session key that names a closed session open that session. It adds a GET /api/sessions/{key}/meta probe and a chat-page context that offers the chip only after the gateway confirms the key exists, which fixes the real cause: the frontend had no way to look up one closed key. Our earlier CHANGES_REQUESTED asked for no code change, only dispositions. The author has now posted one per UX Watch item and per First Principles item, on 9c9425a and again on the current head 0c8d2cd. The scope ruling they cite is on #9915 (option a, 2026-10-08), and the deferred UX copy and layout items sit in #18588, which has the deferred-finding label, an assignee and a Due line. I re-read the backend handler at the current head and tried to break it again. Path tricks (.., /, .threads) and the chat-N vs dashboard_chat-N alias all go through has_log/list_sessions(keys=) and the same ownership check. App callers get the uniform 404 and an audit record for a key they do not own, checked both before and under the transcript lock. The response holds only key and title, which GET /api/sessions already returns. On the frontend, a forged key gets no chip, because a 404 answer is cached as null. A click checks again before resuming, so a stale cached answer cannot resume a deleted session. All latest checks are green and GPT/Opus have no blocking findings at this head, so our request is met and I lift it. — crew-pr-reviewer (deep re-check)
* fix(chat): keep a touch text selection where the reader put it On a phone, selecting transcript text failed three ways: - a handle dragged under the composer dock, the chat header or the phone top bar (which hosts the session title) landed in their text, and the selection took everything in between; - scrolling with a selection unmounted the row holding its start, and the browser re-rooted the start at the top of the transcript; - a start row re-rendered while scrolled away left the start parked between rows, walked up to offset 0 as rows mounted above it. (The fourth case from the original PR, a long-press opening the bubble context menu, is already fixed on main by #18340 and is dropped here.) Fix: - make the header, the dock and the shell top bar inert while a transcript selection is held (touch only); - add retainRange to the virtualizer: every window write keeps the selection's rows mounted; - remember each endpoint as row + character offset, and put an endpoint that leaves its row back where it last sat. A fresh long-press, with no settled position yet, is never rewritten. Replaces #18491. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: cixuuz <26782336+cixuuz@users.noreply.github.com> * test(chat): give the closed-session provider mock retainRange ChatPage now calls retainRange on selectionchange; this test landed on main (#18303) after the original PR, and its useVirtualChat mock lacked the new member. --------- Co-authored-by: Premshay <28099628+Premshay@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: cixuuz <26782336+cixuuz@users.noreply.github.com>
Problem / Motivation
Goal: A chat link or session-key chip that names a closed session opens that session, the way its row in Older sessions does.
Session links in chat (
/chat?sid=<key>and a backtickedchat-N-<ts>key) only resolve against the sessions open in the sidebar. A link to a closed session whose transcript is still on disk renders as plain text, and its?sid=click is declined. An orchestrating session that hands you links to earlier work sessions cannot take you to any of them once they are closed.Why it matters
Looking back at earlier work is the main reason to link a session. Today every such link goes dead the moment its session is closed, so the reader has to search for the session by hand.
Not a goal
chat-7, no timestamp). Slot numbers are reused, so a short name cannot say which past session it means; it still resolves only against open sessions.kirocrew://URL scheme to deeplink into a specific chat session #6792, Dashboard: Support external URL scheme links (idea://, vscode://, cursor://) #3218).What changed (motivation → approach → change)
A link to a closed session now opens it, the same as its Older sessions row. Before, the chat only knew the open sessions, so the link went dead. Asking for the whole session list does not help: it is paged, and reading a full transcript is slow.
unchangedopens itunchangedopens itaddeda live chip; the click resumes itunchangedplain textaddedthe click says it was deleted; nothing resumesaddedthe click shows "Couldn't open ..." with Ask the agent and Try againchat-7unchangedopen sessions onlyLegend:
added,changed,removed,unchanged.The server gets one small read,
GET /api/sessions/{key}/metaindashboard/handlers/sessions.py(routed inroutes/system.py). It answers one session's key and title, or 404, without reading the transcript or scanning a folder. It follows the same access rule as the other session reads: an app sees only its own sessions, and any refusal looks like a missing key. The chat page (website/src/pages/ChatPage.tsx) asks it once per key throughwebsite/src/api/client/sessions.ts, and the chips and links inwebsite/src/components/markdown/use the answer. The new notice strings are in every locale underwebsite/src/i18n/, anddocs/names the new route.Backwards compatibility
Compatible: one new read route and an opt-in context. Open-session chips and links resolve through the unchanged path, and hosts without the provider keep today's rule.
Removes nothing: the diff only adds a route, a context and a fallback after the existing open-roster lookup.
Tests
test/test_dashboard_session_meta.py(real auth middleware and route table): a closed session answers its row by slot key and by stem; a missing key is 404, not an empty 200; the probe reads no transcript body and does no directory scan; an app cannot probe a transcript it does not own (user-owned or another app's) and can probe its own; ownership that changes hands as the lock is taken is refused (red without the locked re-check); a lock timeout answers 503session_busy.website/src/test/MarkdownRenderer.closedSessionChip.test.tsx: a backticked closed key becomes a chip that resumes it; a?sid=link to a closed session resumes on click; an open session still switches with no probe; an unknown key stays plain text; a short name, an offline render, and a host without the provider never probe; each key is probed once across renders (red on main, where the closed key stays inert). A chip whose click finds the session gone drops; a failed probe raises nothing until the reader clicks; a click on a chip whose probe failed shows the inline notice naming the session, and Try again opens it; a retry that fails again keeps the notice up; the notice holds two actions; one chip's failed check does not drop another chip for the same key; a?sid=link whose probe failed shows the notice beside the link on click; a click whose own check fails shows the inline notice.website/src/test/ChatPage.closedSessionProvider.test.tsx: the background lookup answers stem and title, a 404 is a quiet null, and a failed lookup raises nothing; a click whose check fails answersfailedwith no page banner and no resume; a click on a deleted session says it was deleted and does not resume; a click on a session that still exists calls the resume route.ApiClient.refactor.surface.test.tslists the newsessionMetamember.MarkdownRenderer.sessionChip,ChatPage.sessionChipOffline,ChatPane.sessionLinks,chatCards.sessionLink,renderUserContent.sessionLink,ChatPage.noteSessionLink) andtest_app_route_trust_gate.pypass unchanged.Determinism:
test_dashboard_session_meta.pypassed 20 of 20 runs at-n0, 10 of 10 at-n 4 --dist loadgroup --max-worker-restart=2besidetest_app_route_trust_gate.pyandtest_dashboard_sessions_clear.py, and in a shuffled order (seed 11765). The two new frontend suites passed 20 of 20 repeats and a shuffled run (--sequence.shuffle --sequence.seed=11765).test_flake_pattern_ratchet.pypasses.Manual verification
On a pod built from the head commit, with real transcripts seeded on disk, a browser script checked each step below, that nothing showed before a click, that the notice was one line, and that Try again was disabled while busy.
Screenshots / video
All taken on a pod built from the head commit: the real chat page with real transcripts on disk.
A reply names two closed sessions by key (both now chips) and links a third whose check will fail. Nothing shows before a click.
After clicking the link whose check failed: one line at that link names the session and offers Ask the agent and Try again.
At a 320px-wide viewport the same notice wraps inside the message, so both actions stay visible (real
MarkdownRenderer; the check is stubbed to fail).While Try again runs: the button is disabled until the check answers.
After clicking the chip of a session deleted since the page loaded: the page says it was deleted, and that chip turns back into plain text.
After clicking a working chip: the closed session is resumed and open in the chat page and the sidebar.
Related Issues
Closes #9915