Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): Claude subagents from a closed process no longer stay running #16814

Closedid0Sch(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/16814/headopened View on GitHub

Showing 2 changed files with 174 additions and 0 deletions (loading 1).

x
0 of 2 viewed, 2 left
174 additions and 0 deletionsapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.tsModified
View file
@@ -10457,6 +10457,21 @@
yield* switchTurn("attempt-claude-model-change-running-subagent-c");
assert.lengthOf(processQueues, 2);
+ // The replacement process ends the stopped subagent's card in the
+ // run that launched it, so it does not stay "running" forever.
+ const subagentUpdates = () =>
+ events.flatMap((event) =>
+ event.type === "subagent.updated" &&
+ event.subagent.nativeTaskRef?.nativeId === SUBAGENT_TASK_ID
+ ? [event.subagent]
+ : [],
+ );
+ yield* awaitUntil(
+ () => subagentUpdates().at(-1)?.status === "interrupted",
+ "stopped subagent interrupted",
+ );
+ assert.equal(subagentUpdates().at(-1)?.runId, subagentUpdates()[0]?.runId);
+​
// The stopped subagent never reports its end, so it must not block
// later changes on the replacement process either.
yield* Queue.offer(
@@ -10487,6 +10502,165 @@
+ it.effect("interrupts a stopped subagent when the replacement process fails to open", () =>
+ Effect.scoped(
+ Effect.gen(function* () {