Skip to content

fix(ai-vault): repin resumes from deleted worktrees - #18085

Closed
kaluli123123 wants to merge 10 commits into
stablyai:mainfrom
kaluli123123:fix/17745-ai-vault-resume-cwd
Closed

kaluli123123 wants to merge 10 commits into
stablyai:mainfrom
kaluli123123:fix/17745-ai-vault-resume-cwd

Conversation

@kaluli123123

@kaluli123123 kaluli123123 commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

AI Vault resumes now check whether the saved working directory is still usable before launching. If it is gone, Orca starts the resumed session from the selected workspace instead of trying to launch from a deleted folder.

What Changed

  • Validate drag-and-drop resume payloads with the async CWD check before launching.
  • Treat runtime-owned session CWDs outside the selected workspace as unavailable instead of letting runtime file routing throw.
  • Keep current valid nested CWDs, WSL UNC normalization, remote scanner command repinning, and real-home Codex handling intact.
  • Add regression coverage for runtime-owned stale CWDs and current drag payloads with deleted nested CWDs.

Why

This fixes the remaining review feedback: a deleted recorded CWD could still reach drag/drop launch paths, and runtime-owned stale paths outside the selected worktree could fail with an error toast instead of repinning to the selected workspace.

Linked Issue

Fixes #17745

Visual Proof

N/A — no visual layout or copy changes; this changes launch-path behavior for AI Vault resume commands.

Testing

  • Automated tests added/updated, or explained why not below
  • I manually tested these changes locally

Automated validation run locally on macOS:

  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/lib/ai-vault-resume-repin.test.ts src/renderer/src/lib/ai-vault-resume-command.drop-repin.test.ts — PASS (13), FAIL (0)
  • pnpm tc:web — PASS
  • pnpm run check:code-quality:changed — PASS, 0 new findings across changed files
  • git --no-pager diff --check — PASS

Manual Electron drag/drop was not run locally in this pass.

AI Disclosure

Codex assisted with the review-fix implementation and validation.

Review

Addressed the latest CodeRabbit and Pullfrog review findings for stale AI Vault resume CWD handling.

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

Security, cross-platform path handling, SSH/runtime boundaries, folder workspaces, WSL path normalization, and remote command compatibility were considered. No mobile impact.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • 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)

@coderabbitai

coderabbitai Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 8bca8e4c-dabb-413c-b899-6a7ccf253492

📥 Commits

Reviewing files that changed from the base of the PR and between 0a9b38d09fff49b2f27a84fa58274ade8172aefa and 6c18fbf9a45a6a717461b7a9454677f7a6950b38.

📒 Files selected for processing (2)
  • src/renderer/src/lib/ai-vault-resume-cwd.ts
  • src/renderer/src/lib/ai-vault-resume-repin.test.ts

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


📝 Walkthrough

Walkthrough

AI Vault resume handling now separates CWD, runtime, and command-prefix resolution into dedicated modules. It checks session directories, falls back to workspace paths, and normalizes WSL UNC paths. It selects the target platform and shell, maps provider session metadata, and repins cached commands. Resume and drop-repin launch flows now await asynchronous builders and use resolved startup CWD metadata. Tests cover POSIX, Windows, WSL, remote sessions, missing paths, nested directories, and legacy Windows wrappers.

Merge Risk: ⚪ Minimal · up to 6c18f

Resume and drag-drop launches now repin deleted session directories to the selected workspace while preserving valid nested and platform-specific paths. Current coverage indicates no remaining merge-blocking risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 13 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 describes the primary change: repinning AI Vault resumes when recorded worktrees have been deleted.
Description check ✅ Passed The description follows the required template, explains the problem and changes, links issue #17745, documents testing, and marks visual proof as not applicable with a reason. Unchecked manual testing…
Linked Issues check ✅ Passed The changes satisfy issue #17745 by checking recorded CWD availability, falling back to the selected workspace for stale paths, preserving valid nested paths, and covering resume and drag/drop flows w…
Out of Scope Changes check ✅ Passed The changes remain focused on AI Vault resume and drag/drop launch behavior. The drop-target extraction and added tests support the modified drag/drop flow and do not introduce unrelated functionality…

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 44ac2980-2d8d-4fce-8892-0039b88211cb

