Skip to content

fix(ai-vault): name a remote session's host by its label, delete advice only where safe - #25169

Closed
brynnclaw wants to merge 2 commits into
stablyai:mainfrom
brynnclaw:fix/ai-vault-remote-host-delete
Closed

brynnclaw wants to merge 2 commits into
stablyai:mainfrom
brynnclaw:fix/ai-vault-remote-host-delete

Conversation

@brynnclaw

Copy link
Copy Markdown
Contributor

ELI5

When you try to delete an agent session that lives on an SSH host or a remote Orca server, Orca refuses, and until now it didn't say where the session was. Now the message names the machine by the name you gave it, and it only tells you to remove the session there by hand when that is safe to do.

What Changed

  • Before: in Agent Session History, Delete on an SSH or remote-runtime session was disabled. Its tooltip read only "Only sessions on this device can be deleted."
  • After: the tooltip names the host the way the rest of the app does (your rename, then the SSH target's label or the runtime environment's name, and the raw id only as a last resort). What follows depends on the row:
    • A session Orca could delete if it were local: "This session is on <host>. Orca can only delete sessions on this device, so copy its log path and delete the session's files on <host>."
    • A synthetic row (for example an OpenCode session stored inside a shared SQLite database): "This session is on <host>, and it can't be deleted from Orca." No hand-delete instruction, because the copied path is the database that holds every session on that host.
    • An agent Orca never deletes: "This session is on <host>, and <Agent> sessions can't be deleted from Orca."
  • Mechanism: VaultSessionRow resolves the host label from the store with the existing selectExecutionHostDisplayLabel and passes it to aiVaultSessionDeleteBlockedReason (src/renderer/src/components/right-sidebar/ai-vault-session-deletability.ts). The function still reaches the same deletable-or-not result for every row. For a remote row it now runs the synthetic-path and agent checks too, so it can pick the right sentence. The old catalog key deleteReasonNonLocalHost is replaced by deleteReasonRemoteHost, and two keys are added, deleteReasonRemoteHostSyntheticPath and deleteReasonRemoteHostUnsupportedAgent, in all six locale catalogs (en, es, fr, ja, ko, zh). The main-process validator (validateAiVaultSessionDeleteTarget) is untouched and still refuses non-local hosts.

Why

