v2.42.0
Dashboard Live Recovery
The dashboard now self-heals across transport stalls, backpressure disconnects, replay gaps, browser backgrounding, server restarts, and authentication changes — without a page refresh.
Added
- Automatic SSE recovery state machine. Generation-guarded callbacks, transactional cursor advancement, capped exponential backoff with jitter, foreground heartbeat watchdog, visibility-change validation, and authentication timeout. One source, one timer, one watchdog maximum enforced at all times.
- Byte-aware EventHub. History bounded by both entry count and encoded bytes. Replay budget stays below the backpressure destruction ceiling. Oversized projected events become explicit resync barriers instead of silent drops or eviction loops.
- Dashboard event projection. Strips cumulative fields unused by dashboard reducers (messages, tool results, args, discarded partials) before buffering — reduces wire pressure, serialization work, and memory retention without changing the RPC contract for other consumers.
- Authoritative resync with snapshot barrier. RPC
dashboard_snapshot_barriermarker establishes a genuine ordering contract between snapshot and live events. Post-barrier envelopes queue and replay in order; stale pre-barrier events are discarded. - Task restoration on hard refresh.
AgentSession.tasksflows through RPC state/snapshot types into the dashboard store, with revision-based race protection preventing stale REST hydration from overwriting newer livetasks_updateevents. Fleet cards fall back to runtime snapshot tasks when no hydrated session exists. - Fresh durable settings. The RPC settings-read path reloads from durable global/project files under the existing serialization lock before creating its snapshot. Read/parse failures are returned loudly.
- Connection status indicator. Accessible connecting/connected/retrying/resyncing/disconnected/auth_failed states with text labels and glyphs. Mounted in the session header so it remains visible without scrolling.
- Structured SSE diagnostics. Metadata-only server logs with correlation IDs covering connection, write, backpressure, close, replay, resync, and oversized-event events. Client diagnostic endpoint is schema-validated and rate-limited.
- Public RPC event union.
RpcEventtype includesdashboard_snapshot_barrieralongsideAgentSessionEvent, with compile-time and runtime coverage.
Fixed
- Reconnect storms caused by oversized event replay: the server previously replayed a >4 MiB frame, destroyed the connection, and the client immediately reconnected to the same fatal range. Now bounded replay, event projection, and oversized-event barriers prevent the loop entirely.
- Half-open streams going undetected: named heartbeat events (invisible to application cursors) plus a foreground watchdog detect stalled streams within a documented bound.
- Stale UI after resync:
hydrateSnapshot()now clears extension-UI requests, status entries, suggested commands, errors, widgets, toasts, titles, and composer prefill before applying restored state. - Failed resync silently dropping live envelopes: failed resyncs now throw without advancing the cursor, remain visibly degraded, and retry automatically with capped backoff.
stop()zombie resync: queued follow-up resyncs are cleared on teardown andbeginResync()is guarded against starting while stopped.- Stale runtime key retry loop:
/api/resyncreturns a fleet-only snapshot for gone runtimes; the client navigates away with a notice instead of retrying forever.
Testing
- Direct
connectEvents()lifecycle suite with controllable fake EventSource, timers, visibility, and auth. - Server integration tests for end-to-end reconnect replay, replay-path backpressure, oversized-event barriers, buffer-gap resync, within-budget replay, stale-cursor recovery, heartbeats, normal lifecycle diagnostics, and backpressure eviction recovery.
- Store tests for resync ordering, byte-bounded queues, failed-resync retry, stale hydration prevention, task revision races, stop-during-resync, and stale-key navigation.
- Hard-refresh integration test with real HTTP/runtime/store round-trip.
- RPC dispatcher test proving barrier-before-response JSONL ordering.
- Published remote Tailscale recovery validation and quantitative low/high throughput measurements on the PR.
Documentation
- Root README, coding-agent README, dashboard README, and the dashboard and RPC docs updated to describe the recovery model, connection states, retry/heartbeat constants, task snapshot field, settings semantics, and diagnostic privacy.