Skip to content

fix: save editor-only host sessions during quit - #26848

Merged
OrcaWin merged 1 commit into
mainfrom
nwparker/obvious-empty-host-quit-10-09
Oct 11, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
nwparker/obvious-empty-host-quit-10-09

Conversation

@nwparker

@nwparker nwparker commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​110 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​110
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3

ELI5

If a remote or paired computer had only file tabs open in Orca (no terminals), quitting or restarting to update could fail to save Orca's state. Now it saves normally.

What Changed

Before: on quit, Orca saves each computer's open tabs separately. For a computer with no terminal tabs, the app leaves the terminal lists out entirely. The save code then tried to read those missing lists while reconciling terminal history and crashed with Cannot convert undefined or null to object, so the quit save failed.

After: the save step for a remote/paired computer fills in empty terminal lists — for both the incoming tabs and any older saved copy that lacks them — before anything reads them. It reuses the existing withRequiredWorkspaceSessionMaps helper, which was already applied, but only at the very end of the save.

Why

Filling the lists in at the start of the one shared save function covers every caller (quit save, normal save) and older saved data, instead of patching each place that reads them. Every later step already treated a missing list as empty, so this changes no other behavior: live terminal tabs that the incoming tabs leave out are still kept by the existing stale-write protection (covered by a test).

Linked Issue

Fixes #25924

Thanks to @silee9019 for the report and original fix in #25925; this applies the fix earlier, so the older-saved-data path is covered too.

Visual Proof

N/A — no visible UI change; this is a save-on-quit failure in the main process.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated

New store-host-partition-before-unload.test.ts (5 cases: empty and non-empty terminal history, folder workspace, older saved copy missing the lists, live terminals kept). All 5 fail on main with the reported error and pass with the fix. Persistence store, close-fence, retirement, membership, and shutdown suites pass (408 tests). pnpm tc, pnpm lint, oxlint, and the changed-code quality gate pass. No platform-specific code; SSH hosts use the same save path and are covered by the tests' ssh: host.

Review

Self-review and an independent read-only review: no P0/P1 findings.

Agent skill upstream boundary

  • Not applicable; no skill content changed.

Notes

No wire or storage format change; older saved data is read and repaired in place.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • N/A for visual proof with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • pnpm lint, pnpm typecheck, focused pnpm test pass

@nwparker
nwparker marked this pull request as ready for review October 9, 2026 11:29
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 57666cb6-698a-412f-b9a4-d5ba159ab4de

📥 Commits

Reviewing files that changed from the base of the PR and between 8999f2f9225e91783a57120133af04d24f21c632 and a246a70.


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

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: 6a61b602-c139-4d0d-a7bd-2fad52ced674



📥 Commits

Reviewing files that changed from the base of the PR and between 5c3a7df and 8999f2f9225e91783a57120133af04d24f21c632.




📒 Files selected for processing (2)
  • src/main/persistence/loading-store/session-host-partitions.ts
  • src/main/persistence/loading-store/store-host-partition-before-unload.test.ts



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





📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

setHostWorkspaceSession now normalizes persisted and incoming host sessions before retirement and rebasing logic. New tests cover editor-only before-unload staging, missing terminal maps, topology revisions, and preservation of existing terminal state.





Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 8999f

This fix lets sessions that contain only editor tabs save during quit or update restart. No actionable merge-blocking risk was identified.

Pre-merge checks | Passed 4 | Failed 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 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Issue #25924 requires first-attempt quit or update staging for a paired runtime with no terminal tabs and saved terminal topology revisions. setHostWorkspaceSession now normalizes both the incoming …
Out of Scope Changes check Passed The production change is limited to host-session map normalization at the save boundary. The test changes exercise the linked shutdown failure and related stale-session preservation cases. The availab…
Title check Passed The title clearly and concisely describes the primary change: saving editor-only host sessions during quit.
Description check Passed The description follows the required template, explains the failure and fix, links issue #25924, documents testing, and records the lack of a visual change. It is sufficiently complete despite the man…



✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR




🛠️ Fix failing CI checks 💡
  • 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.

nwparker added a commit that referenced this pull request Oct 9, 2026
Records the retained adapted contribution from #25925 in replacement PR #26848.

Co-authored-by: Sangin <[email protected]>
@OrcaWin
OrcaWin force-pushed the nwparker/obvious-empty-host-quit-10-09 branch from 5c3a7df to 8999f2f Compare October 11, 2026 05:53
Normalize the incoming host slice and the saved partition before retirement and
membership rebasing read their terminal maps.

Fixes #25924
@OrcaWin
OrcaWin force-pushed the nwparker/obvious-empty-host-quit-10-09 branch from 8999f2f to a246a70 Compare October 11, 2026 06:37
@OrcaWin
OrcaWin merged commit 58d1d8d into main Oct 11, 2026
36 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.

[Bug]: Quit and update restart are cancelled with "Failed to stage renderer state before unload" when a paired runtime has no terminal tabs

2 participants