fix(server): drain queued native child continuations#21461

open8
takeover/opencode-pending-snapshots
takeover/opencode-continuation-ingestion
opened5d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 40m ago
0 / 2 viewed2 files changedLine totals unavailable

apps/server/src/orchestration-v2/RunExecutionService.ts ยท Earlier revision 31b509ce ยท right 1343โ€“1345

Original diff
@@ -1331,6 +1339,12 @@ export const layer: Layer.Layer<
                   activeBackgroundTurnItems,
                   (current) => new Set([...current].filter((id) => !detached.itemIds.has(id))),
                 );
+                // Routing now rejects the moved thread's snapshots, so none would clear its entry.
+                for (const providerThreadId of pendingBackgroundWork.keys()) {
+                  if (!routing.ownedProviderThreadIds.has(providerThreadId)) {
+                    pendingBackgroundWork.delete(providerThreadId);

apps/server/src/orchestration-v2/RunExecutionService.ts ยท right 1343โ€“1345