Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(pi): a Pi session is not released as idle while an async pi-subagents run is working #41649

Mergedchenxin-yan(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/41649/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 27 additions and 3 deletions.

x
0 of 2 viewed, 2 left
18 additions and 0 deletionspackages/provider-pi/src/server/adapter.test.tsModified
View file
@@ -3864,6 +3864,18 @@
statuses: ["running", "running"],
pending: [true],
+ // The run dies with the Pi process, so an idle release must wait for it.
+ const otherThread = { ...providerThread, id: ProviderThreadId.make("other-provider-thread") };
+ assert.isTrue(yield* runtime.hasPendingBackgroundWork!);
+ assert.isTrue(
+ yield* runtime.hasPendingBackgroundWorkForThread!(providerThread, {
+ includeSubagents: true,
+ }),
+ );
+ assert.isFalse(
+ yield* runtime.hasPendingBackgroundWorkForThread!(otherThread, { includeSubagents: true }),
+ );
+ assert.isFalse(yield* runtime.hasPendingBackgroundWorkForThread!(providerThread));
// pi-subagents can mark the run settled one snapshot before the member that ran last.
yield* emitSnapshot("failed", "running", "failed");
yield* emitSnapshot("failed", "complete", "failed");
@@ -3871,6 +3883,12 @@
statuses: ["completed", "failed"],
pending: [false],
+ assert.isFalse(yield* runtime.hasPendingBackgroundWork!);
+ assert.isFalse(
+ yield* runtime.hasPendingBackgroundWorkForThread!(providerThread, {
+ includeSubagents: true,
+ }),
+ );