📥 Commits

Reviewing files that changed from the base of the PR and between 4f4872c and d15adc5935d6fa96d8d35334443fbd910c717fda.

📒 Files selected for processing (7)
  • src/renderer/src/lib/ai-vault-resume-command.test.ts
  • src/renderer/src/lib/ai-vault-resume-command.ts
  • src/renderer/src/lib/ai-vault-resume-cwd.ts
  • src/renderer/src/lib/ai-vault-resume-repin.test.ts
  • src/renderer/src/lib/ai-vault-resume-runtime.ts
  • src/renderer/src/lib/ai-vault-resume-shell.ts
  • src/shared/ai-vault-resume-command.ts

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

@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 critical issues — two minor points inline.

Reviewed changes

  • Repin a stale resume cwd to the selected workspace — new resolveAiVaultResumeCwd keeps a session cwd when it still lives under the selected worktree/folder, otherwise repins to the workspace root (with WSL-UNC and Windows-drive guards), and buildAiVaultResumeForWorktree now routes every path through it.
  • Strip the persisted cwd wrapper before repinning remote sessions — new stripAiVaultResumeCwdPrefix removes the scanner's cd … && (or cmd /d /s /c "cd /d …") prefix so a stale remote resumeCommand can be rebuilt against the new target.
  • Extract shared runtime helpers — getAiVaultResumePlatform / getAiVaultAgentProviderSession / getAiVaultResumeCodexHome / resolveAiVaultResumeShell move to ai-vault-resume-runtime.ts; getAiVaultResumeWorkspacePath moves to ai-vault-resume-cwd.ts (re-exported for existing importers).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 4c026b46-6c05-487f-89f2-32dedb2547dc

📥 Commits

Reviewing files that changed from the base of the PR and between d15adc5935d6fa96d8d35334443fbd910c717fda and b41d1ff24489b5d5bbe1ddb1d222ac2487d584fb.

📒 Files selected for processing (6)
  • src/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.ts
  • src/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsx
  • src/renderer/src/lib/ai-vault-resume-command.drop-repin.test.ts
  • src/renderer/src/lib/ai-vault-resume-command.ts
  • src/renderer/src/lib/ai-vault-resume-cwd.ts
  • src/renderer/src/lib/ai-vault-resume-repin.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/lib/ai-vault-resume-cwd.ts
  • src/renderer/src/lib/ai-vault-resume-repin.test.ts

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

@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

One must-address issue: aiVaultResumeCwdExists can throw for runtime-owned sessions instead of returning false, which turns the deleted-worktree fix into a failure toast on exactly the remote case it targets.

Reviewed changes

  • Validate the resume cwd before launching — new aiVaultResumeCwdExists checks whether the recorded cwd still exists (routing to the runtime host, SSH host, or local shell), and async variants of the copy/startup builders (buildAiVaultResumeCopyCommandForWorktreeAsync, buildAiVaultResumeStartupForWorktreeAsync, buildAiVaultDropRepinStartup) await it before repinning.
  • Repin to the workspace root when the cwd is gone — resolveAiVaultResumeCwd now takes sessionCwdExists and returns the target root when the recorded cwd no longer exists, in addition to the existing lexicographic inside/equal check.
  • Wire the drop layer to the resolved cwd — the drag-drop launch now prefers startup.cwd over the stale payload.sessionCwd.
  • Address prior review feedback — the copy rebuild hardcodes shell: undefined, and remote startup cwd is gated on staleCwd.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai 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.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 14e33699-5c30-43e1-9c5a-47b0aa662161

📥 Commits

Reviewing files that changed from the base of the PR and between b41d1ff24489b5d5bbe1ddb1d222ac2487d584fb and e3ca4b5d2056b2325b7b7539eec64755d97c5f04.

