Skip to content

fix(web): recover from quiet or stalled connections - #370

Open
testikun wants to merge 2 commits into
openpi-dev:mainfrom
testikun:codex/issue-363-web-resilience
Open

fix(web): recover from quiet or stalled connections#370
testikun wants to merge 2 commits into
openpi-dev:mainfrom
testikun:codex/issue-363-web-resilience

Conversation

@testikun

@testikun testikun commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Problem

The OpenPI Web event stream could remain silently half-open, and quiet streams gave the browser no bounded way to verify canonical state. API and prompt-admission waits were also unbounded, leaving users without actionable feedback when a connection stalled. This completes the remaining liveness/recovery slice of #363 and is intentionally separate from the state-regression work in #364.

Value

Web clients now detect silent failures, periodically reconcile quiet connections with the canonical snapshot, and retain prompt drafts with explicit localized feedback when admission times out.

Approach

  • Send bounded SSE comment heartbeats per connected client without advancing the event cursor, and clean up each timer on disconnect or Host shutdown.
  • Use heartbeat cadence for low-frequency, single-flight snapshot reconciliation and a read watchdog for stalled streams.
  • Bound ordinary API and prompt-admission requests with AbortController; preserve failed prompt drafts and surface distinct pending, timeout, error, and reconnecting feedback.
  • Keep all recovery behavior within the existing Host/event/snapshot lifecycle rather than adding another connection-state store.

Validation

Impact

  • User-visible behavior: stalled requests and interrupted live updates now produce explicit English/Chinese feedback; failed prompt admission restores the draft.
  • Model-visible context/tools: none.
  • Runtime/lifecycle: one unref'd heartbeat timer per connected SSE client, bounded by the existing eight-client cap and cleared during disconnect/shutdown.
  • Persisted config/data: none.
  • Compatibility/risk: protocol-compatible SSE comments; snapshot cursors are unchanged by heartbeats. Reconciliation adds one snapshot request per four quiet heartbeats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant