Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(opencode): a finished background subagent keeps its thread busy until the wake run is dispatched #40396

Opennkoynov(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/40396/headopened View on GitHub

Showing 8 changed files with 109 additions and 4 deletions (loading 7).

x
0 of 8 viewed, 8 left
109 additions and 4 deletionsapps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.tsModified
View file
@@ -1777,7 +1777,9 @@
string,
Record<string, { status: string; result: string | null }>
- const state: { roster: ReadonlyArray<unknown> | undefined } = { roster: undefined };
+ const state: { roster: OrchestrationV2ProviderThread["pendingBackgroundTasks"] } = {
+ roster: undefined,
+ };
let wake = yield* Deferred.make<void>();
yield* runtime.events.pipe(
Stream.tap((event) =>
@@ -1826,7 +1828,11 @@
yield* until(check);
- return { calls, callsById, callsAtChildTurnStart, childTurns, state, until };
+ // A reported subagent stays listed until the wake that reads its report, which these replays never start.
+ const rosterSettled = () =>
+ state.roster !== undefined &&
+ state.roster.every((task) => callsById.get(task.taskId)?.status !== "running");
+ return { calls, callsById, callsAtChildTurnStart, childTurns, state, until, rosterSettled };
const launchedAndRunning = [
...backgroundLaunch(CHILD),
@@ -2006,7 +2012,7 @@
() =>
watch.calls.get("Again")?.status === "completed" &&
watch.calls.get("Sleep")?.status === "completed" &&