github / github/copilot-cli

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

Đang mở
#2,645 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:agents area:non-interactive
Ngôn ngữ chính
Shell
Star
11.2k
Fork
1.9k
Merge trung bình
14 giờ 16 phút
Pull request đã merge (30 ngày)
6

Mô tả

### 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.