📒 Files selected for processing (8)
  • src/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsx
  • src/renderer/src/components/tab-group/ai-vault-session-drop-target.test.ts
  • src/renderer/src/components/tab-group/ai-vault-session-drop-target.ts
  • src/renderer/src/lib/ai-vault-drop-resume-startup.ts
  • src/renderer/src/lib/ai-vault-resume-command.drop-repin.test.ts
  • src/renderer/src/lib/ai-vault-resume-command.ts
  • src/renderer/src/lib/ai-vault-resume-cwd.ts
  • src/renderer/src/lib/ai-vault-resume-repin.test.ts

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

@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

  • Guard runtime-owned CWDs before probing the runtime host — aiVaultResumeCwdExists now returns false when a runtime-owned session CWD falls outside the selected workspace (via createNormalizedPathInsideOrEqualMatcher), resolving the prior review finding: the deleted-worktree case repins to the workspace root instead of throwing and surfacing a failure toast. The guard is consistent with getRelativePathInsideWorktree, so runtimePathExists is only reached when it cannot throw.
  • Route drag/drop launches through the async CWD check — the drop layer resolves its startup via the new async buildAiVaultDropLaunchStartup (backed by buildAiVaultDropResumeStartup / buildAiVaultDropRepinStartup in ai-vault-drop-resume-startup.ts), preserving the realHomeStartup fallback for older serializers, and prefers the resolved startup.cwd over the stale payload.sessionCwd.
  • Extract drop-target geometry helpers — containsPoint / resolvePaneDropTarget move to ai-vault-session-drop-target.ts with a focused happy-dom unit test.
  • Thread the target platform through the existence probe — buildAiVaultResumeCopyCommandForWorktreeAsync and buildAiVaultResumeStartupForWorktreeAsync compute the platform up front (getAiVaultResumeWorktreePlatform) and pass it to aiVaultResumeCwdExists.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

# Conflicts:
#	src/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsx
# Conflicts:
#	src/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsx
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

…o HEAD

# Conflicts:
#	src/renderer/src/lib/ai-vault-resume-command.drop-repin.test.ts
#	src/renderer/src/lib/ai-vault-resume-repin.test.ts

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsx (1)

203-214: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Do not fall back to payload.sessionCwd when startup.cwd is absent. When the selected worktree has no resolvable path, buildAiVaultDropLaunchStartup returns a startup object without cwd. The fallback reintroduces the stale drag-payload directory, which launchAiVaultSessionInNewTab stores or forwards to session.tabs.createTerminal. Use undefined when startup.cwd is absent so the launch uses the provider’s normal working-directory resolution.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: d162fd3d-7615-439b-938e-33a3f926dcc7

📥 Commits

Reviewing files that changed from the base of the PR and between 3f4793b and 0a9b38d09fff49b2f27a84fa58274ade8172aefa.

📒 Files selected for processing (13)
  • src/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.ts
  • src/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsx
  • src/renderer/src/components/tab-group/ai-vault-session-drop-target.test.ts
  • src/renderer/src/components/tab-group/ai-vault-session-drop-target.ts
  • src/renderer/src/lib/ai-vault-drop-resume-startup.ts
  • src/renderer/src/lib/ai-vault-resume-command.drop-repin.test.ts
  • src/renderer/src/lib/ai-vault-resume-command.test.ts
  • src/renderer/src/lib/ai-vault-resume-command.ts
  • src/renderer/src/lib/ai-vault-resume-cwd.ts
  • src/renderer/src/lib/ai-vault-resume-repin.test.ts
  • src/renderer/src/lib/ai-vault-resume-runtime.ts
  • src/renderer/src/lib/ai-vault-resume-shell.ts
  • src/shared/ai-vault-resume-command.ts