The issue offers two acceptable outcomes: proxy the delete to the execution host, or have the UI say where the session lives and how to delete it there. This PR takes the second path, on purpose:

  • Proxying would need the owning host to run the same delete-target validation main runs locally: resolve the path, check it against the agent's known roots, re-apply the scanner's discovery rule, and compute the companion-file set. No SSH relay or runtime operation does that today. Forwarding a raw fs.deletePath would skip those checks, so a delete from the panel would be less safe than a local one. Adding that operation is a new relay/runtime contract, which is the work tracked in [Feature]: Allow deleting AI Vault sessions that live on a Remote Orca Server #13471 and too big for a bug fix.
  • SSH target ids are generated strings (ssh-<timestamp>-<random>) and runtime environment ids are UUIDs, so the message uses the display label the host picker and other host-facing messages already use.
  • The hand-delete instruction is limited to rows Orca would delete locally. For other rows it would point at a shared database or at files Orca does not manage.
  • It says "the session's files" rather than "the log" because a local delete also removes companions (Claude's session-env/<id>/, and the whole session directory for some agents).

Linked Issue

Fixes #23556

Visual Proof

Tooltip text change only, with no layout or styling change. Before/after screenshots are still to be attached (they could not be captured in the headless environment this was built in). Text of each case, for a host labelled "Build box":

  • Before (every remote row): "Only sessions on this device can be deleted."
  • After, Claude session on that SSH host: "This session is on Build box. Orca can only delete sessions on this device, so copy its log path and delete the session's files on Build box."
  • After, OpenCode SQLite session on that host: "This session is on Build box, and it can't be deleted from Orca."

Testing

  • src/renderer/src/components/right-sidebar/ai-vault-session-deletability.test.ts:

    • blocks ssh- and runtime-hosted sessions, naming the host by its label (a generated ssh-<ms>-<rand> id and a runtime UUID; the id never appears in the message)
    • never tells the user to delete a remote synthetic row by hand
    • names the host alongside the unsupported-agent reason, with no delete instruction (replaces prioritizes the host gate over the unsupported-agent reason, which used claude, a deletable agent, so it could not test that)
    • The local cases (Delete offered, synthetic path, unsupported agent) are unchanged and still pass.
  • src/renderer/src/components/right-sidebar/AiVaultSessionRow.test.tsx, new VaultSessionRow remote Delete reason block: the Delete menu item of a rendered row names an SSH host by its store label and a runtime host by its environment name, not by the id.

  • All five new tests fail against the earlier revision of this change (which printed the raw id and gave the hand-delete instruction for every remote row). All pass now. Each guard was also checked by mutation: passing the raw id label from the row, and skipping the synthetic or agent check for remote rows, each turns a named test red.

  • Ran the deletability test plus the row tests that render the tooltip (AiVaultSessionRow.test.tsx, AiVaultVirtualRow.test.tsx, SessionRowTrailingActions.test.tsx): 24/24 pass.

  • Also ran the whole right-sidebar test directory (262 files, 2229 tests) and the i18n test directory (21 files, 203 tests): all pass.

  • pnpm lint passes, including the localization catalog, extraction and coverage checks. tsc --noEmit -p config/tsconfig.node.json passes. config/tsconfig.tc.web.json, the renderer config, ran out of the 8 GB memory limit of the build environment, so it is left to CI. pnpm run build:electron-vite passes. The full pnpm test and the other build steps are also left to CI. Linux only.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Claude Opus 5.5 (claude-opus-5-5), Anthropic.

Review

Reviewed before submission by an automated reviewer against the change and its tests.

  • Cross-platform: renderer string logic only, with no paths, shortcuts or OS calls. The label comes from an existing store selector that is the same on macOS, Linux and Windows.
  • SSH/remote/local: local sessions are unchanged (Delete still offered, the same local reasons). SSH and runtime sessions stay blocked exactly as before. Only the explanation changes, and it now names the host by its user-facing label. The main-process guard is untouched.
  • Agents and integrations: the hand-delete instruction appears only for agents Orca can delete. Synthetic rows (SQLite-backed sessions) and unsupported agents get a host-naming refusal without it.
  • Performance: one store selector per rendered row (map lookups and a settings read) and one string interpolation. No new IPC or I/O. Rows are virtualized.
  • UI: tooltip text only, using existing components. All six catalogs are updated, so no locale falls back to English.
  • Security: no new delete path. Remote deletion is still refused in both renderer and main. The host label is rendered as plain text by React. The change removes advice that could have led a user to delete a shared session database by hand.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • An SSH target reached through a runtime environment is labelled from the local target list, so if that list doesn't know the target, the raw target id is shown. That is the selector's existing last-resort fallback.
  • "Copy its log path" refers to Copy Log Path. A row shows this message only when it also offers Copy Log Path: a search result without a source path gets the existing "The transcript source is unavailable." instead (AiVaultVirtualRow passes neither action for such a row).
  • Real remote deletion, run on the owning host with the same validation as local deletion, remains [Feature]: Allow deleting AI Vault sessions that live on a Remote Orca Server #13471.
  • Security, cross-platform (Linux, Windows, Mac), Remote SSH, Mobile, backwards compatibility and performance were considered as above. Mobile does not use this tooltip.
  • The es, fr, ja, ko and zh strings were written by the model and have not been checked by a native speaker.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…locked

The Delete tooltip for an SSH or remote-runtime session said only "Only
sessions on this device can be deleted.", without naming where the session
lives or how to remove it there. Name the owning host and point at Copy Log
Path so the user can delete the log on that host. The delete itself stays
local-only: no runtime can validate a delete target on the owning host yet.

Fixes stablyai#23556
…ce only where safe

Fold of the review findings on the remote Delete tooltip:

- Name the host by its display label (the user's rename, the SSH
  target's label or the runtime environment's name), resolved in
  VaultSessionRow with selectExecutionHostDisplayLabel, instead of the
  generated target id or environment UUID.
- Give the "copy its log path and delete the session's files" advice
  only for a row Orca could delete locally. A remote synthetic row
  (a session inside a shared SQLite database) or an unsupported agent
  gets a host-naming refusal without it.
- Say "the session's files", since a local delete also removes
  companion files.
- Replace the host-priority test that used a deletable agent with one
  that uses an unsupported agent.

Fixes stablyai#23556

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
AGENTS.md — auto-discovered

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: cb20c4c3-2616-4064-9496-125f67e8c81c
📥 Commits

Reviewing files that changed from the base of the PR and between 2b3b692 and c557774.

📒 Files selected for processing (10)
  • src/renderer/src/components/right-sidebar/AiVaultSessionRow.test.tsx
  • src/renderer/src/components/right-sidebar/AiVaultSessionRow.tsx
  • src/renderer/src/components/right-sidebar/ai-vault-session-deletability.test.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-deletability.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The deletion-block check now uses a host label for remote sessions. It distinguishes general remote sessions from sessions with synthetic paths or unsupported agents. English, Spanish, French, Japanese, Korean, and Chinese messages and tests cover the updated reasons. AiVaultSessionRow resolves the host label from the app store and passes it to the check.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to c5577

The remote-session Delete tooltip changes appear mergeable after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. (6 skipped: 6… 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: remote session messages use the host’s display label and provide deletion advice only when appropriate.
Description check ✅ Passed The description is detailed and mostly complete. It explains the user-facing change, mechanism, rationale, linked issue, testing, and compatibility considerations. It notes that required before-and-af…
Linked Issues check ✅ Passed #23556 accepts either remote deletion or UI guidance. The renderer names the remote host and tells users how to remove session files for rows Orca can delete locally. It omits unsafe hand-delete advic…
Out of Scope Changes check ✅ Passed The SSH tooltip change and its tests directly address #23556. Applying the same explanation to remote-runtime sessions is related to the same non-local deletion restriction. Locale updates and row-lev…
Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. (6 skipped: 6 unsupported.)

  • Fix all pre-merge checks with AI
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

✅ No new issues found.

Reviewed changes

  • Remote host label in the Delete tooltip — aiVaultSessionDeleteBlockedReason now takes a resolved hostLabel and names the host for SSH/runtime sessions instead of the generic "only this device" sentence.
  • Reason-specific remote copy — synthetic rows and unsupported-agent rows get their own remote sentences; only a remote row Orca could delete locally gets the "copy its log path and delete the files on the host" instruction.
  • Label resolution — VaultSessionRow resolves the label with the existing selectExecutionHostDisplayLabel selector and passes it in; the raw generated id no longer reaches the message.
  • i18n — deleteReasonNonLocalHost is replaced by deleteReasonRemoteHost, with deleteReasonRemoteHostSyntheticPath and deleteReasonRemoteHostUnsupportedAgent added in all six catalogs; English fallbacks match en.json and placeholders line up.
  • Tests — unit tests pin each remote branch and assert the raw host id never appears; row tests verify SSH and runtime labels come from the store.

I verified the hand-delete advice is only reachable where Copy Log Path is present (onCopyPath and onRequestDelete share the searchPathAllowed gate in AiVaultVirtualRow, and both are unconditional in AiVaultSessionVirtualList), and that the repeated {{value0}} in the remote-host string is handled by i18next (the repo already uses that pattern in localBaseRefRefreshFailedDetailDirty). The changed test files pass locally (19 tests).

One non-blocking note, already called out in the PR body: an SSH target reached through a runtime environment is labelled from the local target list, so an unknown target still shows the generated id. AiVaultSession carries no environment id, so this can't be resolved from the row alone — not a regression, just a remaining edge of "name the host by its label".

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@nwparker

Copy link
Copy Markdown
Contributor

Thanks @brynnclaw for #25169. You were right that a remote row should name its host by the label the user gave it, not its generated id. We went one step further in #33906: Delete on a paired-server or SSH-managed session now asks that machine to delete it, and only an older server shows "Update to delete its sessions from here." That message and the confirmation use the host label your PR introduced, and you're credited as co-author. Closing this in favor of that one.

@nwparker nwparker closed this Oct 26, 2026
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.

SSH-mode sessions cannot be deleted locally: 'can only delete sessions on this device'

2 participants