fix: block resuming host-stored AI Vault sessions into SSH workspaces
Summary
AI Vault only scans session history from the local machine (host home dirs plus local WSL homes via wslHomeDirs), but since #6685 every resume path accepted any SSH workspace as a target. Resuming a host-stored session into a genuinely remote SSH workspace queues
cd '/Users/me/code/project' && claude '--resume' '<session-id>'
into the remote shell, where neither the cwd nor the session file in ~/.claude/projects/... exists — it fails every time:
ping@M424 moon % cd '/Users/yhuan/code/orca' && claude '--dangerously-skip-permissions' '--resume' '5b03012a-…'
cd: no such file or directory: /Users/yhuan/code/orca
This PR gates resume-target support on where the session file is stored:
- Local targets: unchanged, always allowed.
- SSH targets: allowed only for WSL-stored sessions (
\\wsl$\.../\\wsl.localhost\...file paths) — this preserves the SSH-to-local-WSL workflow that #6685 (#6270) added SSH support for, since those files are reachable from that SSH shell. - Host-stored session + SSH target: resume buttons disable / fall back to the session's own local worktree, direct resume and pane drag-and-drop show a toast explaining the session history lives on this machine.
Implementation: canResumeAiVaultSessionOnTarget in ai-vault-resume-target.ts, threaded through resolveAiVaultSessionResumeState/Actions, resolveAiVaultSessionLaunchTarget, and the drag payload (sessionFilePath, optional field, validated).
Note: sync:localization-catalog --fix also picked up two pre-existing catalog drifts on main (missing failedUnnestWorkspace fallback, removal of two unreferenced SSH-timeout keys); they ride along so verify:localization-catalog passes.
Screenshots
No visual change (existing disabled-state and toast patterns; new toast copy only).
Testing
- [x]
pnpm lint— oxlint clean on touched paths;verify:localization-catalogandverify:localization-coveragepass - [x]
pnpm typecheck—tsgoclean for web and node configs - [x]
pnpm test— all 24 ai-vault test files pass (203 tests); full renderer suite has 16 failures inpr-comments/LinearAgentSkillSetupPrompt/SidebarToolbarthat reproduce identically on cleanmain(verified viagit stash) - [ ]
pnpm build— not run - [x] Added regression tests: storage-origin predicates, host-session-into-SSH blocked for state/actions/launch-target, WSL-session-into-SSH still allowed, drag payload round-trip and validation
AI Review Report
Reviewed the full resume-path call graph before changing behavior: sidebar buttons (resolveAiVaultSessionResumeActions), row/details resume (handleResume), drag-and-drop (AiVaultSessionDropLayer), and jump-to-original-pane (not affected — reuses a live pane, builds no command). Confirmed #6685's intended SSH-to-WSL use case is preserved by keying on parseWslUncPath(session.filePath) rather than blanket-blocking SSH. Cross-platform: WSL UNC detection only ever matches on Windows-scanned paths; macOS/Linux sessions are host-stored so SSH targets are correctly blocked there; no shortcuts/labels/shell-quoting changes (command builders untouched). Copy-resume-command intentionally stays available as a manual escape hatch.
Security Audit
No new input surfaces. The drag payload gains an optional sessionFilePath string, validated as non-empty in isSerializedPayload and bounded by the existing 16 KB payload cap; it is used only for a local UNC-prefix check, never executed or interpolated into commands. No IPC, auth, secrets, or dependency changes.
Notes
- Sessions created inside an SSH workspace's remote shell live on the remote host and never appear in AI Vault (the scanner is local-only). Scanning remote hosts over SSH would be the follow-up feature that makes resume-into-SSH broadly useful.
- A WSL-stored session dragged into an SSH workspace that is not the local WSL still can't be detected statically; this keeps #6685 behavior for that edge.
📝 Walkthrough
Walkthrough
Changes
The PR propagates sessionFilePath through AiVault drag, resume, and launch flows. Resume eligibility now depends on both target type and whether the session history is stored on WSL or the host, with SSH resume allowed only for WSL-stored sessions. The drop and launch flows now block unsupported SSH resumes with updated toast messaging. Locale files in five languages add the new unsupported-session string. Tests were updated for the new session-file gating behavior.
Sequence Diagram(s)
Not applicable; the detailed flow is captured in the hidden review stack artifact.
Estimated code review effort: 3/5
Related issues: None specified
Related PRs: None specified
Suggested labels: renderer, ai-vault, i18n
Suggested reviewers: none identified
Poem: A path now guides each session’s way, Across the host or WSL array. SSH may open only where The session’s history lives there.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Description check | ⚠️ Warning | The description is informative, but it does not follow the required template sections for Summary, Screenshots, Testing, AI Review Report, Security Audit, and Notes. | Reformat the PR description to match the template and add the missing sections, including screenshots/no visual change, test checklist, AI review, security audit, and notes. |
✅ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| 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. |
| Title check | ✅ Passed | The title clearly summarizes the main behavior change: blocking host-stored AI Vault session resumes into SSH workspaces. |
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 @coderabbitai help to get the list of available commands.
Takeover + validation summary
I took over this PR, validated it end-to-end, merged latest main, and pushed polish. Verdict: VALIDATED.
Security screen: clean. The diff is renderer-side classification logic only — no credential/keychain reads, no logging/transmission of secrets, no network/CI/dependency/postinstall changes. sessionFilePath is an already-known field on AiVaultSession; it's used solely to classify a session as host-stored vs. WSL-stored (host reachability), never dereferenced or sent anywhere.
Regression confirmed at HEAD: I reproduced it at the unit level on origin/main. Before the fix, resolveAiVaultSessionLaunchTarget returns { status: 'ready', worktreeId: 'folder:folder-1' } for a host-stored session dropped into an SSH folder workspace — Orca queues <agent> --resume <id> on the remote, which has no such history file, so it fails. The new-tab SSH action likewise stays enabled. With this PR both are correctly blocked. The origin/main gate (isSupportedAiVaultResumeTargetStatus) only checked local || ssh and never considered where the session file lives.
Product call (block vs. make-it-work): blocking with a clear message is the right short-term behavior. Making resume actually work would require uploading/converting the session file to the remote — a much larger feature. Blocking mirrors how runtime-hosted workspaces are already handled, and turns a silent failure into an actionable error.
Changes on top of the original commit:
- Merged
origin/main(clean, no conflicts). - Translated the two new user-facing error strings (
localSessionSshWorkspaceUnsupported) into es/ja/ko/zh — they had shipped as English fallbacks. Catalog parity re-verified.
Verification: targeted suite 59/59 green (ai-vault-resume-target, ai-vault-session-resume, ai-vault-session-drag, ai-vault-resume-command); full pnpm run typecheck passes; oxlint clean on touched files. High-effort multi-angle code review surfaced no actionable code defects — only two documented, in-scope trade-offs (now spelled out in the PR body): the WSL-UNC check is a path-shape heuristic, not target-aware, so a WSL session → remote-non-WSL SSH target is still allowed-but-fails, and a host session → SSH-to-localhost is a (recoverable) false-block. Both are strictly narrower than the pre-fix behavior.
Not merging or approving — leaving that to a human maintainer.
Merged — this passed our review bar. @huhuhulululu thanks for the contribution! We validated the regression against current main, endorsed the block-with-message approach, and added the missing es/ja/ko/zh translations for the new strings before merging.
Thank you, @huhuhulululu. Turning a confusing silent failure into a clear, honest message is a genuine improvement, even if the fuller remote-resume story is a separate effort down the road. Nice catch on the regression — merged.
Thank you! 🙏 This was a subtle one — spotting that host-stored Vault sessions were being queued into a remote shell that could never find them. Careful diagnosis and a clean guard. Really appreciate you catching a regression the rest of us walked right past. 🐋