github / github/copilot-cli

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

Abierto
#2,264 0 comentarios 0 reacciones 0 asignados Ver en GitHub
area:agents
Lenguaje dominante
Shell
Estrellas
11.2k
Forks
1.9k
Merge medio
14 h 16 min
PR fusionados (30 d)
6

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.