github / github/copilot-cli

Subagent streaming deltas (assistant.message_delta) not emitted to SDK consumers

Open
#2,645 0 comments 0 reactions 0 assignees View on GitHub
area:agents area:non-interactive
Dominant language
Shell
Stars
11.2k
Forks
1.9k
Avg merge
14h 16m
Merged PRs (30d)
6

Description

### Describe the bug

When subagents runs in parallel via the `task` tool, the SDK consumer does not receive any `assistant.message_delta` events from the subagents. Only after each subagent fully completes does a single `assistant.message` event arrive. During running, subagents' streaming output is invisible to the SDK.

I think there's already an issue reporting this, but it is closed few days ago: #2265 . However I can still repro this in the latest version of Copilot SDK (0.2.2) and CLI (1.0.24).

This makes it hard for cases like tracking each subagent's output.

### Affected version

GitHub Copilot CLI 1.0.24.

### Steps to reproduce the behavior

```
import { CopilotClient, approveAll } from '@github/copilot-sdk';

const client = new CopilotClient();
await client.start()

const session = await client.createSession({
model: "gpt-4.1",
streaming: true,
onPermissionRequest: approveAll
});

const withParent = [];
const withoutParent = [];
const fullWithParent = [];
const fullWithoutParent = [];

const fullDelta = [];
const fullMessage = [];

session.on("assistant.message_delta", (e) => { (e.data.parentToolCallId ? withParent : withoutParent).push(e) });
session.on("assistant.message_delta", (e) => { fullDelta.push(e) });

session.on("assistant.message", (e) => { (e.data.parentToolCallId ? fullWithParent : fullWithoutParent).push(e) });
session.on("assistant.message", (e) => { fullMessage.push(e) });

await session.sendAndWait({ prompt: 'Launch exactly 2 subagents in parallel via the task tool, and let each of them give a 300 words self-introduction.' }, 300000);

console.log(`Delta events with parentToolCallId: ${withParent.length}`);
console.log(`Delta events without parentToolCallId: ${withoutParent.length}`);
console.log(`Full events with parentToolCallId: ${fullWithParent.length}`);
console.log(`Full events without parentToolCallId: ${fullWithParent.length}`);

console.log('\nAll delta messages:');
fullDelta.forEach((m) => { console.log(JSON.stringify(m, null, 2)); });

console.log('\nAll messages:');
fullMessage.forEach((m) => { console.log(JSON.stringify(m, null, 2)); });

await session.disconnect();
await client.stop();
```

### Expected behavior

`Delta events with parentToolCallId` should > 0 and there should be events from subagents.

### Additional context

https://docs.github.com/en/copilot/how-tos/copilot-sdk/use-copilot-sdk/streaming-events#assistantmessage_delta

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.