🚧 Files skipped from review as they are similar to previous changes (11)
  • src/renderer/src/lib/ai-vault-resume-shell.ts
  • src/renderer/src/components/tab-group/ai-vault-session-drop-target.ts
  • src/renderer/src/components/tab-group/ai-vault-session-drop-target.test.ts
  • src/renderer/src/lib/ai-vault-drop-resume-startup.ts
  • src/renderer/src/lib/ai-vault-resume-command.drop-repin.test.ts
  • src/renderer/src/lib/ai-vault-resume-command.test.ts
  • src/renderer/src/lib/ai-vault-resume-command.ts
  • src/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsx
  • src/renderer/src/lib/ai-vault-resume-runtime.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.ts
  • src/shared/ai-vault-resume-command.ts

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

@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 WSL probe path is normalized but its worktreePath context isn't, so a runtime-owned WSL resume still throws instead of repinning — details inline.

Reviewed changes

  • Removed the ?? args.payload fallback from the drop launch path — buildAiVaultDropLaunchStartup now returns null (surfacing the "legacy session" toast) for older-serializer payloads whose sessionCwd/sessionFilePath/codexHome can't be validated, instead of silently launching their stale cd command.
  • Probe runtime-owned WSL cwds with their Linux path — aiVaultResumeCwdExists now passes the platform-normalized sessionPath to runtimePathExists, with a regression test asserting the Linux path is probed.
  • Reconciled main-branch renames — the drop layer imports activateAiVaultStructuredSession, and the launch action renamed to handleResumeInNewChat.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@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

  • Normalized the runtime probe root — aiVaultResumeCwdExists now passes worktreePath: targetCwd (the Linux-normalized workspace path) to runtimePathExists, so a runtime-owned WSL worktree probes relativePathInsideRoot('/home/alice/repo', '/home/alice/repo/packages/app') instead of comparing a //wsl/… root against a /home/… candidate and throwing Remote file is outside the owning runtime worktree. This closes the prior must-address finding.
  • Tightened the regression test — the runtime-owned WSL probe test now asserts expect.objectContaining({ worktreePath: '/home/alice/repo' }) (previously expect.any(Object), which could not catch the UNC/Linux mismatch), and the missing-workspace case now also asserts startup.cwd is undefined.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@kaluli123123
kaluli123123 force-pushed the fix/17745-ai-vault-resume-cwd branch from 6c18fbf to 709006d Compare September 7, 2026 08:55

@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 critical issues — the fallback removal is correct; one minor test-coverage note inline.

Reviewed changes

  • Removed the payload.sessionCwd fallback from the drop launch path — AiVaultSessionDropLayer.tsx now derives the launch cwd solely from getAiVaultDropLaunchCwd(startup), so a startup without a validated cwd launches via the provider's normal working-directory resolution instead of the stale drag-payload directory.
  • Added getAiVaultDropLaunchCwd — a thin accessor in ai-vault-drop-resume-startup.ts returning only the cwd validated by the async drop resolver, plus a unit test asserting it yields undefined when the startup omits cwd.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@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

  • Inlined the drop-launch cwd accessor — AiVaultSessionDropLayer.tsx now reads startup.cwd directly, and the getAiVaultDropLaunchCwd identity wrapper in ai-vault-drop-resume-startup.ts was deleted along with its tautological unit test.
  • Added real coverage for the fallback removal — new AiVaultSessionDropLayer.test.tsx renders the drop layer, mocks buildAiVaultDropLaunchStartup to return a startup with no cwd, and asserts launchAiVaultSessionInNewTab is called without a cwd property even though the drag payload carries a sessionCwd. This fails if the payload.sessionCwd fallback ever returns, resolving the prior coverage nit.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@JanPlessow

Copy link
Copy Markdown

@kaluli123123 — this PR looks to have been idle for about two weeks, so I wanted to surface that the issue is still reproducible for me in the exact path this PR touches: clicking Resume from the right sidebar can still show “session unavailable” after the original worktree/folder has moved or been recreated.

The provider transcript still exists, so could you please verify the ai-vault-session-launch-actions.ts right-sidebar path specifically, in addition to the Session History and drag/drop coverage already present here? Related lifecycle reports are #22657 and #20803.

