Repository navigation
fix(ai-vault): resume a server session whose workspace was deleted; show remote hit previews - #33965
Conversation
Walkthrough
Priority: Severity of issue fixed: Medium Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
3ae79137-dc61-45fa-a875-c8af961a4a8c
Files selected for processing: 8-
src/renderer/src/components/right-sidebar/AiVaultPanel.tsxsrc/renderer/src/components/right-sidebar/ai-vault-search-session.test.tssrc/renderer/src/components/right-sidebar/ai-vault-search-session.tssrc/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.test.tssrc/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.tssrc/renderer/src/lib/ai-vault-resume-command.test.tssrc/renderer/src/lib/ai-vault-session-resume-preparation.test.tssrc/renderer/src/lib/ai-vault-session-resume-preparation.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
-
| if (isMissingRuntimePathError(error)) { | ||
| return false |
There was a problem hiding this comment.
🔎 Supported by static analysis
-
Script executed:
#!/bin/bash # Inspect RPC error construction and directory-browser failure handling. rg -n -C 3 'browseServerDir|method not found|Method not found|environment not found|isMissingRuntimePathError' src
Repository: stablyai/orca
Length of output: 41436
Script executed:
set -u printf '%s\n' '--- runtime-file-metadata-client.ts ---' nl -ba src/renderer/src/runtime/runtime-file-metadata-client.ts | sed -n '1,105p' printf '%s\n' '--- ai-vault-session-resume-preparation.ts ---' nl -ba src/renderer/src/lib/ai-vault-session-resume-preparation.ts | sed -n '190,255p' printf '%s\n' '--- runtime-server-directory-browser.ts ---' nl -ba src/renderer/src/runtime/runtime-server-directory-browser.ts | sed -n '1,45p' printf '%s\n' '--- runtime RPC error definitions and response handling ---' rg -n -C 5 -F -- 'class RuntimeRpcCallError' src/renderer/src/runtime src/shared src/main src/wsl-guest || test "$?" -eq 1 rg -n -C 5 -e 'method_not_found' -e 'Method not found' -e 'code: -32601' src/renderer/src/runtime src/shared src/main src/wsl-guest || test "$?" -eq 1 printf '%s\n' '--- relevant error-classification tests ---' nl -ba src/renderer/src/runtime/runtime-path-existence-error-parity.test.ts | sed -n '1,110p'
Repository: stablyai/orca
Length of output: 41949
Do not treat an unsupported RPC method as a missing directory.
An older host can return Method not found: files.browseServerDir. isMissingRuntimePathError matches not found, so runtimeServerDirectoryExists returns false. The resume flow then clears cwd and resumeCommand, even when the recorded directory still exists. Exclude method_not_found before applying message-based path classification.
Suggested fix
-
import { browseRuntimeServerDirectory } from '@/runtime/runtime-server-directory-browser' import { isMissingRuntimePathError } from '@/runtime/runtime-file-metadata-client' +import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-result' import { readIpcErrorMessage } from './ipc-error' @@ } catch (error) { + if (error instanceof RuntimeRpcCallError && error.code === 'method_not_found') { + throw error + } if (isMissingRuntimePathError(error)) { return false }
Source: Learnings
…how remote hit previews Since #27214 every SSH session is retagged runtime:<env>, so the #24236 check that drops a deleted cwd (and its prebuilt `cd`) before resuming only ever ran for the legacy ssh: spelling. Resume on a paired or SSH-managed server therefore ran `cd '<deleted folder>' &&` and failed. The check now covers runtime hosts too, probing the folder with the existing files.browseServerDir RPC; only a definite "missing" answer drops the cwd, so an older or unreachable host keeps today's behaviour. Search-hit cards carry no turns and remote hosts cannot reparse a first prompt, so a server session found through search showed "No first prompt" and "No conversation preview". Hits now borrow the preview of their scanned history row.
3a88915 to
23af80b
Compare
There was a problem hiding this comment.
🧹 Nitpick comments: 1
src/renderer/src/components/right-sidebar/ai-vault-search-session.test.ts: 1
26-26:Trivial · Maintainability & Code Quality · Quick win Give the history row a distinct resume command.
The history row copies
resumeCommandfromhitSessionthrough its object spread.withAiVaultHistoryPreviewsnever copies a row'sresumeCommandinto the hit. Both values arehost-resume-command, so the assertion on line 37 would still pass if the merge started copying the row's command. Give the history row its own command so the assertion detects that regression.Suggested fix
{ ...hitSession, id: 'runtime:env-1:codex:host-session:/host/transcript.jsonl', filePath: '/host/transcript.jsonl', + resumeCommand: 'history-resume-command', previewMessages: turns, firstUserPrompt: 'Fix the flaky test' }

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
f61ba997-1564-42ff-95f2-bfa6c2b961f3
Files selected for processing: 5-
src/renderer/src/components/right-sidebar/ai-vault-search-session.test.tssrc/renderer/src/components/right-sidebar/ai-vault-search-session.tssrc/renderer/src/lib/ai-vault-resume-command.test.tssrc/renderer/src/lib/ai-vault-session-resume-preparation.test.tssrc/renderer/src/lib/ai-vault-session-resume-preparation.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
-
ELI5
When a session in Agent Session History lived on a paired Orca server, or on an SSH host Orca now runs a managed server on, and its workspace had been deleted, resuming it failed: Orca told the agent to
cdinto the folder that no longer existed. Now Orca asks the server whether the folder is still there, and if it's gone the session resumes at the selected workspace's root. Sessions on a server found through search also show their conversation preview instead of "No conversation preview available."What Changed
cd '<deleted folder>' && …and failed.runtime:<env>, so fix(ai-vault): resume sessions whose worktree was deleted #24236'sdropDeletedSshResumeCwdonly ever ran for the legacyssh:spelling.dropDeletedRemoteResumeCwd, and it also covers runtime hosts. It probes the folder with the existingfiles.browseServerDirRPC, which takes an absolute path.files.statcan't do this because it needs the workspace, and the workspace is gone.ENOENT/ENOTDIRanswer drops the cwd and the prebuiltcd. An unreachable or older host keeps today's behaviour, and so does a "not found" that only appears inside a message. Kimi and Muse still resume only in their recorded folder.win32, so it quotes for PowerShell.~, cached per pairing. A cwd the browser would trim, expand or resolve is kept rather than probed as a different folder.withAiVaultHistoryPreviewscopies the preview turns and first prompt of the matching history row. Relay hits are redacted of their transcript path, so the match uses host, agent and session id, and ambiguous matches are skipped.Why
Both fixes reuse what already exists: the server's directory probe, and the previews the server already sends in the list. No new RPC or wire field, so mixed versions are unaffected.
Linked Issue
Fixes #26509
Visual Proof
N/A: the card is unchanged except that it now shows the existing preview text. The resume difference is in the command the terminal runs. A paired server is needed to show either.
Testing
ai-vault-session-resume-preparation.test.ts:win32;ai-vault-resume-command.test.ts: a server Codex session whose folder was deleted resumes at the workspace root withtui.resume_cwd=currentand nocd(fails on main).ai-vault-search-session.test.ts: a server hit gets its history row's turns and first prompt, and keeps the host's resume command (fails on main).Passing: the 14 importer test files, plus
pnpm tc,pnpm lint, oxfmt, type-aware oxlint,check:code-quality:changedand react-doctor.Not run: a live paired server.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)