feat: presence-derived parley_list_users (who's live on the bus)#6
Merged
Conversation
…ive message subscribe() started its XREAD loop at '$' and returned without awaiting the first (blocking) read. '$' only resolves to the stream's last id when that read registers server-side, so a post() (XADD) racing in during the startup window got an id below the resolved '$' and was dropped forever — it never reached the subscriber. Surfaced as an intermittent failure of the "identical backendMsgId + cursor via live push and via catch-up" conformance test under CI load (Node 24). Fix: capture a concrete stream tail id via XINFO STREAM, awaited before subscribe() resolves, and read strictly after it. A concrete id has no gap, so a message added during startup is still delivered. Falls back to '0' when the stream doesn't exist yet (no history to skip). Verified: redis conformance 20/20. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a parley_list_users MCP tool that reports who is LIVE on the bus, with an optional glob filter (e.g. "claude-*"). Rather than a mandatory seam method (which several backends can't implement and which would mean different things per backend), liveness is derived ENTIRELY ABOVE THE SEAM: each bridge posts hello/heartbeat/goodbye to a derived, isolated presence stream, and the tool reconstructs the roster from fetchRecent + a TTL window. Result: works identically on every backend, lists an idle instance that hasn't posted, and touches zero seam methods and zero backend plugins — the conformance suite is unchanged. - engine/presence.ts: presenceTopicFor, encode/decode, computeLive (TTL liveness) - transport/presence-loop.ts: hello/heartbeat/goodbye emitter (best-effort) - identity-filter.ts: matchGlob / filterHandles - transport/tools.ts: parley_list_users tool - lifecycle wiring in stdio-bridge (attach/shutdown) + http (app scope) - presence config block (enabled/heartbeat_ms/ttl_ms) - docs: DESIGN §7/§11, README; fix stale §4 "real account lookup" note - gitignore local .project.yml tooling metadata Verified end-to-end on a real SQLite backend: idle agent listed, presence stream isolated from real topics, goodbye + TTL both drop participants. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Adds
parley_list_users— an MCP tool that reports who is live on the bus, with an optional glob filter (e.g.claude-*), for picking a hand-off target.This started as "should list users be a core seam method every backend implements?" The answer was no: the seam is six methods on purpose, several backends have no enumerable user set (Redis/NATS/Discord/Telegram), and a mandatory
listUserswould mean four different things wearing one name — the failure the conformance suite exists to prevent.The better design (Patrick's insight): make presence a message. Each bridge announces
hello/heartbeat/goodbye, and liveness is derived entirely above the seam frompost/fetchRecent+ a TTL window.Result
<channel>events or pollute durable history.Design decisions (locked with the user)
Message-model change.Changes (all in
bridge-core)engine/presence.ts—presenceTopicFor, encode/decode,computeLive(TTL liveness)transport/presence-loop.ts— best-effort hello/heartbeat/goodbye emitteridentity-filter.ts—matchGlob/filterHandlestransport/tools.ts—parley_list_userstool (+ToolDepsgainspresenceTtlMs/now)stdio-bridge(attach/shutdown) +http(app scope)config.ts—presenceblock (enabled/heartbeat_ms/ttl_ms)Testing
goodbyedrops fast; a stale/crashed heartbeat is reclaimed by TTL.Known follow-up
list_usersreads a bounded recent window; retention/pruning is a future optimization (the seam has no delete) — noted, not blocking.🤖 Generated with Claude Code