Drive useAiVaultSessionLaunchActions().handleResume with a recorded cwd that was moved away or removed from a recreated worktree, asserting the launch cwd falls back to the selected workspace root.
@kaluli123123

Copy link
Copy Markdown
Contributor Author

@JanPlessow thanks for the report. I checked the right-sidebar path specifically.

This fix is not in any release yet. This PR is still open and unmerged, so every released build (including the latest, v1.4.215) still launches a sidebar Resume with the recorded cwd as-is (startupCwd = session.cwd, no existence check). A moved or recreated worktree reproduces there exactly as you describe.

The PR head already covers the right-sidebar Resume path. useAiVaultSessionLaunchActions().handleResume in ai-vault-session-launch-actions.ts now builds its startup with buildAiVaultResumeStartupForWorktreeAsync. That call checks whether the recorded cwd still exists before launch (locally, over SSH, or through the runtime) and falls back to the selected workspace root when it does not.

To pin down your exact scenario, I pushed 1ed5571, which adds src/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.test.ts. The test calls the sidebar hook's handleResume directly:

  • original folder moved away → launches in the selected workspace, and the old path does not appear in the command
  • worktree recreated at the same path, with the recorded nested cwd missing → falls back to the workspace root
  • worktree recreated, with the nested cwd still present → keeps the nested cwd

Against the pre-PR code (merge base 3f4793b6c), the first two cases fail (expected '/Users/ada/original/packages/app' to be '/Users/ada/relocated'). On this PR head all three pass, along with the existing AI Vault resume/drop suites (81 tests), pnpm tc:web, and pnpm run check:code-quality:changed.

If you are able to test a build from this branch and still see the failure, please share the agent (Claude/Codex/…) and the exact text shown. "Session unavailable" is not a message the resume launch path emits, so it may come from a different layer. #22657 (sleep record dropped on wake) and #20803 (retained rows not navigating) are separate code paths that this PR does not touch.

@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 critical issues — the new coverage is meaningful; one test-hygiene nit inline.

Reviewed changes

  • Added right-sidebar resume coverage after a workspace move — new ai-vault-session-launch-actions.test.ts drives the real useAiVaultSessionLaunchActions().handleResume through the real buildAiVaultResumeStartupForWorktreeAsync, mocking only window.api's path probe and the launcher. It covers a recorded cwd outside the selected workspace, an in-workspace cwd the probe reports gone (the existence-gated repin — the case that fails if aiVaultResumeCwdExists is unwired), and an in-workspace cwd the probe reports present. I ran it: 3/3 pass.

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

import type { AppState } from '@/store/types'
import { makeWorktree, TEST_REPO } from '@/store/slices/store-test-helpers'
import type { AiVaultSession } from '../../../../shared/ai-vault-types'
import { useAiVaultSessionLaunchActions } from './ai-vault-session-launch-actions'

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.

This file never sets globalThis.IS_REACT_ACT_ENVIRONMENT = true, so every act() call emits The current testing environment is not configured to support act(...) to stderr (six times per run here). The sibling AiVaultSessionDropLayer.test.tsx sets it at module scope for exactly this reason.

The visible assertions still hold today because the async work is awaited via vi.waitFor, but the act wrappers are not doing their job without it.

Suggested change
import { useAiVaultSessionLaunchActions } from './ai-vault-session-launch-actions'
import { useAiVaultSessionLaunchActions } from './ai-vault-session-launch-actions'
globalThis.IS_REACT_ACT_ENVIRONMENT = true

@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

Thanks for digging into this, @kaluli123123. Your investigation helped a lot, and I've credited you as co-author on the replacement.

I've opened #24236 as a narrower fix for #17745, and I'm closing this one in its favour. Two reasons:

Drag-and-drop resume on SSH is still open, and it's listed as a known gap in #24236.

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.

Session History resume pins recorded cwd without existence check — fails after worktree removal

3 participants