Repository navigation
refactor(session-history): one decision for a row's open and resume offers - #28360
Conversation
A session row decided "can ▶ resume this" twice: once for the button's disabled state and again inside its click handler, and the chat/CLI and switch-to-pane offers were each gated inline. A second caller of those offers would have had to copy the same conditions again. - One projection, resolveAiVaultSessionRowChatActions, now decides every open/resume offer a row makes; ▶'s greyed-out state and its target come from the same value. - The panel's host-scope menu and per-session resume lookups move into their own hooks unchanged, and the session-list request reads the panel's workspace through one selector. The sidebar behaves exactly as before.
395ccd2 to
d29a88e
Compare
…history-panel-refactor
Review status: ready to merge (first of two)Why this exists. #28133 lets you type What changes for the user: nothing. The right sidebar's Agents → Agent Session History panel looks and behaves exactly as before. What moved:
Verified:
Deferred: nothing. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
ELI5
The Agents panel in the right sidebar (Agent Session History) lists past agent conversations and lets you reopen them. PR #28133 will show the same panel in a dialog when you type
/resumein a chat. To prepare for that, this PR tidies the panel's code first, with no change you can see: the sidebar looks and behaves exactly as before.What Changed
Before and after, for the user: nothing changes. Same rows, same buttons, same greyed-out ▶ where a session can't resume, same scopes and search.
Mechanism:
resolveAiVaultSessionRowChatActions(ai-vault-session-chat-action.ts), now decides those four, with the same rules as before. feat(native-chat): /resume in a structured chat opens Agent Session History #28133's Enter key reads the same function, so Enter matches what those buttons offer. The row's other actions (Resume in Worktree / New Tab, Continue in New Session, Copy Resume, drag to resume) keep their own checks, unchanged.AiVaultPanel.tsxunchanged: the host-scope menu (useAiVaultPanelHostScopeinai-vault-host-scope.ts) and the per-session "where does this live, where would it resume" lookups (use-ai-vault-panel-session-resume.ts). This keeps the panel under the file-length limit once feat(native-chat): /resume in a structured chat opens Agent Session History #28133 adds to it.selectAiVaultPanelWorkspaceinai-vault-panel-workspace.ts). For the active workspace it returns exactly what the old inline code did. feat(native-chat): /resume in a structured chat opens Agent Session History #28133 uses the same selector to bind a panel to a chat's own workspace.Why
The
/resumedialog in #28133 is the same panel mounted a second time, and its Enter key has to follow the same rules as the row buttons. Putting those rules in one function first means Enter can't drift from the buttons. Doing the refactor in its own PR keeps it reviewable as a pure move, with moved code that isn't also being edited. The alternative, leaving this inside #28133, mixed a refactor with a feature in one diff.Linked Issue
N/A: maintainer PR. It prepares #28133 (
/resumein native chat opens Agent Session History).Visual Proof
N/A: no visual or interaction change. The sidebar renders and behaves the same; this only moves and consolidates code.
Testing
ai-vault-session-chat-action.test.tspins what feat(native-chat): /resume in a structured chat opens Agent Session History #28133 depends on: ▶ resumes only while it is enabled and shown, and a search hit whose transcript is gone offers nothing.tab-session-history-switch.parity.test.ts) now runs the panel's real hook and the row's real function, instead of a hand copy of them.src/renderer/src/components/right-sidebar/andsrc/renderer/src/components/tab-bar/pass (372 files, 3160 tests).pnpm tc:webpasses.pnpm run check:code-quality:changedpasses.orca-ci-checkspassed 23 of 24. The one failure is thetypecheck:cistep, which runsbun check; this machine'sbunhas nocheckscript. The plainpnpm run typecheckstep in the same run passes, and CI covers the bun step.Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)