The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 13:15 UTC
fix(client-runtime): keep subagent questions off parent threads (#26367)
Yash Singh committed
Oct 28, 2026 at 03:52 UTC
975b3dc56850d8a22dc90462219e53be95d8dcf7
2 files changed
+18
-2
packages/client-runtime/src/state/threadShell.test.ts
+15
-1
@@ -108,7 +108,7 @@ describe("v2 thread shell lists", () => {
108
registry.dispose();
109
});
110
111
- it("counts a subagent question on its parent only while the subagent runs", () => {
111
+ it("keeps a live subagent question inside the parent without flagging its thread", () => {
112
const { registry, threads, snapshotAtom } = makeHarness();
113
const root = v2ThreadShell;
114
const child = {
@@ -132,6 +132,10 @@ describe("v2 thread shell lists", () => {
132
const dispose = registry.mount(inputs);
133
registry.set(snapshotAtom(environmentId), { ...v2ShellSnapshot, threads: [root, child] });
134
expect(registry.get(inputs).map((thread) => thread.id)).toEqual([child.id]);
135
+ expect(
136
+ registry.get(threads.threadShellAtom({ environmentId, threadId: root.id }))
137
+ ?.pendingSubagentRequest,
138
+ ).toBeNull();
139
registry.set(snapshotAtom(environmentId), {
140
...v2ShellSnapshot,
141
threads: [root, { ...child, status: "queued" as const }],
@@ -272,6 +276,16 @@ describe("v2 thread shell lists", () => {
276
`${remoteEnvironmentId}/${helper.id}`,
277
]);
278
279
+ registry.set(snapshotAtom(remoteEnvironmentId), {
280
+ ...v2ShellSnapshot,
281
+ threads: [
282
+ task,
283
+ { ...helper, pendingRuntimeRequest: { ...approval, kind: "user_input" as const } },
284
+ ],
285
+ });
286
+ expect(registry.get(threads.threadShellAtom(parentRef))?.pendingSubagentRequest).toBeNull();
287
+ expect(registry.get(inputs).map((thread) => thread.id)).toEqual([helper.id]);
288
+
289
// A task whose parent is gone there is listed on its own, as is one whose
290
// parent's environment is switched off.
291
registry.set(snapshotAtom(environmentId), { ...v2ShellSnapshot, threads: [] });
packages/client-runtime/src/state/threadShell.ts
+3
-1
@@ -76,7 +76,7 @@ function subagentRequest(thread: OrchestrationV2ThreadShell): PendingSubagentReq
76
}
77
78
/**
79
- * The threads to flag for a subagent's live question or approval, up its
79
+ * The threads to flag for a subagent's live approval, up its
80
* subagent chain. `delegated` are tasks this environment's threads delegated
81
* to linked environments, with what each one, or its own subagents, asks.
82
*/
@@ -94,6 +94,8 @@ function pendingSubagentRequestsByThread(
94
request: PendingSubagentRequest,
95
seen: Set<ThreadId>,
96
) => {
97
+ // The coordinator answers child questions; only approvals need user attention.
98
+ if (request === "user_input") return;
99
byId ??= new Map(threads.map((thread) => [thread.id, thread] as const));
100
let parentId = firstParentId;
101
while (parentId !== null && !seen.has(parentId)) {