Status:
accepted · ADR-34 · Filed 2026-04-30Title
Agent DM channel is keyed onagent_id, not session_id
Decision
Replace the per-session Redis pubsub channelprism:events:session:{session_id} with a per-agent channel prism:events:agent:{agent_id}. WS subscribers (mcp-node stream) subscribe to their agent_id channel at connect time; backend’s signal-publish targets the resolved agent_id and publishes to that stable channel. Each new agent_session (post-restart, post-machine-move) subscribes to the same channel.
Rationale
The session-keyed channel design tied delivery to a process-lifetime ID. When an agent wraps and restarts:- Pending signals queued for the old session_id had no live subscriber; they only delivered via piggyback (HTTP poll), which bypasses the WS stream subscriber where
signalCache.record()writes the per-identity ring file. - Result: bell+count permanently dark even when signals were arriving — they came in via the wrong code path.
- Workarounds (replay across sessions, transfer pending across IDs) all add complexity without addressing the root issue: the routing target was the wrong abstraction.
session_id (now agent_session_id) remains useful for heartbeat tracking, master election, audit (which process emitted/received this signal), and lifecycle (which process to terminate when wrap is called). It is not in any routing channel name.
Alternatives Considered
- Keep session-keyed channels, add a server-side replay-on-reconnect mechanism. Trades one architecture seam (process-keyed channel) for another (replay correctness). The agent_id channel is simpler and exercises fewer code paths.
- Multi-channel subscription per agent (session + agent). Considered; rejected because it doubles subscriber counts and requires deduplication on the receive side. Single agent_id channel is the cleaner contract.
- Continue session-keyed and require all consumers to drain via piggyback poll. Status quo for SPEC-054 Phase 3 — observed broken in practice; the bell never lights up. Rejected.
Status
acceptedReferences
- SPEC-056 §Channel naming
- Memory:
project_spec_054_port_miss_project_id

