Skip to content

ADR-082 Phase 1: session-aware communication bus + dashboard completion fix#5

Merged
chazmaniandinkle merged 2 commits intocogos-dev:mainfrom
chazmaniandinkle:feat/session-registry-adr-082-phase1
Apr 24, 2026
Merged

ADR-082 Phase 1: session-aware communication bus + dashboard completion fix#5
chazmaniandinkle merged 2 commits intocogos-dev:mainfrom
chazmaniandinkle:feat/session-registry-adr-082-phase1

Conversation

@chazmaniandinkle
Copy link
Copy Markdown
Contributor

Summary

Two commits landing ADR-082 Phase 1 plus a regression fix for the kernel-bridged dashboard path.

Commit A — feat(sessions): ADR-082 Phase 1 - session-aware communication bus

  • session_registry.py (new): SessionRegistry + SessionChannel + GlobalSerializer with round-robin / priority / fifo-global policies; voice-pool greedy allocation across 11 Kokoro voices; live output-device resolution per playback (the 2026-04-22 ADR amendment — re-query every call, no caching).
  • http_api.py: POST /v1/sessions/register, POST /v1/sessions/{id}/deregister, GET /v1/sessions, GET /v1/sessions/{id}. /v1/synthesize honors the session's assigned voice when the caller doesn't pin one.
  • server.py + mcp_shim.py: mirrored MCP tools (register_session, deregister_session, list_sessions) so stdio MCP callers get the same surface as HTTP callers.
  • Backward-compat: legacy callers without a session_id auto-route to an implicit default session.

Commit B — fix(dashboard): emit response_complete on kernel-bridged turns

  • Regression: with MOD3_USE_COGOS_AGENT=1, agent_loop.py's success path returned before the local-inference path's send_response_complete, leaving the dashboard's isResponding spinner hung forever.
  • channels.py: new BrowserChannel.broadcast_response_complete(metrics, session_id) — thread-safe companion to broadcast_response_text, routes to the same channel that received the text frames.
  • cogos_agent_bridge.py: on agent_response receipt, emits the complete frame after the text frame.
  • Tests + demo/e2e_dashboard_harness.py updated to assert completion firing on both code paths.

Out of scope

Later ADR-082 phases: input routing (Phase 2), barge-in state machine (Phase 3), native input provider (Phase 4). Phase 1 is output-side only.

Test plan

  • pytest tests/test_session_registry.py -v — 23/23 passed
  • pytest tests/test_session_registry.py tests/test_browser_channel_routing.py tests/test_cogos_agent_bridge.py -v — 44/44 passed
  • Full suite (pytest) — 126/126 passed
  • ruff check + ruff format --check — clean
  • Manual: register two concurrent sessions, confirm they receive distinct voices and round-robin serialization keeps them from colliding
  • Manual: set `MOD3_USE_COGOS_AGENT=1`, open dashboard, send a message, confirm the spinner clears after the response

Introduces SessionRegistry + GlobalSerializer + live output-device
resolution so multiple concurrent agents/users can share one Mod3
instance without colliding on voice, queue, or speaker.

- session_registry.py: SessionChannel, voice-pool greedy allocation,
  per-session queues, round-robin/priority/fifo-global policies, live
  device re-query per playback (ADR-082 2026-04-22 amendment - no
  caching, macOS CoreAudio default tracked live).
- http_api.py: POST /v1/sessions/register, POST /v1/sessions/{id}/deregister,
  GET /v1/sessions, GET /v1/sessions/{id}. Synthesize honors the
  session's assigned voice when unspecified.
- server.py + mcp_shim.py: mirrored MCP tools (register_session,
  deregister_session, list_sessions) so stdio MCP callers get the
  same surface.
- Backward-compat: legacy callers without a session_id route to an
  implicit "default" session.

Out of scope (later ADR phases): input routing, barge-in state
machine, native input provider.
Regression: with MOD3_USE_COGOS_AGENT=1, agent_loop's success path
returns before the local-inference path's send_response_complete,
leaving the dashboard's isResponding spinner hung forever.

- channels.py: BrowserChannel.broadcast_response_complete(metrics,
  session_id) - thread-safe companion to broadcast_response_text,
  routes to the same channel that received the text frames.
- cogos_agent_bridge.py: on agent_response receipt, emit the
  complete frame after the text frame.
- demo/e2e_dashboard_harness.py + tests: updated to assert the
  completion frame fires on both code paths.
chazmaniandinkle added a commit that referenced this pull request Apr 24, 2026
…examples

docs(mod3): scrub participant_id examples (PR #5 ancillary)
@chazmaniandinkle chazmaniandinkle merged commit cff22f3 into cogos-dev:main Apr 24, 2026
7 checks passed
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