Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): keep queued subagent status in sync #21487

MergedYash-Singh1(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/21487/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 7 changed files with 70 additions and 2 deletions (loading 4).

x
0 of 7 viewed, 7 left
1 addition and 1 deletionapps/server/src/mcp/toolkits/orchestrator/tools.tsModified
View file
@@ -92,7 +92,7 @@
​
const TaskCancelTool = Tool.make("task_cancel", {
description:
- "Needs an agent running inside a T3 thread. Stop a T3-owned delegated task and dispose its automatic parent delivery. Its child thread stops like a user Stop: the running turn is interrupted, queued turns are held, pull request watches end, and the tasks it delegated stop too. This includes later child-thread runs, even after the task is terminal. A terminal task returns its existing status, and published task results remain available.",
+ "Needs an agent running inside a T3 thread. Stop a T3-owned delegated task and dispose its automatic parent delivery. Its child thread stops like a user Stop: the running turn is interrupted, other queued turns are held, pull request watches end, and the tasks it delegated stop too. The task's own queued turn is cancelled, including when held in a stopped queue. This includes later child-thread runs, even after the task is terminal. A terminal task returns its existing status, and published task results remain available.",
parameters: OrchestratorMcpTaskCancelInput,
success: OrchestratorMcpTaskCancelResult,
failure: OrchestratorMcpFailure,
30 additions and 1 deletionapps/server/src/mcp/OrchestratorMcpService.tsModified
View file
@@ -2229,6 +2229,30 @@
+ const stopped = yield* threadManagement
+ .getThreadRecords(current.childThreadId, ["runs"])
+ .pipe(Effect.mapError(threadManagementFailure));
+ for (const run of stopped.runs) {
+ if (
+ run.status !== "queued" ||
+ (run.delegatedTaskId !== input.taskId && run.id !== current.childRunId)
+ )
+ continue;
+ // Stop preserves the queue for Resume. Cancelling a task must also
+ // remove that task's queued turn, including a previously held one.
+ yield* threadManagement
+ .dispatch({