Skip to content

fix(playground): close audio WS on pagehide; add connectivity architecture doc#1

Open
parvbhullar wants to merge 1 commit into
mainfrom
fix/playground-call-lifecycle
Open

fix(playground): close audio WS on pagehide; add connectivity architecture doc#1
parvbhullar wants to merge 1 commit into
mainfrom
fix/playground-call-lifecycle

Conversation

@parvbhullar

Copy link
Copy Markdown
Contributor

Problem

Closing or refreshing a playground tab never ran the async disconnect() (browsers don't await async cleanup during unload), leaving the supervoice call — and its brain session — alive until the protocol keepalive timed out (~40 s). Separately, the playground's connectivity architecture (who owns what, who dials whom, why the dev relay storm happened) lived only in heads.

Solution

  • pagehide listener on SupervoiceWSTransport: synchronously closes /ws/audio on tab close/refresh so the server tears the call down immediately; registered on connect, removed on disconnect().
  • playground/docs/connectivity.md: process ownership map, the five wires and dial directions, end-to-end call flow, the call-lifecycle invariant (kill on disconnect, fresh on connect, protocol keepalive as backstop), history of the relay single-slot reconnect storm and its removal, and the reachability design note for future edge/NAT-hosted brain workers.

Companion PR (supervoice side): parvbhullar/super#38.

Testing

  • tsc --noEmit clean; web unit tests 4/4 pass.
  • Lifecycle cascade verified end-to-end on the supervoice side (close → pipeline cancel → bridge client close → brain session reclaimed), covered by supervoice/tests/test_audio_server_direct_bridge.py in the companion PR.

🤖 Generated with Claude Code

Tab close/refresh never ran the async disconnect() (browsers don't
await async cleanup during unload), leaving the supervoice call - and
its brain session - alive until the protocol keepalive timed out. A
pagehide listener now synchronously closes /ws/audio so the server
tears the call down immediately; it is registered on connect and
removed on disconnect.

Adds playground/docs/connectivity.md: process ownership map, the six
wires and who dials whom, end-to-end call flow, the call-lifecycle
invariant (kill on disconnect, fresh on connect, protocol keepalive
as backstop), the history of the relay single-slot reconnect storm
and its removal, and the reachability design note for future
edge/NAT-hosted brain workers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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