-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Summary
session.idle fires when the orchestrating session has no pending work queued, but sub-agents may still be running. In testing with 4 sub-agents, only 2 subagent.completed events arrived before session.idle. The other 2 never produced completion events. There is no reliable way to know when all fleet work is done.
Steps to Reproduce
const session = await client.createSession({
onPermissionRequest: async () => ({ approved: true }),
});
const started = [], completed = [];
session.on('subagent.started', (d) => started.push(d.toolCallId));
session.on('subagent.completed', (d) => completed.push(d.toolCallId));
session.on('session.idle', () => {
console.log(`started=${started.length}, completed=${completed.length}`);
// → "started=4, completed=2" ← 2 sub-agents never signalled done
});
await session.rpc.fleet.start({ prompt: 'Do 4 parallel tasks on A, B, C, D' });Observed Behaviour
Spike data from session ba5281cc-5df6-48d8-861d-806f9a51e0e7 (2026-03-17):
{
"subagentsStarted": [
{ "toolCallId": "tooluse_4Vim3gCZxGXWqGqX832PIO", "elapsedMs": 47837 },
{ "toolCallId": "tooluse_QF8x4XKh69tWubnLV1Q9PK", "elapsedMs": 47837 },
{ "toolCallId": "tooluse_Cg1Vhzlg2tLvFgr6yAzLDg", "elapsedMs": 47838 },
{ "toolCallId": "tooluse_rTPWcjyPoZKMHpjiglj9Bi", "elapsedMs": 47838 }
],
"subagentsCompleted": [
{ "toolCallId": "tooluse_QF8x4XKh69tWubnLV1Q9PK", "elapsedMs": 138770 },
{ "toolCallId": "tooluse_4Vim3gCZxGXWqGqX832PIO", "elapsedMs": 170059 }
],
"sessionIdleAt": 175813
}4 started, 2 completed — session.idle fired at 175s. The other 2 tool call IDs appear in tool.execution_start/complete events but no subagent.completed arrived.
Expected Behaviour
One of:
session.idlemust not fire until all fleet sub-agents have emittedsubagent.completedorsubagent.failed- A
fleet.completeevent fires when all sub-agents finish, independent ofsession.idle - Documentation clarifies
session.idle ≠ fleet completionwith the correct waiting pattern
Impact
Callers relying on session.idle to know fleet is done will get false positives. Results from in-flight sub-agents may be silently dropped.
Related
See also: FLEET-2 (session.task_complete never fires), FLEET-4 (no fleet.* lifecycle events)
Environment
- SDK:
@github/copilot-sdkv0.1.32 - CLI: latest
- Node: v24.13.1