Repository navigation
feat(dashboard): reopen closed sessions with Cmd/Ctrl+Shift+T - #30177
Conversation
Add a rebindable reopen-chat command under Actions. Each user close (Cmd+W, the sidebar X, session menus) that lands is recorded on a per-tab in-memory stack; the chord pops it newest first and resumes the session through the same path History and the command palette use, so the transcript comes back intact. Sessions on a surface the chat page cannot show are never recorded. The desktop menu's Refresh Token moves from CmdOrCtrl+Shift+T to CmdOrCtrl+Alt+T so the chord reaches the renderer. Fixes #18969
ChatPageMoreCoverage.test.tsx reached 2,018 lines once merged with main, over the 2,000-line cap. Move the two resumeFromHistory leaveSplit tests this PR added into ChatPage.reopenLeavesSplit.test.tsx with only the setup they need. The old file is back to its main blob. Co-authored-by: Hung Vu <hungvu@amazon.com>
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: Notes
[DESIGN-REVIEWED] 5f770c9 Description read[DESCRIPTION-READ] 69825ebd15503177e77fbe8985f981e5721de6df469716fb63997e8fb51cf82d 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 |
buluoray
left a comment
There was a problem hiding this comment.
🤖 Kiro Crew Auto-Pipeline [operator: buluoray]:
🤖 Kiro Crew Auto-Pipeline [operator: buluoray]:
Approving 5f770c9. This carries #20437, which I approved on 25a04fb, rebased onto main so the PR has two commits again.
I compared the two with git range-diff against each one's merge base. Both commits match the reviewed ones. The only differences are context lines in ChatPageMoreCoverage.test.tsx, where the neighbouring describe block changed on main. Hung Vu stays the author of the feature commit, and the line-cap commit's author changed from w to bolichen97. No source line differs.
My earlier review of #20437 still stands for this code. The shortcut reopens through the existing resumeFromHistory and slot resume route. The backend only adds a read-only history_key field. Both of bolichen97's points are fixed (held-chord auto-repeat, resume.py at the line cap). The non-blocking follow-ups from that review carry over, most notably that a session closed and then permanently deleted reopens as an empty session under its old title.
CI on this head was still running when I posted; no check had failed yet. I did not re-run the tests locally for this head, because the code is unchanged from the head I tested.
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: every item comes from the stated goal or from a chord conflict that would otherwise swallow the keystroke. One layout rider is a note. Notes
What this change shipsInventory (8 items) — 7 justifiedIntent: undo an accidental session close with Cmd/Ctrl+Shift+T, the way a browser reopens a closed tab. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 5f770c9 Description read[DESCRIPTION-READ] 8c7b76d60b6d540fd92fda7bccb20d690cdbd57a1aa6bcdcd0aa013ab3e0ade3 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of UX-Verdict: PASS cannot evaluate: missing the "No recently closed sessions." notice. The notice card in shot-05 shows a different message, "invalid agent name", so nobody has seen what the new empty-stack feedback looks like. Evidence gaps
Notes
[UX-REVIEWED] 5f770c9 Description read[DESCRIPTION-READ] 89a9700394085e3c8dae44f19c417219ff7752e787369becabbedfc908d99cfc That sha256 names everything this verdict read: the PR description, plus the 12 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: |
GPT 6.1 Review — ✅ no blocking findings (all downgraded on adjudication)GPT 6.1 flagged blocking issues on This comment is updated in place on each push. Review detailsBLOCKING -- website/src/hooks/useKeyboardShortcuts.ts:1110 -- A delayed reopen overrides a newer reopen choice
Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 — LOW. This needs three things at once: the user presses reopen twice (repeats are dropped, False positive or not applicable? A repository writer can comment: |
Supersedes #20437, original work by @hungtnvu.
#20437 picked up a merge commit from
Update branch, and PR Hygiene allows only 1 or 2 commits with no merge. This PR carries the same two commits rebased onto currentmain: @hungtnvu'sfeat(dashboard)commit unchanged (author kept), and the line-cap test split (Co-authored-by: Hung Vu). The rebase also picks up main's fix for the flakytest_the_row_names_no_routed_id_the_child_may_have_withheld(#29982).Problem / Motivation
Goal: Let a user reopen a session they just closed with Cmd/Ctrl+Shift+T, the way a browser reopens a closed tab.
Closing a session is one keystroke (Cmd/Ctrl+W), but undoing an accidental close means opening History, finding the conversation and clicking it. No shortcut or command reopens a closed session, so there is nothing to bind one to either.
Why it matters
Accidental closes are common when working across several sessions from the keyboard, and the recovery path breaks that flow every time. Cmd/Ctrl+Shift+T is the reopen convention in every browser, terminal and editor, so it is the chord users already try.
Not a goal
What changed (motivation → approach → change)
reopen-chat, in the Actions group of the shortcut registry, so it appears in the Cmd+/ reference and is rebindable in Settings → Shortcutswebsite/src/lib/recentlyClosedSessions.ts)setAgentSwitchNotice, the same status card and 6-second expiry that focus mode and a deferred model switch already use for neutral messages. No new state, reducer or component;App.tsxandchatSlice.ts's reducers are unchanged from mainhistory_key, the transcript session key the backend's ownslot_history_keyrule picks (src/kiro_crew/dashboard/slot_projection.py), unfolded, so a channel session (including a Slack thread whose transcript predates theslack:<ts>key migration) reopens its real transcriptleaveSplittoresumeFromHistory, which records it on main's existinglastResumeActivation, and the chat page leaves Split View on it the way it already does for a new chat's activation (website/src/pages/chat/page/activeSlotState.ts). Other resumes (History, the command palette) are unchangedwebsite/src/apps/file-explorer/FileExplorerPage.tsx), so the chord does not also open a tab thereA close is recorded only when the user closed the session (Cmd+W, the sidebar ✕, a session menu). It is recorded at the press, so Cmd+Shift+T right after Cmd+W finds it and rapid closes keep their press order, and if the server refuses the close, only that close's own entry is dropped, so a refused close is never offered and a later successful close of the same session keeps its entry. Reopen first waits for that close to finish (and, when it was refused, for each older entry it falls back to), so a close still waiting on the next session's transcript cannot clear the reopened one when it lands. Only then does it ask the leave guard, once, against the page on screen at that moment; a declined leave puts the entry back for the next press. If a close is slow, the leave prompt therefore appears after it finishes rather than at the press. Swaps that retire a tab for another one, bulk cleanup and apps closing their own sessions are not user closes and are not recorded. Sessions on a surface the chat page cannot show are skipped. Incognito and temporary sessions are recorded, because their transcript stays in History for the user to reopen (
docs/decisions/2026-09-25-incognito-and-temporary-chats-keep-their-transcript.md).Reopening uses the same
resumeFromHistorypath as History and the command palette, keyed by the recorded transcript key rather than the dashboard slot key. A session bound to Slack or another channel keeps its transcript under that channel's key, so guessingdashboard:<key>would open an empty session. The key is sent unfolded becauseConversationLog._pathfinds a pre-migration Slack thread's bare<ts>.jsonlonly from theslack:<ts>spelling. The backend sends the key it uses (typed inwebsite/src/types/index.chat.ts; the resume response stays untyped like the rest of main's resume thunk, andresumeFromHistoryinwebsite/src/store/chat/lifecycle.tscopies itshistory_keyonto the slot row), and the client never guesses one: a slot withouthistory_keyis not recorded. The jump to/chatgoes through the draft guard (useGuardedLeave), like the notification panel's resume. The session leaves the list only once leaving is allowed, a failed resume puts the same entry back, and a session that is already open again is skipped, matched by slot key or byhistory_key, so a linked session reopened from History under its folded transcript key counts as open.In the shortcuts reference (
website/src/components/ShortcutsModal.tsx) a combo's keys never split across lines: a row breaks only between combos. From thesmbreakpoint up the label stays on one line, with a gap of at least 12px (sm:gap-3) before its keys; below it each row puts a full-width label above its combos, so a narrow window never squeezes the label into a one-word column. The two new strings are in every locale catalog underwebsite/src/i18nand the pseudolocale.website/electron/README.mdnames the new Refresh Token chords.Backwards compatibility
Breaking: the desktop app's Connection → Refresh Token menu accelerator moves from CmdOrCtrl+Shift+T to Cmd+Alt+T (macOS) and Ctrl+Alt+Shift+T (Windows/Linux). Writer sweep on origin/main @ 6f92c0e:
website/electron/app-menu.js(the only accelerator, moved),website/electron/README.md(updated),website/electron/window-lifecycle.jstray item (no accelerator, unchanged). The Mochi app's owntoggleWindowdefault is a separate global shortcut in its own store and is untouched.The slot payload's and the resume response's
history_keyis a new optional field; older clients ignore it, and the client still works against a gateway that omits it. Removes nothing: no command, route, record or setting is removed; one menu accelerator moves.Tests
website/src/test/reopenClosedSession.test.tsx: the stack order, dedupe, cap and filters; the transcript key is the backend'shistory_key, and a slot without one is not recorded; the chord on both platforms and the alias; Cmd+W then reopen throughapi.resumeChatSlot; the close is recorded at the press while the DELETE is still pending, and rapid closes keep press order; a refused close is not offered, and a late refusal leaves a newer close of the same session in place; reopen during a close that is still loading the next session's transcript waits for it and the reopened session stays active with its transcript; a leave guard dirtied on another route during that wait is asked once after it, and declining keeps the entry; the same holds when the newest pending close is refused and reopen falls back to an older, already-closed entry; a declined leave keeps the page and the entry; an allowed leave lands on/chat; nothing to reopen sets the shell notice and asks nothing; a failed channel reopen keeps its key for the retry; a reopened session closed again before any slots update is still offered, because resume carrieshistory_keyonto its optimistic row; a session already reopened from History under a different slot key is walked past; the reference row keeps each combo's keys together; a held chord's auto-repeats reopen nothing more; reopen asks the page to leave Split View.website/src/test/ChatPageMoreCoverage.test.tsx: a resume withleaveSplitleaves Split View and shows the resumed chat; one without it keeps Split View.website/src/apps/file-explorer/FileExplorerPageCoverage.test.tsx: Cmd/Ctrl+Shift+T on the File Explorer does not open a folder tab, and plain Cmd/Ctrl+T still does.test/test_slot_history_key_projection.py:history_keyfor a dashboard slot, a linked Slack slot and an unbound channel-origin slot is the unfoldedslot_history_key; a pre-migration Slack thread's key resolves to its legacy<ts>.jsonl, and reopening by it through the resume route restores that transcript (fails with the old folded key); the resume response, fresh and already-live, returns the samehistory_keyas the slot list.website/src/hooks/useSessionActions.cov80.test.tsx: a sidebar/menu close is offered once it lands; itsdeleteSlotmock is thunk-shaped, matching whatclosedispatches.website/electron/test/app-menu.test.js: Refresh Token is on Cmd+Alt+T / Ctrl+Alt+Shift+T and no menu item claims Shift+T.Manual verification
Rendered from a production build of this head with
website/scripts/capture-shortcuts-registry.mjs,website/scripts/capture-settings-accelerator-caption.mjs(Connection menu built from the realbuildMenuTemplate, which also asserts the macOS caption) and a scratch variant of them. Closed and reopened a session with the browser aliases (Alt+Shift+W, then Alt+Shift+T) against the built SPA with a stubbed API: the close sentDELETE chat-2, the reopen sentresume dashboard_chat-2, and the transcript came back. Checked Settings → Shortcuts in browser and macOS desktop hosts, the Cmd+/ reference at 1280px and 360px, the Windows Connection menu, and the chord with nothing to reopen. Typecheck, the website build and the related frontend and backend tests pass locally.Screenshots / video
Closing "Fix the flaky upload retry test" with Alt+Shift+W, then reopening it with Alt+Shift+T, browser tab at 1440px:
Settings → Shortcuts, browser tab: the new row under Close session, Alt+Shift+T leading and Ctrl+Shift+T marked desktop-app-only.
Windows Connection menu: Refresh Token on Ctrl+Alt+Shift+T. On macOS the native menu shows ⌘⌥T.
Pressing the chord with nothing to reopen shows "No recently closed sessions." in the shell's existing notice. It is the same card a failed agent switch uses, unchanged from main, shown here with the agent-switch message:
macOS desktop row and the Cmd+/ reference
Related Issues
Fixes #18969
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)