github / github/copilot-cli

FLEET: No fleet.* lifecycle events — fleet state must be inferred from subagent.* events

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

Description

## Summary

There are no `fleet.started`, `fleet.complete`, or `fleet.failed` events. Fleet's entire lifecycle must be reconstructed by correlating `subagent.*` events — and `session.background_tasks_changed` fires 100+ times with empty `{}` payload, providing no actionable information.

## Observed Event Flow

A complete fleet run (4 sub-agents, 757 events) produced this lifecycle:

```
user.message
assistant.turn_start
tool.execution_start ← fleet invocation (indistinguishable from any tool call)
tool.execution_complete
subagent.started ← only signal fleet is running
subagent.started
subagent.started
subagent.started
[172× session.background_tasks_changed — all with data: {}]
[tool.execution_start/complete per subagent]
subagent.completed
subagent.completed
assistant.message ← aggregated result
assistant.turn_end
session.idle
```

No `fleet.started`. No `fleet.complete`. No `fleet.failed`.

## Problem 1: Cannot distinguish fleet from other sub-agent dispatch

Fleet and the `task` built-in tool both dispatch sub-agents with identical event signatures. Callers cannot tell which mechanism was used:

```javascript
// Both produce identical subagent.started events:
await session.rpc.fleet.start({ prompt: 'Research X' }); // explicit fleet
await session.sendAndWait({ prompt: 'Research X' }); // model may call task()
```

## Problem 2: session.background_tasks_changed fires 172× with empty payload

```json
{ "type": "session.background_tasks_changed", "data": {} }
```

This event fires on every state change (~14× per sub-agent pair) but carries no information about what changed, how many tasks are running, or which agents are active.

## Requested Addition

```typescript
// New events:
fleet.started { prompt: string; agentCount?: number; toolCallId: string }
fleet.complete { toolCallId: string; agentCount: number; failedCount: number; durationMs: number }
fleet.failed { toolCallId: string; error: string }

// background_tasks_changed improvement:
session.background_tasks_changed { activeTasks: number; agentNames?: string[] }
```

## Environment

- SDK: `@github/copilot-sdk` v0.1.32
- CLI: latest
- Node: v24.13.1

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.