Skip to content

fix(native-chat): hide legacy resume command for structured history - #21282

Merged
brennanb2025 merged 1 commit into
mainfrom
brennanb2025/native-history-hide-resume-command
Sep 18, 2026
Merged

brennanb2025 merged 1 commit into
mainfrom
brennanb2025/native-history-hide-resume-command

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​174 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​174
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​15 $\color{#cf222e}{\Huge{\mathbf{−}}}$​10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5

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.html in the coordinator worktree.

Testing

  • 53 focused tests passed.
  • Changed-code quality passed.
  • Scope excludes delete behavior, open-session navigation, and Continue in New Session.

Review

  • I manually tested these changes locally
  • Automated tests added/updated

Notes

The change is UI and capability gating only; no protocol, SSH, or platform-specific behavior changed.

@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: ca18b5f5-59cd-4ade-b3c5-4b16975875e6

📥 Commits

Reviewing files that changed from the base of the PR and between b66ef2e and 39c8e85.

📒 Files selected for processing (10)
  • src/renderer/src/components/right-sidebar/AiVaultSessionRow.tsx
  • src/renderer/src/components/right-sidebar/AiVaultVirtualRow.test.tsx
  • src/renderer/src/components/right-sidebar/AiVaultVirtualRow.tsx
  • src/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-resume.test.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-resume.ts
  • src/renderer/src/lib/ai-vault-session-drag.test.ts
  • src/renderer/src/lib/ai-vault-session-drag.ts
  • src/renderer/src/lib/ai-vault-session-resume-preparation.test.ts
  • src/renderer/src/lib/ai-vault-session-resume-preparation.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

The 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 39c8e

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 10 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: hiding the legacy resume command for structured history.
Description check ✅ Passed The description clearly explains the user impact, implementation, rationale, scope, and automated testing. It is mostly complete, but the Linked Issue section has no issue number, Visual Proof referen…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 — aiVaultSessionRowResumeGating now returns canCopyResumeCommand: false when structuredSession is set, which removes "Copy Resume Command" from both the overflow and context menus.
  • Drag payload stops carrying a legacy command — AiVaultVirtualRow skips buildResumeStartup for structured rows and AiVaultSessionRow omits realHomeStartup; the serializer accepts a blank command only when structuredSession is present.
  • Preparation is skipped — copyResumeCommand and prepareAiVaultSessionForResume short-circuit for structured sessions, so no aiVault.prepareSessionResume call 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 on onCopyResume ("Absent for zero-turn sessions") now names only one of two reasons the prop is absent; structured sessions are the other. Worth a word.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@brennanb2025
brennanb2025 merged commit f442a5c into main Sep 18, 2026
27 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant