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
fix(server): delegated background follow-up results do not reach the parent #476
After a delegated child reports its original result, a provider background command can finish and start another child run. LastCode does not register that notification-driven run as a follow-up task, so the parent does not receive its eventual result.
Confirmed source at c909106a31be7aa452a31fce86bd32d47716fadb:
apps/server/src/orchestration-v2/Orchestrator.ts:8313 (recordSubagentFollowup) returns for every command.notification, including background command completion.
The dispatch path at line 15006 locks the parent only for user/MCP messages, so simply removing the early return would leave parent writes without the matching parent lock.
Upstream 0504c99205e427ed1a6a571b2d4c4ece910a8a65 fixes both decisions with one predicate: provider wakes qualify, monitor progress does not (upstream change).
Deterministic reproduction for the repair:
Seed an app-owned delegated child whose original completion has already been delivered/acknowledged.
Dispatch a new child message with createdBy: "agent", creationSource: "provider", and notification.source.kind: "command", matching a completed background command.
Inspect the new child run: it lacks a delegatedTaskId because follow-up registration returned early. Finish that run and check the parent: no new follow-up result/wake is owed.
Expected: the new child run has a follow-up task and its completion reaches the parent exactly once. Monitor notifications must not create follow-up tasks.
Adapt upstream registration and locking together, retaining LastCode family lifecycle admission, ownership-release, Pause and completion-delivery rules. The upstream regression is delivers the run a background command's wake starts after the original result in DelegatedCompletionDelivery.test.ts; extend it with paused and ownership-released cases where appropriate.
This research confirms the source defect and upstream test/fix correspondence; no tests or installed-runtime reproduction were executed here.
Activity