Conversation
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — The change removes a lifetime cap on delegated-completion deliveries, allowing late child results to trigger additional parent provider runs beyond the previous two-delivery limit. Although cancellation retries are bounded and the behavior is tested, this is a material production orchestration-policy change requiring human review. No code changes detected at You can add or adjust custom eligibility rules. Learn more. |
1bd44f2 to
3b9c885
Compare
d3df2c8 to
dfc702c
Compare
|
Thanks for this series, it's hitting exactly what we're seeing with multi-level delegation. One related case I don't think any of the planned PRs cover: when a parent sends a completed child more work with t3_thread_send, the follow-up turn's result is never delivered, because finalizeAppOwnedSubagent returns early once a subagent_result transfer exists. I filed it as #13490. Would this fit into your series, or would you mind if I opened a small PR for it on top of this one? Happy to go whichever way avoids conflicts. |
fe4f6ad to
87c67bd
Compare
A parent-run cohort allowed one completion delivery plus one successor. Any child that finished after the successor started was marked pending and never delivered, so the parent kept working without learning that the child had failed or finished. Coalescing already keeps at most one outstanding delivery per cohort, so drop the lifetime cap and let each settled delivery reserve the next one for results that arrived while it ran. The cap also bounded retries of a cancelled delivery, so bound that directly: a cancelled batch is retried once, and after a second cancellation it waits for a fresh child result instead of re-arming the parent with the same results. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
dfc702c to
e1ff11d
Compare
|
Closing: #13938 removed the |
What Changed
A parent never heard about a delegated task that finished late. Since #5311, each parent-run cohort gets one completion delivery plus one successor. A child that finishes after the successor starts is marked
pendingand stays that way. The parent keeps working without learning that the child failed or finished. The result is still readable throughtask_status, but only if the parent already knows to check.This change drops the lifetime cap in the three places that enforce it:
planDelegatedCompletionDelivery, for a child that finishes when no delivery is outstandingfinalizeDelegatedCompletionDelivery, when a delivery run settles with siblings pendingdispatchNotificationAccepted, when a steering provider accepts a delivery with siblings pendingCoalescing already bounds parent wakes. A cohort holds at most one outstanding delivery, and siblings that finish while it runs join the next one. With the cap gone, each settled delivery reserves the next one for results that arrived while it ran.
The cap also bounded one other thing: retrying a delivery run that was cancelled (Cursor, for example, can report a native cancel). A cancelled delivery puts its batch back to pending, and without a bound it would be re-reserved forever. So that is now bounded directly. A cancelled batch is retried once. If the retry carrying the same results is cancelled too, it waits for a new child result and rides along with that one, instead of re-arming the parent with the same results.
settledDeliveryCountis still recorded, but nothing gates on it anymore.Why
We hit this during a run of Claude rate limits. Child tasks failed with "Claude API rate limit reached". Their results stayed
pendingfor hours while the parent went on to 18 more runs, and nothing told the parent. #5311 capped deliveries so the parent would not re-arm itself for every child. Coalescing already prevents that fan-out, and the cap turns the leftover results into silent losses.Scope is deliberately narrow:
delegate_taskwait timeouts or wake-policy upgrade races. fix(mcp): bound delegation waits and recover completion delivery #11997 covers those.Tests
OrchestratorMcpToolkit.integration.test.ts: the scenario that pinned the cap ("a third terminal ... cannot recursively create a third parent run") now asserts that the third late child gets its own delivery and that the cohort drains after it settles.DelegatedCompletionDelivery.test.ts: new test "keeps delivering late siblings after earlier deliveries settled" covers the provider-accept path with two settled deliveries.t3code/codex-turn-mappingand pass with this change.DelegatedCompletionDelivery.test.ts: new test "retries a cancelled delivery once without re-arming the parent forever" cancels the same delivery twice with no new child result. It waits on the persisted cohort update and asserts one retry and no third reservation. With the retry bound disabled, it fails with a third reservation.DelegatedCompletionDelivery.test.ts: new test "retries a fresh batch even after an unrelated delivery was cancelled" makes sure an earlier cancelled delivery for other results cannot use up a new batch's retry.OrchestratorMcpToolkit.integration,DelegatedCompletionDelivery,SteeringCompletion.integration,ThreadDeletion,CheckpointCaptureService,ProjectionStore, andProviderContinuationService. Server and contracts typecheck clean.Checklist
This change was made by Claude Opus 5.5 with Claude Code and reviewed by GPT-6 Astra with Codex.
🤖 Generated with Claude Code