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 21, 06:00 UTC
fix(server): Copilot subagent thinking and replies reach the subagent thread (#38896)
Julius Marminge committed
Nov 19, 2026 at 14:46 UTC
57db750b8f379d6656ad774b11bb6039094ca873
2 files changed
+22
-4
apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts
+13
-2
@@ -4222,6 +4222,17 @@ describe("AcpAdapterV2", () => {
4222
}),
4223
),
4224
);
4225
+ // Copilot 1.0.114 names the subagent only by agentId, on the delta and the chunk.
4226
+ const agentChunk = (text: string, agentId: string) =>
4227
+ raw("assistant.message_delta", { deltaContent: text }, agentId).pipe(
4228
+ Effect.andThen(
4229
+ update({
4230
+ sessionUpdate: "agent_message_chunk",
4231
+ content: { type: "text", text },
4232
+ _meta: { "github.com/copilot": { agentId } },
4233
+ }),
4234
+ ),
4235
+ );
4236
const launch = (toolCallId: string, description: string, mode: string) =>
4237
update({
4238
sessionUpdate: "tool_call",
@@ -4259,10 +4270,10 @@ describe("AcpAdapterV2", () => {
4270
_meta: { "github.com/copilot": { agentId: "agent-a" } },
4271
});
4272
yield* chunk("`a.txt` says", "task-a");
4262
- yield* chunk("`b.txt` has", "task-b");
4273
+ yield* agentChunk("`b.txt` has", "agent-b");
4274
yield* chunk(" hello.", "task-a");
4275
yield* chunk("a.txt b.txt", "task-bg");
4265
- yield* chunk(" three lines.", "task-b");
4276
+ yield* agentChunk(" three lines.", "agent-b");
4277
for (const [task, agent, text] of [
4278
["task-a", "agent-a", "`a.txt` says hello."],
4279
["task-b", "agent-b", "`b.txt` has three lines."],
packages/provider-acp-registry/src/server/copilotAcp.ts
+9
-2
@@ -109,12 +109,19 @@ export function makeCopilotSubagentRouting() {
109
const registerExtensions = (context: AcpAdapterV2ExtensionContext) =>
110
context.runtime.handleExtNotification(COPILOT_SESSION_EVENT, CopilotSessionEvent, (event) => {
111
const data = event.data ?? {};
112
- const task = typeof data.parentToolCallId === "string" ? data.parentToolCallId : undefined;
112
switch (event.type) {
113
case "assistant.message_delta":
114
case "assistant.reasoning_delta": {
115
if (typeof data.deltaContent !== "string") return Effect.void;
117
- session(event.sessionId).delta = {
116
+ const current = session(event.sessionId);
117
+ // Copilot 1.0.114+ names a subagent's deltas only by agentId, without parentToolCallId.
118
+ const task =
119
+ typeof data.parentToolCallId === "string"
120
+ ? data.parentToolCallId
121
+ : event.agentId === undefined
122
+ ? undefined
123
+ : current.taskByAgentId.get(event.agentId);
124
+ current.delta = {
125
kind: event.type,
126
text: data.deltaContent,
127
...(task === undefined ? {} : { task }),