feat(companion): add reconnect resilience
This commit is contained in:
@@ -1067,6 +1067,9 @@ Flynn now propagates a run-level abort signal into model/tool execution, so prov
|
||||
|
||||
Register node role/capabilities for the current WebSocket connection.
|
||||
|
||||
Registration is scoped to the connection. If a companion reconnects it must call `node.register` again
|
||||
to restore node identity, capabilities, and access to `node.*` methods.
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
@@ -1840,5 +1843,5 @@ For more implementation details, see:
|
||||
- Protocol types: `src/gateway/protocol.ts`
|
||||
- Handlers: `src/gateway/handlers/`
|
||||
- Gateway server: `src/gateway/server.ts`
|
||||
- Companion runtime client helper: `src/companion/runtimeClient.ts` (node + system + `canvas.*` typed RPC wrappers, optional `autoConnect`)
|
||||
- Companion runtime client helper: `src/companion/runtimeClient.ts` (node + system + `canvas.*` typed RPC wrappers, optional `autoConnect`/`autoReconnect`, connection event subscriptions)
|
||||
- Platform companion wrappers: `src/companion/platformClients.ts`
|
||||
|
||||
@@ -143,6 +143,7 @@ Gateway streaming UX signals:
|
||||
|
||||
- WebSocket `agent.send` emits `run_state` lifecycle events (`start`, `cancel_requested`, `cancelled`, `complete`, `error`) for UI/state rendering.
|
||||
- Routing applies reaction rules with deterministic priority/cooldown (and recursion guard) before intent routing.
|
||||
- Companion nodes re-register `node.*` capabilities after reconnect; runtime clients can auto-reconnect and surface connection events.
|
||||
|
||||
Key files:
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ If you only want the protocol surface, see `docs/api/PROTOCOL.md`.
|
||||
- Backend routing outcomes are auditable via `backend.route` / `backend.success` / `backend.fallback`, which enables offline canary evaluation without changing gateway protocol methods.
|
||||
- Run lifecycle/cancel intent and reaction decisions are emitted to audit logs, and aggregated into `system.metrics` counters (runStates, cancelLatencyMs, reactions) for dashboards.
|
||||
- Reaction matching is deterministic (priority + cooldown + recursion guard) before intent/agent routing.
|
||||
- Companion `node.*` registration is per WebSocket connection; reconnects must re-register capabilities before invoking node RPC methods.
|
||||
|
||||
## Component Map
|
||||
|
||||
|
||||
+19
-1
@@ -6699,10 +6699,28 @@
|
||||
"docs/plans/state.json"
|
||||
],
|
||||
"test_status": "pnpm test:run src/automation/reactions.test.ts src/config/schema.test.ts src/daemon/routing.test.ts passing"
|
||||
},
|
||||
"deeper-surfaces-phase3-companion-reconnect": {
|
||||
"status": "completed",
|
||||
"date": "2026-02-25",
|
||||
"updated": "2026-02-25",
|
||||
"summary": "Hardened companion runtime connectivity with auto-reconnect support, connection event subscriptions, CLI re-registration/heartbeat resilience, and updated protocol/architecture notes plus targeted tests.",
|
||||
"files_modified": [
|
||||
"src/companion/runtimeClient.ts",
|
||||
"src/companion/runtimeClient.test.ts",
|
||||
"src/companion/index.ts",
|
||||
"src/cli/companion.ts",
|
||||
"src/cli/companion.test.ts",
|
||||
"docs/api/PROTOCOL.md",
|
||||
"docs/architecture/AGENT_DIAGRAM.md",
|
||||
"docs/architecture/GATEWAY_SESSIONS_AND_QUEUE.md",
|
||||
"docs/plans/state.json"
|
||||
],
|
||||
"test_status": "pnpm test:run src/companion/runtimeClient.test.ts src/cli/companion.test.ts passing"
|
||||
}
|
||||
},
|
||||
"overall_progress": {
|
||||
"total_test_count": 2018,
|
||||
"total_test_count": 2020,
|
||||
"all_tests_passing": true,
|
||||
"p0_completion": "3/3 (100%)",
|
||||
"p1_completion": "4/4 (100%)",
|
||||
|
||||
Reference in New Issue
Block a user