Repository navigation
fix(orchestration): enforce honest recipient routing - #14964
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
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 47a53b6 and c5ddef4bf659ae033e3f8235329298be589aac0d. 📒 Files selected for processing (22)
🚧 Files skipped from review as they are similar to previous changes (16)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe change adds durable run and dispatch mailbox lookup for terminal handles. Bare recipients now resolve to canonical 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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.
🧹 Nitpick comments (1)
src/cli/handlers/orchestration.ts (1)
615-629: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winThe relay branch drops recipient warnings.
src/main/runtime/rpc/methods/orchestration.tswraps the federated control-mail receipt withwithSendWarningsat Line 641, so a relay receipt can carrywarnings. The CLI type at Lines 120-129 omitswarningson the relay variant, and the relay branch returns the line withoutwithWarnings. If a resolveddispatch:recipient ever produces a warning, the CLI hides it. ApplywithWarningsto the relay lines and add the field to the relay variant.♻️ Proposed fix
if ('relay' in r) { if (r.relay.destination === 'worker') { - return `Queued ${r.relay.messageId} for worker Dispatch ${r.relay.dispatchId}` + return withWarnings(`Queued ${r.relay.messageId} for worker Dispatch ${r.relay.dispatchId}`) } - return `Queued ${r.relay.messageId} for Run home (Dispatch ${r.relay.dispatchId})` + return withWarnings( + `Queued ${r.relay.messageId} for Run home (Dispatch ${r.relay.dispatchId})` + ) }Add the field to the relay variant at Lines 120-129:
lifecycle?: LifecycleSendResult + warnings?: SendRecipientWarning[] }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1ec3d491-7ff0-488d-8913-048237845122
📥 Commits
Reviewing files that changed from the base of the PR and between 9e3e583 and 7b884cd598290dd7a849f7c54c058186858eab5b.
📒 Files selected for processing (13)
src/cli/handlers/orchestration-send-receipt-warnings.test.tssrc/cli/handlers/orchestration.tssrc/main/runtime/orchestration-cli-subprocess.test.tssrc/main/runtime/orchestration/db.tssrc/main/runtime/orchestration/orchestration-legacy-storage-db.test.tssrc/main/runtime/rpc/errors.tssrc/main/runtime/rpc/methods/orchestration-check.test.tssrc/main/runtime/rpc/methods/orchestration-recipient-routing.test.tssrc/main/runtime/rpc/methods/orchestration-recipient-routing.tssrc/main/runtime/rpc/methods/orchestration-send.test.tssrc/main/runtime/rpc/methods/orchestration.tssrc/main/runtime/rpc/orchestration-legacy-coordinator-race.test.tssrc/main/runtime/rpc/orchestration-runtime-update-settlement.test.ts
Included review availability: Your plan includes up to 10 reviews per rolling hour; 7 remain after this review.
a1696af to
58ffc86
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
58ffc86 to
c5ddef4
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
c5ddef4 to
0d44f4a
Compare
Summary
Enforce honest orchestration recipient routing at the authoritative send boundary.
This supersedes #13639. That PR predates the canonical Run/Dispatch mailbox work in #13717 and its fork rejects maintainer pushes despite maintainerCanModify, so this branch rebuilds the fix directly on current main.
Fixes #13363.
Semantics
No schema migration, protocol bump, stream opcode, provider-specific path, or platform-specific behavior is introduced.
Reproduction and oracle
Latest affected main reproduced the original defect through the public CLI: invented and closed terminal handles returned ok:true, persisted unread orphan rows, and replayed mutation receipts. Cross-Run bare coordinator mail and group fan-out were stored under the sender Run and invisible to the intended reader. #13717 already fixed same-Run stale coordinator aliases and active Dispatch compatibility; this PR preserves those paths and narrows the remaining gap.
The deterministic routing oracle checks both receipt/error behavior and persisted DB/check visibility. The byte-identical red/green/revert matrix used test bytes with SHA-256 64415fea11974799f95e1392a75db319393ee1765cf9e26753bdbe397dd06166:
The final rebased candidate adds a nested-transaction regression and a single-Dispatch wrong-Run proof; its routing oracle is 18/18 green.
Rebase and validation
Final commit 0d44f4a is directly based on main c7995a6.
Main's orchestration DB modularization conflicted with the old monolithic db.ts hunk. The conflict resolution kept main's facade and ported the five DB changes into message-insert, run-lookup, dispatch-lookup, and legacy-coordinator-mail-takeover modules with their exports and prototype attachments intact.
Compatibility
Resolution uses host-authoritative runtime and database state, so local, folder-workspace, SSH, paired/headless, and reminted-handle paths share the same boundary. Existing RPC shapes only gain optional receipt warnings; older clients ignore them, while hard errors use the existing structured RPC error path. Federation, acknowledgements, deduplication, restart reconciliation, and lifecycle settlement behavior remain unchanged.
Review disposition
Three independent gpt-5.6-luna reviewers covered routing/#13717 compatibility, adversarial cross-Run/stale-handle/fan-out/SSH/paired/mixed-version behavior, and test non-vacuity/DB/performance/scope.
One legitimate final-round finding was fixed: insertMessages used a top-level transaction and could roll back a caller-owned outer transaction. It now uses a SAVEPOINT with a regression that proves the outer write survives while the failed inner batch is fully removed.
Two claims were rejected with evidence:
All three reviewers returned CLEAN on the exact final diff. After main advanced with two unrelated UI/IME commits, all three independently confirmed the final rebase preserved the reviewed patch byte-for-byte and kept main as the direct parent.