Skip to content

fix(ssh): saved terminal history no longer blocks a host's move to its Orca server (#30126) - #30188

Merged
nwparker merged 1 commit into
mainfrom
nwparker/orcad-manifest-layout-buffers
Oct 18, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/orcad-manifest-layout-buffers

Conversation

@nwparker

@nwparker nwparker commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​151 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​147
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​84 $\color{#cf222e}{\Huge{\mathbf{−}}}$​11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​73

ELI5

When Orca moves an SSH host's saved state onto its new Orca server, it packs everything into one signed bundle with a 768 KB size limit. Saved terminal history is supposed to travel separately, in chunks. One kind of saved terminal history (what Orca keeps when you switch away from a workspace) was packed into the bundle anyway. A few busy terminals pushed the bundle over the limit, and the host could not connect at all.

What Changed

Before: A host with a few terminals full of output failed to connect with orcad_migration_manifest_too_large. That message said nothing about the cause or the fix. The reporter's only way out was to remove a project.

After: All saved terminal history moves through the existing chunked transfer channel, so terminal output no longer counts toward the 768 KB limit. If a host's saved state is still too big for some other reason, the error names its largest parts and says what to trim. For example: "This SSH host's saved state is too large to move to its Orca server (limit 768 KB). Largest parts: saved tabs and panes (1712 KB), ... Close tabs you no longer need or remove unused projects for this host, then reconnect."

Mechanism:

  • A tab's scrollback has two saved copies: the shared terminalLayoutsByTabId[*].buffersByLeafId, and the local-only localOnlyScrollbackByTabId that the ordinary park writes. The migration export (projectOrcadMigrationSessionScrollback) already moved the shared copy out of the manifest into scrollback snapshots, which is the channel feat(orcad-migration): a capability-gated blob channel beside scrollback (D1b-6a) #28866 built on. The local-only copy came along inline through extractSessionOwnersForTransfer, and nothing stripped it. That inline copy is what overflowed the manifest, not the layout buffers the issue suspected. A unit repro with three large parked tabs showed localOnlyScrollbackByTabId at about 1.1 MB in the manifest while the layouts were about 500 bytes.
  • The projection now reads both copies with the renderer's precedence (local-only wins, as in resolveLeafScrollbackBuffers). It emits one snapshot descriptor and one scrollbackRefsByLeafId entry per pane, and drops localOnlyScrollbackByTabId from the payload. The source's chunk reader (findSnapshotBytes) reads the same copy.
  • Retention used to skip writing an inline snapshot whenever a file already existed under the same tab/leaf ref. After this change, a newer local-only copy can stand in for an older on-disk file, so retention now checks the stored file against the signed descriptor and rewrites it when the two differ. Without this, a retried upload after the tab closed would fail with orcad_migration_source_snapshot_changed. Codex caught this one.
  • createOrcadMigrationManifest turns the bare orcad_migration_manifest_too_large into the actionable message above. The code stays at the end for diagnostics.

Why

  • Why this channel: it is the one feat(orcad-migration): a capability-gated blob channel beside scrollback (D1b-6a) #28866 built for this job, so no new channel or protocol is needed. The issue's other suggestions, capping or dropping buffers, would lose terminal history that can move safely.
  • New client, old server: the snapshot channel and scrollbackRefsByLeafId have been part of manifest v1 since the first migration-capable server, so an older server installs these panes exactly like any other dormant pane. No new field, opcode or capability is involved.
  • Old client, new server: the server-side validation is unchanged, so it still accepts an older client's manifest.
  • The "degrade instead of failing" ask: terminal buffers can no longer reach the manifest at all, so there is nothing left to drop. The remaining failure case now explains itself.

Linked Issue

Fixes #30126

Visual Proof

N/A: the change is in the main process. The only visible change is the wording of an error string, and its new text is quoted above.

Testing

  • Automated tests added/updated
  • Unit, src/main/persistence/migrating-orcad-catalog/orcad-source-export.test.ts:
    • Three parked tabs with more than 768 KB of local-only scrollback now export. Each pane becomes a snapshot whose chunked bytes equal the local-only copy. This test failed on main with orcad_migration_manifest_too_large.
    • A newer local-only copy over an older on-disk file under the same ref is retained and served after the tab closes. This test failed before the retention fix.
  • Unit, src/main/ssh/orcad-migration-manifest-export.test.ts: the oversized-manifest message names its largest part and what to trim.
  • E2E, tests/e2e/ssh-orcad-auto-convert.spec.ts: this runs in the Docker managed-orcad lane on a real sshd container with a real orcad deploy. The relay-era conversion seed now has a split terminal with two parked panes, about 900 KB of local-only scrollback in total. The test asserts that the conversion completes and that the journaled manifest carries both panes as snapshots of the seeded size, with no inline local-only scrollback.
  • What was verified where: the root cause was reproduced and the fix verified in unit tests against the real SQLite-backed Store. The full SSH connect and conversion path is verified by the Docker managed-orcad CI lane. It was not run locally, because the local Docker daemon was unresponsive.
  • Ran locally: pnpm tc, all the steps of the static-analysis job (including the focus-read and layout-writer ratchets), and every test file under src/main/persistence/migrating-orcad-catalog, src/shared/orcad-migration*, src/main/ssh/orcad-migration*, src/main/persistence-orcad-migration* and src/main/persistence/moving-wsl-projects.

Notes

  • Out of scope: unsaved editor drafts are also inlined in the manifest with no size budget. That is a separate risk, not touched here.
  • Platforms: no platform-specific code is involved. The fix runs on the desktop that exports, on every OS, for SSH hosts including WSL-over-SSH as in the report.

…o a big saved buffer no longer blocks a host's move (#30126)
@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3e780c5a-986d-4fbd-8851-3a84c5127b4d
📥 Commits

Reviewing files that changed from the base of the PR and between b9b1b85 and 8a84573.

📒 Files selected for processing: 7
  • src/main/persistence/migrating-orcad-catalog/orcad-source-export.test.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-source-scrollback-retention.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-source-scrollback-state.ts
  • src/main/ssh/orcad-migration-manifest-export.test.ts
  • src/main/ssh/orcad-migration-manifest-export.ts
  • tests/e2e/helpers/orcad-upgrade-profile.ts
  • tests/e2e/ssh-orcad-auto-convert.spec.ts
  • 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.

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]: SSH connect fails with orcad_migration_manifest_too_large when saved terminal buffers are large

1 participant