Skip to content

fix(orcad-migration): a host fenced on a manifest no request can carry can be cancelled by its id - #30864

Merged
nwparker merged 2 commits into
mainfrom
nwparker/orcad-migration-oversized-fence-recovery
Oct 20, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/orcad-migration-oversized-fence-recovery

Conversation

@nwparker

@nwparker nwparker commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​221 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​218
Prod 17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​279 $\color{#cf222e}{\Huge{\mathbf{−}}}$​17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​262

ELI5

Moving an SSH host to its managed Orca server first "fences" the host on this computer, then sends the server a description of everything being moved. #30836 stopped new moves from starting when that description is too big to send. But a computer that had already started one before #30836 is stuck: every message about that move, including "cancel it", carries the whole description, so every one is refused before it leaves. The host stays fenced for good.

This PR adds a small "cancel by name" message that only carries the move's id and fingerprint. The server looks up its own copy, and the stuck host can be released.

What Changed

  • Before: for a move whose saved description is between about 785,267 and 786,432 bytes, cancelling the move failed every time with "This SSH host's saved state is too large to move…". The host stayed fenced and could not be used or moved.
  • After: cancelling sends orcad.migration.abortCatalogByReference with only { migrationId, manifestSha256 }. The server finds the move by id, checks the fingerprint matches, and cancels its own staged copy if it has one. It writes that to disk before answering. The fence is released only when the server says, after that write, that it holds nothing for the move. If the server says the move is already committed, the release is refused, as it is today for any committed move.

How it works:

  • abortOrcadMigrationCutover (src/main/ssh/orcad-migration-cutover-coordinator.ts) checks orcadMigrationRequestFits first, using the same budget fix(orcad-migration): refuse before fencing a manifest no catalog request can carry #30836 measures. If the full message would not fit, it uses the new abortByReference port and skips the read and abort that carry the whole manifest.
  • Server side: abortOrcadMigrationCatalogByReference (src/main/persistence/migrating-orcad-catalog/orcad-catalog-reference-abort.ts) looks for the move's stored stage or receipt, refuses a fingerprint mismatch, and hands the stored manifest to the existing abortStagedOrcadMigrationCatalog. The runtime wrapper flushes before reporting an absent result, as the existing durable abort does.
  • Client side: abortRemoteOrcadMigrationCatalogByReference (src/main/ssh/orcad-migration-catalog-reference-client.ts) sends the request only to a server that advertises the new capability orcad.migration-catalog-abort-by-reference.v1. It accepts an "absent" answer only when the server marks it as flushed to disk.

Why

The real risk is a desktop that started the move before v1.4.230 (8f86ccf). That version had no client-side size check, so a manifest in this window could really have reached the server and been staged, or even committed, as long as its sealed frame fit in 1 MiB. So "we can't send it" can never count as proof that the server holds nothing. Only the server can say so, and the server already has its own copy of whatever it received. That makes asking by id and fingerprint the one answer that is provably safe.

Alternatives considered:

  • Measure the exact sealed frame instead of the 1 KiB reserve. This frees most of the window, but roughly the top 300 bytes stay stuck. Proving that those were never delivered depends on every old build's envelope and sealing overhead, which is fragile.
  • Release on "too large to send". Unsafe for the reason above.

Wire compatibility: this adds a new method and a new advertised capability. Nothing changes in existing messages. A client that talks to an older server, one without the capability, refuses before sending and keeps the fence. That refusal uses its own error code, never ORCAD_MIGRATION_DESTINATION_UNSUPPORTED, which the coordinator treats as permission to release. If a server advertises the capability but answers method-not-found, that is mapped to the same refusal. Older desktops never see or send the new method.

Linked Issue

Follow-up to #30836 (from the SSH/managed-server deficiency scan). No separate issue.

Visual Proof

N/A. No UI change. The existing cancel action now succeeds where it used to fail with the "too large" message.

Testing

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

New tests, which fail on main:

  • orcad-migration-cutover-coordinator.test.ts, "a journal fenced before fix(orcad-migration): refuse before fencing a manifest no catalog request can carry #30836 on a manifest no request can carry". This rebuilds a pre-fix(orcad-migration): refuse before fencing a manifest no catalog request can carry #30836 journal and fence on a manifest that is over budget but under the cap. The fake destination refuses whole-manifest requests unsent, as the real client does. On main, the abort rejects with orcad_migration_manifest_too_large and the fence stays. With this PR it covers: release on a durable absent answer; abort of a stage an older build delivered whole; fence kept when the server can't answer by reference; release refused for a committed server.
  • persistence-orcad-migration-catalog.test.ts: the real Store aborts by reference from its own staged copy. It refuses a fingerprint mismatch with the stage left in place, and never rolls back a commit.
  • orcad-migration-catalog-client-frame-budget.test.ts: only the identity is sent, a non-durable absent answer is refused, and a server without the capability gets nothing.

Verified locally: those three files, plus the orcad-migration*, migrating-orcad-catalog, runtime/rpc/methods, managed-server/lifecycle and shared/orcad-migration folders, single worker. The only failures there (orcad-runtime-deployment, orcad-runtime-maintenance, some rpc/methods session-tab and orchestration specs, all with "AppEnvironment not initialized") fail the same way on main. Also ran pnpm tc and every step of the "static analysis and typecheck" job, including all ratchets and verify:rpc-params-catalog.

Live vs tests: verified in unit tests only. I didn't reproduce on a real host, because building a pre-#30836 fenced journal needs an older desktop build plus a manifest in a 1 KiB window.

AI Disclosure

Review

Codex (gpt-6.1-sol, high): three rounds (first head, rebased head, and after the review-driven test additions). No findings in any of them. Independent Opus review: mergeable. Its two P2 test gaps are closed: the written-to-disk-before-absent retry for abortStagedOrcadMigrationCatalogByReferenceDurably, and orcad.migration.abortCatalogByReference in the RPC registration and runtime-client-only tests.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Known limits (P3, intentional and conservative):

  • If an older build fully committed such an oversized manifest, the host stays fenced with no path forward. Confirming a commit needs the commit acknowledgement, which carries the whole manifest. The release is refused, which is safe, and the host was already stuck before this PR.
  • On a host that lacks the catalog capability entirely, this branch keeps the fence, where the normal branch would release it as "destination-unsupported". Conservative by choice: the by-id path never treats "unsupported" as evidence.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • 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 Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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 52 seconds.

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: 6b94b754-2209-41e8-b17c-e2dc2c713d9f
📥 Commits

Reviewing files that changed from the base of the PR and between 646f073713df94ab04246905c5d9531b8db00136 and 77ab5e2.

⛔ Files ignored due to path filters: 1
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing: 4
  • src/main/persistence/migrating-orcad-catalog/orcad-catalog-import.ts
  • src/main/runtime/orcad-migration-catalog-import.test.ts
  • src/main/runtime/rpc/methods/orcad-migration.test.ts
  • src/shared/orcad-migration/orcad-migration-manifest.ts

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: 602862de-253c-4709-8b7a-b34261f73639
📥 Commits

Reviewing files that changed from the base of the PR and between bd7633f and 646f073713df94ab04246905c5d9531b8db00136.

⛔ Files ignored due to path filters: 1
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing: 20
  • src/main/managed-server/lifecycle/orcad-runtime-conversion-wiring.ts
  • src/main/persistence-orcad-migration-catalog.test.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-catalog-import.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-catalog-reference-abort.ts
  • src/main/runtime/orca-runtime-migration-catalog.ts
  • src/main/runtime/orcad-migration-catalog-import.ts
  • src/main/runtime/rpc/methods/orcad-migration.ts
  • src/main/runtime/runtime-store-contract.ts
  • src/main/ssh/orcad-migration-catalog-client-frame-budget.test.ts
  • src/main/ssh/orcad-migration-catalog-client.ts
  • src/main/ssh/orcad-migration-catalog-reference-client.ts
  • src/main/ssh/orcad-migration-cutover-coordinator.test.ts
  • src/main/ssh/orcad-migration-cutover-coordinator.ts
  • src/main/ssh/orcad-migration-destination-fake.ts
  • src/main/ssh/orcad-migration-manifest-export.ts
  • src/main/ssh/orcad-migration-repository-link.test.ts
  • src/shared/orcad-migration/orcad-migration-catalog-state.ts
  • src/shared/orcad-migration/orcad-migration-manifest.ts
  • src/shared/orcad-runtime-capabilities.ts
  • src/shared/rpc-contract/orcad-migration-params.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.

📝 Walkthrough

The change adds reference-based migration catalog aborts using a migration ID and manifest hash. The runtime exposes the operation through an RPC and reports durable absence after flushing migration state. The SSH cutover coordinator uses the reference path when a manifest does not fit in a request. The persistence logic distinguishes committed, staged, and absent catalogs.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 646f0

The oversized abort path correctly keeps the source fence unless the destination confirms durable absence. No identified issue needs to block merging after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 39.13% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 20 files. 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: allowing cancellation of a fenced Orcad migration when the manifest cannot fit in a request.
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 is detailed and covers the required ELI5, What Changed, Why, linked issue context, visual proof, testing, review, scope boundary, notes, and checklist sections. It explains the user-vi…
Full details: Description check

Explanation

The description is detailed and covers the required ELI5, What Changed, Why, linked issue context, visual proof, testing, review, scope boundary, notes, and checklist sections. It explains the user-visible behavior, implementation, safety rationale, compatibility behavior, and test coverage. Minor gaps remain: it does not explicitly use the template's Fixes # format, manual testing was not performed, and the full lint, test, and build checklist is not marked complete. These gaps do not make the description incomplete.

✨ 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
nwparker force-pushed the nwparker/orcad-migration-oversized-fence-recovery branch from 646f073 to 57f3b82 Compare October 19, 2026 21:18
nwparker and others added 2 commits October 19, 2026 16:31
…rry can be aborted by its identity

A desktop that fenced a manifest just under the export cap before #30836
could never send its abort: every catalog request carries the whole
manifest and refuses it before sending. The abort now asks the server by
migration id and digest instead (orcad.migration.abortCatalogByReference,
behind a new capability), and releases only on the server's durable
absent answer. A committed server still refuses the release.

Co-authored-by: Claude <[email protected]>
@nwparker
nwparker force-pushed the nwparker/orcad-migration-oversized-fence-recovery branch from 57f3b82 to 77ab5e2 Compare October 19, 2026 23:39
@nwparker
nwparker merged commit 6f96efb into main Oct 20, 2026
61 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