Skip to content

fix(orchestration): retain update settlement authority - #12336

Merged
Jinwoo-H merged 4 commits into
mainfrom
fix/orchestration-runtime-update-settlement-20260803
Aug 3, 2026
Merged

Jinwoo-H merged 4 commits into
mainfrom
fix/orchestration-runtime-update-settlement-20260803

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • propagate exact hook-attested current worker authority into lifecycle settlement when renderer graph identity is unavailable after an app/runtime update
  • permit explicit legacy Run takeover from the same exact attested current coordinator without requiring a mounted renderer pane
  • retain attested process identity for remote attachments, and register a deterministic production-verifier service oracle in the reliability gate

Reproduction

The concrete task task_20799fc24aa9 / Dispatch ctx_cb7d4031bd88 originally finished work but worker_done was rejected after an update because term_9970c3a6-c425-4582-b20e-9cb9450b8da8 was no longer recognized as the Dispatch pane. App 1.4.167 now shows that Dispatch completed, consistent with PR #11789 restoring its live pane, but current main still rejected the authoritative service path when renderer identity was deliberately absent.

The byte-identical SHA-256 5f45c270f1ea55de24aa4087f9288ac227d2fdb9f3dd68aba5efd02c7e498f35 oracle has a corrected four-point chain: baseline-only overlay 063340a8ba on origin/main@34291f07e9 failed 3/5, candidate@2748b0b29b passed 5/5, actual disabled child 08a7db37bf failed 2/5, and revert d2a4e2e024 passed 5/5. It uses no timing oracle, exercises the production verifier with restored PTY/hook commitments, replays completion and takeover across fresh runtimes, and covers ordinary mail, remote process fencing, exact DB identity/counts, unchanged fixture bytes, and foreign-pane rejection.

The separate term_890e4466-365f-4074-bf3f-0f7957428ef9 observation is not causal here: App 1.4.167 reports it exited, disconnected, and non-writable with paneRuntimeId -1, and terminal send now rejects it with terminal_not_writable. This PR does not duplicate #11789 terminal-mount work.

Validation

  • 7 focused Vitest files, 210 tests passed after the audit changes
  • pnpm typecheck:node
  • pnpm typecheck:cli
  • pnpm check:reliability-gates
  • pnpm check:max-lines-ratchet
  • git diff origin/main...HEAD --check

Security audit

Renderer metadata is not trusted as authority. The fallback is admitted only after the production verifier proves the same live/restored PTY handle, stable pane, launch-token/hook commitment, process incarnation, active Dispatch or bound Run, and host-scoped authority; lifecycle settlement independently requires the Dispatch capability, and mismatched handles and foreign pane evidence remain fenced.

Remaining gaps

Distinct installed A/B artifacts, paired headed/headless runtimes, Docker SSH, folder workspaces, WSL, Linux, and Windows remain live-topology gaps recorded in config/reliability-gates.jsonc. The filesystem marker proves the tested service transition leaves fixture bytes unchanged; it is not a live workspace cleanup/topology test.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d701d731-7060-4563-a244-1ec9be369f66

📥 Commits

Reviewing files that changed from the base of the PR and between 2132b55cf8efe616e639051ca9ddc6b524cf5434 and 292b71c.

📒 Files selected for processing (1)
  • config/reliability-gates.jsonc
🚧 Files skipped from review as they are similar to previous changes (1)
  • config/reliability-gates.jsonc

📝 Walkthrough

Walkthrough

The change propagates verified caller authority through orchestration preflight, orchestration.runUse, and orchestration.send. Matching attested pane keys and process incarnations take precedence over runtime-derived identity. A focused test suite validates retained-worker settlement, coordinator takeover, idempotent replay, foreign-pane rejection, ordinary mail routing, remote relay authorization, and state preservation. Reliability-gate configuration records the test command, assertions, and evidence runs.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: retaining orchestration update-settlement authority.
Description check ✅ Passed The description explains the change, reproduction, validation, security review, and remaining gaps, but omits the required Screenshots, AI Review Report, and Notes sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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.

Caution

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

⚠️ Outside diff range comments (1)
src/main/runtime/rpc/methods/orchestration.ts (1)

400-419: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Use attested processIncarnation for remote-attachment authority checks.

verifyRemoteAttachmentAuthority requires processIncarnation to match remoteAttachment.process_incarnation, while this path already prefers attestedCaller?.paneKey for senderPaneKey. Since the attested caller also carries the terminal process incarnation, compute processIncarnation from attestedCaller before falling back to runtime lookup so remote workers do not fail only on process-incarnation lookup after an update.

🧹 Nitpick comments (1)
src/main/runtime/rpc/orchestration-legacy-compatibility.ts (1)

128-199: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider extracting the repeated caller/evidence match check.

Three of the four branches in resolveCurrentAuthority repeat the same shape: verify the caller, then confirm caller.terminalHandle === evidence.terminalHandle before trusting the caller's own paneKey for a DB lookup. Extract only this narrow check into a small helper (for example callerMatchesEvidenceHandle(caller, evidence)). Keep each branch's DB-lookup logic in place, since the lookups differ (dispatch identity, remote attachment, current-run-for-pane).

Do not attempt to merge the branch-specific DB lookups themselves. That would touch security-sensitive routing logic for a readability-only payoff.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ca114729-6085-4e17-97a1-644fdea93524

📥 Commits

Reviewing files that changed from the base of the PR and between 34291f0 and 3764cf0.

📒 Files selected for processing (5)
  • config/reliability-gates.jsonc
  • src/main/runtime/rpc/methods/orchestration-runs.ts
  • src/main/runtime/rpc/methods/orchestration.ts
  • src/main/runtime/rpc/orchestration-legacy-compatibility.ts
  • src/main/runtime/rpc/orchestration-runtime-update-settlement.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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ad5c113b-cc92-491b-9195-868e10bc5305

📥 Commits

Reviewing files that changed from the base of the PR and between 3764cf0 and 2132b55cf8efe616e639051ca9ddc6b524cf5434.

📒 Files selected for processing (3)
  • config/reliability-gates.jsonc
  • src/main/runtime/rpc/methods/orchestration.ts
  • src/main/runtime/rpc/orchestration-runtime-update-settlement.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/runtime/rpc/methods/orchestration.ts
  • config/reliability-gates.jsonc

Comment on lines +394 to +401
const verifyAuthority = vi
.spyOn(harness.db, 'verifyRemoteAttachmentAuthority')
.mockReturnValue(true)
vi.spyOn(harness.db, 'enqueueFederationRelay').mockReturnValue({
message_id: 'relay-retained-status',
sequence: 1,
dispatch_id: attachment.dispatch_id
} as never)

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.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Add a rejected remote-attachment authorization case.

Lines 394-396 force verifyRemoteAttachmentAuthority to succeed. This test also passes if orchestration.send ignores a failed verification and enqueues the relay. Add a case that returns false, then assert dispatch_capability_invalid and no enqueueFederationRelay call.

@OrcaWin
OrcaWin force-pushed the fix/orchestration-runtime-update-settlement-20260803 branch from 2132b55 to 292b71c Compare August 3, 2026 19:43
@Jinwoo-H
Jinwoo-H merged commit a4944f5 into main Aug 3, 2026
42 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix(orchestration): retain update settlement authority

* test(orchestration): register update settlement gate

* fix(orchestration): close update settlement audit gaps

* test(orchestration): correct update settlement evidence

---------

Co-authored-by: OrcaWin <[email protected]>
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.

2 participants