You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
#418 step 3: Unify managed completion and restart recovery with upstream delegation #435
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.
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:
Run-less admission now reads only the parent thread row.
reuseManagedChild reads only the current owner's task.
I also narrowed a third read, the closed-child check in taskResultPending, to this task only.
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
Existing tests (child-side logic that doesn't depend on the owner)
Results:
The focused set (17 files) ran 345 passed and 2 failed.
Both failures were in ThreadLaunchService.repositoryHandoff.fork.test.ts. That test sent a read no run saw and expected the result to leave the parent's wake, which is the defect, so I changed its expectation. A rerun of the affected files passed 81/81.
vp run check:changed: format, lint, both knip runs, GraphQL and tests (118) pass.
The typecheck fails only on McpHttpServer.test.ts(1711), a file this PR doesn't touch. Typechecking main's versions of my six changed files reproduces the same two errors.
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).
Activity
tannerpolley commentedon Nov 18, 2026
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
tannerpolley commentedon Nov 18, 2026
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_statusor 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 withexpected 'acknowledged' to equal 'claimed'and passes after.Other changes:
issues/IssueCommentEffects.ts(makeIssueCloseout). The completion helper no longer imports any issue code, and the span name is kept.task_status, wait and the parent wake):ForkDelegatedCompletion.taskResultPending.delegatedCompletionPlanEventsinstead of building the same events inline.reuseManagedChildreads only the current owner's task.taskResultPending, to this task only.Tests: I parameterized the existing restart test in
DelegatedCompletionDelivery.fork.test.tsover both cohort owners and added three tests beside it. Every case runs for both owners:ThreadLaunchService.repositoryHandoff.fork.test.ts. That test sent a read no run saw and expected the result to leave the parent's wake, which is the defect, so I changed its expectation. A rerun of the affected files passed 81/81.vp run check:changed: format, lint, both knip runs, GraphQL and tests (118) pass.McpHttpServer.test.ts(1711), a file this PR doesn't touch. Typecheckingmain's versions of my six changed files reproduces the same two errors.Footprint:
Orchestrator.tsgoes from +1690/−775 to +1671/−771 against the plan's pinned upstream commit.ForkDelegatedCompletion.tschanges 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.tstypecheck error? It needs its own owner either way.PR #471, head 22f5cdf, checks and reviews: none reported yet (draft).