Repository navigation
fix(orchestration): retain update settlement authority - #12336
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 2132b55cf8efe616e639051ca9ddc6b524cf5434 and 292b71c. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe change propagates verified caller authority through orchestration preflight, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
There was a problem hiding this comment.
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 winUse attested
processIncarnationfor remote-attachment authority checks.
verifyRemoteAttachmentAuthorityrequiresprocessIncarnationto matchremoteAttachment.process_incarnation, while this path already prefersattestedCaller?.paneKeyforsenderPaneKey. Since the attested caller also carries the terminal process incarnation, computeprocessIncarnationfromattestedCallerbefore 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 winConsider extracting the repeated caller/evidence match check.
Three of the four branches in
resolveCurrentAuthorityrepeat the same shape: verify the caller, then confirmcaller.terminalHandle === evidence.terminalHandlebefore trusting the caller's ownpaneKeyfor a DB lookup. Extract only this narrow check into a small helper (for examplecallerMatchesEvidenceHandle(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
📒 Files selected for processing (5)
config/reliability-gates.jsoncsrc/main/runtime/rpc/methods/orchestration-runs.tssrc/main/runtime/rpc/methods/orchestration.tssrc/main/runtime/rpc/orchestration-legacy-compatibility.tssrc/main/runtime/rpc/orchestration-runtime-update-settlement.test.ts
There was a problem hiding this comment.
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.jsoncsrc/main/runtime/rpc/methods/orchestration.tssrc/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
| 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) |
There was a problem hiding this comment.
🔒 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.
2132b55 to
292b71c
Compare
* 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]>
Summary
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
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.