Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): auto-settle no longer cuts off an agent whose awaited background task just finished #29820

Closeddominic-r(GitHub profile, opens in a new tab)wants to merge 7 commits intomain fromrefs/pull/29820/headopened View on GitHub

Showing 7 changed files with 90 additions and 5 deletions (loading 5).

x
0 of 7 viewed, 7 left
61 additions and 0 deletionsapps/server/src/orchestration-v2/ProjectionSettlement.test.tsModified
View file
@@ -350,6 +350,7 @@
thread: {
...expected,
latestUserAuthoredMessageAt: candidate.latestUserAuthoredMessageAt,
+ heldWorkEndedAt: candidate.heldWorkEndedAt,
}),
@@ -365,6 +366,66 @@
}).pipe(Effect.provide(layerSql)),
​
+it.effect("sql: records when a provider thread's roster stops holding work", () =>
+ Effect.gen(function* () {
+ const store = yield* ProjectionStore.ProjectionStoreV2;
+ const threadId = yield* createThread("held-work");
+ yield* createRun(threadId);
+ const roster = (
+ name: string,
+ at: DateTime.Utc,
+ pendingBackgroundTasks: ReadonlyArray<{
+ readonly taskId: string;
+ readonly kind: "command";
+ readonly awaited?: true;
+ }>,
+ ) =>
+ store.apply({
+ id: EventId.make(`event:settlement:held-work:${name}`),
+ type: "provider-thread.updated",