Repository navigation
fix(server): treat remote delegated tasks as app-owned on stop and restart - #42069
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EvidenceBoth real-app scenarios failed on base and passed on head. Environment: Linux, Chromium, 1280×800, light theme, fresh linked servers and synthetic projects, replay agents. Steps: launch an async remote question task through the parent's MCP session, press Stop, and inspect the remote child. Separately, let a parent settle with an open remote task, SIGTERM and restart its server, then inspect the parent, child, and continuation outbox.
Both restart runs retained one completed parent run and a running remote child. Neither produced an extra visible parent turn; the reproduced difference is the unnecessary internal continuation effect. Captured runtime observations. Stop scenario · Restart scenario. Recordings are trimmed around the actions and finish with the corresponding captured result held for three seconds; teardown disconnection screens are excluded. Not shown:
|
…start (pingdotgg#42069) Co-authored-by: Julius Marminge <julius0216@outlook.com> (cherry picked from commit 15afd7f)




Remote tasks delegated to a linked environment (
origin: "app_owned",childThreadId: null,remoteChild: { ... }) were missed by two server guards that only checkedchildThreadId !== null:Orchestrator.dispatchThreadStop: skipped enqueuingdelegated-tasks.stopwhen a parent thread only had remote delegated tasks, leaving remote tasks running on the linked environment after Stop—even thoughThreadManagementService.stopDelegatedTasksalready stops remote tasks (the existing test inRemoteDelegation.test.tscalledstopDelegatedTasksdirectly instead of dispatchingthread.stop).RestartContinuation.hasOpenAwaitedWork: treated an open remote delegated task turn item as cancelled provider background work on server restart, causingrestartContinuationRunto wake an already-settled (completed/waiting) parent run—even thoughProviderRuntimeRecoveryService.isAppOwnedDelegation(updated in feat(server): delegate_task to a linked environment #16719) intentionally keeps remote delegated tasks open to report back viaRemoteDelegation.Fix
remoteChild !== undefinedalongsidechildThreadId !== nullinOrchestrator.ts(dispatchThreadStop) andRestartContinuation.ts(hasOpenAwaitedWork), matchingProviderRuntimeRecoveryService.ts.hasRunningDelegatedTasks(thread.archive) unchanged, sinceRemoteDelegatedTask.test.tsexplicitly requires remote tasks not to block local archiving.RemoteDelegation.test.tsandRestartContinuation.test.ts.Verification
Reproduced on unmodified
origin/main(fc91bfdf6c) before applying the fix:vp test run apps/server/src/peer/RemoteDelegation.test.ts -t "thread.stop enqueues delegated-tasks.stop for remote-only delegated tasks"failed withAssertionError: expected false to be true(orchestration_v2_effect_outboxcontained nodelegated-tasks.stopeffect).vp test run apps/server/src/orchestration-v2/RestartContinuation.test.ts -t "does not continue a settled run whose only open subagent is a remote delegated task"failed withAssertionError: completed: expected { id: 'run:restart', ... } to equal undefined.After applying the fix:
vp test run apps/server/src/peer/RemoteDelegation.test.ts— 53/53 passed.vp test run apps/server/src/orchestration-v2/RemoteDelegatedTask.test.ts— 4/4 passed.vp test run apps/server/src/orchestration-v2/RestartContinuation.test.ts— 55/55 passed.vp run check:changed—format,lint(0 warnings / 0 errors),graphql (apps/server), andtypecheck (3 packages)all passed.Gemini 4 Neon in Antigravity