Repository navigation
fix(native-chat): hide legacy resume command for structured history - #21282
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (10)
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe PR separates native structured sessions from legacy resume-command handling. Structured sessions skip legacy resume preparation, startup command construction, and copy-command actions. Their drag payloads can contain an empty command, while unstructured payloads still require a non-empty command. Tests cover resume gating, menu actions, preparation, and drag payload round trips. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The change hides the legacy copy action while preserving native structured-session reopening and valid drag behavior. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Important
The browse-list gating is correct and well tested, but the search-results path still exposes the legacy "Copy Resume Command" and a legacy CLI drag payload for native-owned sessions — the same guaranteed-to-fail action this PR removes. Details below.
Reviewed changes
- Copy-resume gating for structured rows —
aiVaultSessionRowResumeGatingnow returnscanCopyResumeCommand: falsewhenstructuredSessionis set, which removes "Copy Resume Command" from both the overflow and context menus. - Drag payload stops carrying a legacy command —
AiVaultVirtualRowskipsbuildResumeStartupfor structured rows andAiVaultSessionRowomitsrealHomeStartup; the serializer accepts a blankcommandonly whenstructuredSessionis present. - Preparation is skipped —
copyResumeCommandandprepareAiVaultSessionForResumeshort-circuit for structured sessions, so noaiVault.prepareSessionResumecall is made. - Tests — four files added/updated (53 tests); each new assertion fails without its corresponding production change.
⚠️ Search results still offer the legacy resume command for native-owned sessions
Every new gate reads row.session.structuredSession, but sessions rendered from search results are projected from AiVaultSearchHit, which carries no structured-ownership field. While searching, the panel renders search.sessions, so structuredSession is undefined on every row, usesLegacyResumeCommand stays true, and both the "Copy Resume Command" item and the legacy drag payload remain available for native-owned chats — the operation the host then refuses.
Technical details
# Legacy resume command still reachable from search results
## Affected sites
- `src/shared/ai-vault-search-contract.ts:36` — `AiVaultSearchHitSchema` carries `resumeCommand` but no `structuredSession`.
- `src/renderer/src/components/right-sidebar/ai-vault-search-session.ts:12` — `aiVaultSearchHitToSession` never sets `structuredSession`.
- `src/main/ipc/ai-vault.ts:282` and `src/main/runtime/rpc/methods/ai-vault.ts:90` — `projectStructuredAiVaultSessions` is applied to `aiVault.listSessions` only, never to `aiVault.searchSessions`.
- `src/renderer/src/components/right-sidebar/AiVaultPanel.tsx:165` — `sessions = searching ? search.sessions : history`.
- `src/renderer/src/components/right-sidebar/AiVaultVirtualRow.tsx:134` and `src/renderer/src/components/right-sidebar/ai-vault-session-resume.ts:243` — the new gates depend on `session.structuredSession`.
- Host-side backstop: `src/main/ipc/ai-vault-resume.ts:30` and `src/main/runtime/rpc/methods/ai-vault.ts:111` call `assertLegacyAiVaultResumeAllowed`, so the copy fails with `agent_session_conflict` / `agent_session_ownership_unknown`.
## Required outcome
- A native-owned session shown in search results must not offer "Copy Resume Command" and must not produce a legacy CLI resume drag payload, matching the browse-list behavior this PR establishes.
## Suggested approach (optional)
- Propagate structured ownership to search rows: either add an optional field to the search-hit contract (additive, safe for older readers) and project it, or cross-reference the already-projected browse list in `AiVaultPanel` and thread a structured-id set into the rows.
## Open questions for the human
- Is the search surface in scope here, or should it be tracked as a follow-up? Fixing it may need a small contract/projection change, which the PR notes it deliberately avoids.ℹ️ Nitpicks
AiVaultSessionActionMenuItems.tsx:45— the comment ononCopyResume("Absent for zero-turn sessions") now names only one of two reasons the prop is absent; structured sessions are the other. Worth a word.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

ELI5
Native structured chats are owned by the native session host, so the history list should not offer a CLI resume command that cannot work.
What Changed
Before, native-owned history rows exposed “Copy Resume Command” and could prepare the legacy resume command. Now that operation is hidden and skipped for native rows; ordinary CLI session rows keep it.
Why
The native ownership projection already identifies rows that cannot be resumed through the provider CLI. Gating the action from that capability keeps the menu and drag behavior aligned with the session owner instead of showing a guaranteed-to-fail operation.
Linked Issue
User-reported native session history regression; no issue number was provided.
Visual Proof
The local interactive button report is available at
artifacts/native-chat-history-buttons.htmlin the coordinator worktree.Testing
Review
Notes
The change is UI and capability gating only; no protocol, SSH, or platform-specific behavior changed.