Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix: compaction no longer ends background agents when a message skips it #32119

Openggfincke(GitHub profile, opens in a new tab)wants to merge 6 commits intomain fromrefs/pull/32119/headopened View on GitHub

Showing 5 changed files with 180 additions and 2 deletions (loading 2).

x
0 of 5 viewed, 5 left
15 additions and 1 deletionapps/server/src/orchestration-v2/Orchestrator.tsModified
View file
@@ -11335,8 +11335,22 @@
occurredAt: now,
payload: { ...queuedRun, queuePosition: 1 },
+ // Stopping can end the provider process and its background work, so the message waits instead.
+ const targetProviderThread = projection.providerThreads.find(
+ (thread) => thread.id === target.providerThreadId,
+ );
+ const targetSession = projection.providerSessions.find(
+ (session) => session.id === targetProviderThread?.providerSessionId,
+ );
+ const holdsBackgroundWork =
+ (targetProviderThread?.pendingBackgroundTasks?.length ?? 0) > 0 ||
+ (targetProviderThread !== undefined &&
+ targetSession !== undefined &&
+ (yield* sessionHasBackgroundWork(targetSession, [targetProviderThread])));
const stops =
- isLiveRun(target) && !(yield* stopReachedRun(command, command.threadId, target.id));
+ isLiveRun(target) &&
+ !holdsBackgroundWork &&
+ !(yield* stopReachedRun(command, command.threadId, target.id));
return yield* stopRunForQueuedCommand({
command,
events,
162 additions and 1 deletionapps/server/src/orchestration-v2/SteeringCompletion.integration.test.tsModified
View file
@@ -522,6 +522,7 @@
const steered: string[] = [];