Skip to content

fix(terminal): scope account restart metadata to its execution host - #34214

Merged
nwparker merged 1 commit into
mainfrom
nwparker/fix-account-restart-workspace-fallback
Oct 27, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/fix-account-restart-workspace-fallback

Conversation

@nwparker

@nwparker nwparker commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Account restarts now select the workspace folder and repository connection from the pane’s execution host when IDs repeat across hosts.

What Changed

  • Resolve the execution host before selecting the restart workspace, and pass it to both workspace lookups.
  • Match the repository by its ID and that same host with the existing owner-only identity predicate.
  • Add two regression cases with local-first duplicate IDs: resume changes to the recorded session folder when needed, while a saved tab start folder retains priority. The real launch-target function also receives the selected repository connection.

Why

A bare-ID lookup can mix one host’s folder or repository connection with another host’s launch target, causing a wrong working directory or platform. The owner-only predicate cannot fall back to the active-server setting.

Linked Issue

Found while validating module organization. The preceding compile/import repairs have landed in #34202; this PR contains only the remaining host-ownership fix.

Visual Proof

N/A — launch planning only; no rendered layout changes.

Testing

  • Added meaningful regression coverage
  • Manual app testing

Both defects were reproduced before their repairs. On the final rebased head, 56 tests across three restart suites and all 21 changed-file checks pass. Two independent source reviews confirm that the upstream workspace-fallback regression and fixture reset are preserved. All 34 hosted CI contexts completed successfully or were skipped as inapplicable, with the aggregate check green. Final independent merge admission also passed.

Review

Preserves lazy folder fallback, saved tab-folder priority and existing launch quoting. Uses existing workspace and repository identity owners. No gate, baseline, assertion or type suppression changes.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material copied.

Checklist

  • Cross-platform, remote, folder and mobile launch behavior considered
  • Two-file behavior repair; zero module-organization tracker credit
  • Final independent reviews, validation and required CI complete

@nwparker nwparker changed the title fix: restore restart fallback and browser-link test state fix: restore account restart fallback and stale test fixtures Oct 27, 2026
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

Resume startup now uses the worktree’s execution host when looking up the worktree and matching its repository. Tests cover workspace-folder and saved-tab-folder Claude resume cases with a remote execution host, including the selected host and SSH connection passed to the resume-target resolver.

Priority: Normal

Merge Risk: Low · up to fc257

The host-scoping fix is in place. Clear the test spy between cases so the saved-tab regression test independently verifies its resolver call.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surv… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: scoping account restart metadata to the execution host.
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.
Description check Passed The description covers the core change clearly: it explains that account restarts now pick the workspace folder and repository connection from the pane's execution host, lists the code-level changes, …
Full details: Description check

Explanation

The description covers the core change clearly: it explains that account restarts now pick the workspace folder and repository connection from the pane's execution host, lists the code-level changes, and gives the reason (a bare-ID lookup can mix one host's folder or repository with another host's launch target). It also includes testing evidence and a review note. The template's required sections are all present. Gaps: the Linked Issue section has no issue number ("Fixes #" is blank) and describes a stacked PR instead, which the template says outside contributors must link. The Testing section says manual app testing is unchecked, and the template asks for steps a reviewer can follow and the platforms tested. The Visual Proof section says N/A with a reason, which fits the template. The Checklist omits several template items, including the lint, typecheck, test and build confirmation. The AI Disclosure section is empty. Overall, the description is mostly complete with some gaps in linking and testing detail.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · 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.

@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
  • 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: 4ce5cf71-5d60-4ea7-9a23-6fcdb666dd39
Commits

Reviewing files that changed from the base of the PR and between 07b5c08 and 7ecbe9a.

Files selected for processing: 2
  • src/renderer/src/components/browser-pane/workspace-doc/doc-preview-external-link-confirmation.test.ts
  • src/renderer/src/lib/agent-account-restart-startup.ts

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

Comment thread src/renderer/src/lib/agent-account-restart-startup.ts Outdated

@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
  • 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: 50c915c6-3a8d-40c6-8d2e-d32794126a92
Commits

Reviewing files that changed from the base of the PR and between 7ecbe9a and f18f978.

Files selected for processing: 3
  • src/renderer/src/lib/agent-account-restart-startup.test.ts
  • src/renderer/src/lib/agent-account-restart-startup.ts
  • tests/e2e/native-chat-transcript-file-order.unit.test.ts

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

Comment thread src/renderer/src/lib/agent-account-restart-startup.ts Outdated
@nwparker
nwparker force-pushed the nwparker/fix-account-restart-workspace-fallback branch from 5723586 to 17d69ef Compare October 27, 2026 03:01
@nwparker nwparker changed the title fix: restore account restart fallback and stale test fixtures fix(terminal): scope account restart metadata to its execution host Oct 27, 2026

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

Nitpick comments: 1
src/renderer/src/lib/agent-account-restart-startup.test.ts: 1

299-352: Trivial · Functional Correctness · Quick win

Assert the selected worktree path.

The fixture has host-colliding worktrees, but the test does not assert /remote/workspace. Both command assertions use the session cwd or saved tab folder, so an unscoped lookup can pass.

Suggested fix
       expect(resolveAgentResumeLaunchTarget).toHaveBeenLastCalledWith(
         expect.objectContaining({
           executionHostId: 'runtime:remote-host',
-          connectionId: 'selected-ssh'
+          connectionId: 'selected-ssh',
+          worktreePath: '/remote/workspace'
         })
       )

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: 4bc3c25f-e12d-47fa-924f-a77dbd792772
Commits

Reviewing files that changed from the base of the PR and between f18f978 and 17d69ef.

Files selected for processing: 2
  • src/renderer/src/lib/agent-account-restart-startup.test.ts
  • src/renderer/src/lib/agent-account-restart-startup.ts

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

@nwparker
nwparker force-pushed the nwparker/fix-account-restart-workspace-fallback branch from 17d69ef to fc257f9 Compare October 27, 2026 03:26

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

Nitpick comments: 1
src/renderer/src/lib/agent-account-restart-startup.test.ts: 1

359-363: Trivial · Functional Correctness · Quick win

Clear the resolver spy before each parameterized case.

clearMocks is disabled. The saved-tab-folder case uses toHaveBeenLastCalledWith, so it can reuse the workspace-folder case’s previous call if the resolver stops running. The command assertion does not verify that the resolver was called.

Suggested fix
   beforeEach(() => {
+    vi.mocked(resolveAgentResumeLaunchTarget).mockClear()
     seedAgentStatus(null)

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: 501300e6-b01e-45dd-acc3-3fcdd99a647c
Commits

Reviewing files that changed from the base of the PR and between 17d69ef and fc257f9.

Files selected for processing: 1
  • src/renderer/src/lib/agent-account-restart-startup.test.ts

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

@nwparker
nwparker merged commit c5f48b5 into main Oct 27, 2026
34 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