Skip to content

Commit 0b4e599

Browse files
fix(server): restart recovery wakes delegated children waiting on background work
Runtime restart recovery followed every subagent row's provider thread, including app-owned delegated-task rows. The parent's reconcile then cleared a delegated child's awaited background roster on its own stream and recorded no cancelled work on the child, so the child never got the restart note or a continuation. Limit both the runtime candidate join and the runtime recovery projection's subagent provider threads to provider-native subagents; a delegated child owns its provider thread. Fixes #28208 AI-assisted; verified with the tests and tools listed above.
1 parent 22d48dc commit 0b4e599

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎apps/server/src/orchestration-v2/ProjectionStore.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4512,6 +4512,8 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
45124512
SELECT subagents.thread_id FROM pending_provider_threads
45134513
CROSS JOIN orchestration_v2_projection_subagents AS subagents
45144514
ON subagents.provider_thread_id = pending_provider_threads.provider_thread_id
4515+
-- A delegated task's provider thread belongs to its child thread.
4516+
WHERE subagents.origin = 'provider_native'
45154517
UNION
45164518
SELECT subagents.child_thread_id FROM orchestration_v2_projection_subagents AS subagents
45174519
WHERE subagents.child_thread_id IS NOT NULL
@@ -5029,6 +5031,7 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
50295031
UNION
50305032
SELECT provider_thread_id FROM orchestration_v2_projection_subagents
50315033
WHERE thread_id = ${threadId} AND provider_thread_id IS NOT NULL
5034+
AND origin = 'provider_native'
50325035
)
50335036
AND (
50345037
provider_thread.status = 'active'

0 commit comments

Comments
 (0)