Skip to content

#418 step 3: Unify managed completion and restart recovery with upstream delegation #435

Closed

Description

@tannerpolley

Part of #418. Step 3 of 4. Depends on step 2. Includes the backend wake work split from #429. Full scope, tests and done criteria are in the canonical plan: #418 (comment) (item 3, and "#429 division").

Scope: one upstream planner for both cohort owners, with both persisted owners and their IDs retained (owner decision, 2026-11-17). Issue closeout moves into issue policy.

Preserve:

Cases to cover:

  • concurrent siblings for both owners;
  • restart at the pending, claimed and delivered boundaries;
  • an untagged descendant wake;
  • a background task;
  • failed workspace preparation;
  • a stopped, archived or deleted parent;
  • an explicit result read.

Use persisted events, Deferreds and outbox drains; no sleeps.

Done:

  • task_status, wait and the parent wake agree;
  • every eligible result is delivered, or has an explicit recoverable or disposed outcome;
  • no duplicate logical delivery;
  • old-format fixtures recover.

Activity

  1. tannerpolley commented on Nov 18, 2026

    @tannerpolley
    OwnerAuthor

    T3 Code status: Done

    Issue: #435 #418 step 3: Unify managed completion and restart recovery with upstream delegation

    Thread: thread:delegated-task:command%3Amcp%3A53eed4d4-49de-4205-ba6f-a35a0b15b7c9%3Adelegate-task%3Aissue-435-418-step3-2026-11-18

    Model: claude-opus-5-5

    Branch: issue-435-418-step-3-unify-managed-completion-and

    Updated: 2026-11-18T01:32:11.699Z

  2. tannerpolley commented on Nov 18, 2026

    @tannerpolley
    OwnerAuthor

    T3 Code closeout: done

    Issue: #435 #418 step 3: Unify managed completion and restart recovery with upstream delegation
    Thread: thread:delegated-task:command%3Amcp%3A53eed4d4-49de-4205-ba6f-a35a0b15b7c9%3Adelegate-task%3Aissue-435-418-step3-2026-11-18
    Model: claude-opus-5-5
    Branch: issue-435-418-step-3-unify-managed-completion-and
    Completed: 2026-11-18T01:32:12.037Z

    I've opened draft PR #471. It closes #435, references #418, and isn't merged. The tests caught one real defect, now fixed. The server typecheck still fails on one error that also fails on main, isn't in #470's list, and isn't tracked anywhere yet.

    The defect: for a run-less managed task (cohort stored on the parent thread), a late read that no parent run saw still marked the result as read. It also dropped the result from the parent's queued wake, so the parent never saw it. That read is either task_status or a wait that ends after its turn did. The fork had exempted run-less tasks from upstream's #396 rule, which says an unseen read must not acknowledge a result. I removed the exemption. The new test failed before the fix with expected 'acknowledged' to equal 'claimed' and passes after.

    Other changes:

    • Issue closeout now lives in issues/IssueCommentEffects.ts (makeIssueCloseout). The completion helper no longer imports any issue code, and the span name is kept.
    • One owner for "is this result still waiting on work" (the check behind task_status, wait and the parent wake): ForkDelegatedCompletion.taskResultPending.
    • Duplicate removed: finalize uses the shared delegatedCompletionPlanEvents instead of building the same events inline.
    • Narrowed reads:
    • There's no schema, event or model-facing text change, and nothing touches issue links (#451 step 4: Move thread issue links onto upstream thread.issues #455).

    Tests: I parameterized the existing restart test in DelegatedCompletionDelivery.fork.test.ts over both cohort owners and added three tests beside it. Every case runs for both owners:

    Case Where it's covered
    Concurrent siblings; restart at pending, claimed and delivered Parameterized restart test
    Explicit result read, seen and late New test
    Archived, deleted or stopped parent New test; the old-format "whole mailbox stopped" fixture reopens the wake
    Failed workspace preparation New test, using the real preparation-failure command
    Untagged descendant wake; background task (#350) Existing tests (child-side logic that doesn't depend on the owner)

    Footprint: Orchestrator.ts goes from +1690/−775 to +1671/−771 against the plan's pinned upstream commit. ForkDelegatedCompletion.ts changes by +16/−90. The other shared files are unchanged.

    The PR body states the rollout steps you required: pause admissions, drain workers, install, resume.

    Decision for you: shall I open an issue for the McpHttpServer.test.ts typecheck error? It needs its own owner either way.

    PR #471, head 22f5cdf, checks and reviews: none reported yet (draft).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions