Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(pi): async subagents leave Running when their run settles first #39888

Mergedjuliusmarmingemerged 2 commits intomain fromrefs/pull/39888/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 6 additions and 0 deletions.

x
0 of 2 viewed, 2 left
2 additions and 0 deletionspackages/provider-pi/src/server/adapter.test.tsModified
View file
@@ -3864,6 +3864,8 @@
statuses: ["running", "running"],
pending: [true],
+ // 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");
assert.deepEqual(yield* collect("marker-2"), {
statuses: ["completed", "failed"],
4 additions and 0 deletionspackages/provider-pi/src/server/adapter.tsModified
View file
@@ -1618,12 +1618,14 @@
run: unknown,
const children = recordField(run, "children");
+ let childrenSettled = true;
for (const child of Array.isArray(children) ? children : []) {
const id = recordString(child, "id");
const agent = recordString(child, "agent");
const status = piAsyncSubagentStatus(recordString(child, "state"));
if (recordString(child, "kind") !== "step" || id === undefined) continue;
if (agent === undefined || status === undefined) continue;
+ if (status === "running" || status === "pending") childrenSettled = false;
const model = recordString(child, "model") ?? null;
const key = `${status}:${model}`;
if (tracked.emitted.get(id) === key) continue;
@@ -1638,6 +1640,8 @@