feat(core): aggregate a mesh-wide known-devices view from gossip - #130
Merged
Merged
Conversation
WireMeshTransport.listKnownDevices() merges every live session's own peer-advert directory into one device-id-keyed map, keeping the newer advert (by snapshot-seconds) whenever a device is already known. This is the prerequisite the P3.8 room-discovery design and the eventual agent register/update/offline retirement both need: a way to read every device this side has ever heard gossip from, with its full advert (addresses and any open-extension field such as presence/status), rather than only the peer directly reachable through one session. Entries are never cleared on disconnect, so a device's last-known advert stays queryable while its session is momentarily down, matching how the legacy agents Map keeps a record after setAgentOffline rather than deleting it outright.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Closed
|
🎉 This PR is included in version 2.22.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This was referenced Sep 16, 2026
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.
Adds WireMeshTransport.listKnownDevices(), merging every live session's own peer-advert directory into one device-id-keyed map (newest advert wins by snapshot-seconds). Entries persist across disconnect rather than being cleared, so a device's last-known advert stays queryable while its session is momentarily down.
This is the aggregation primitive #48's own P3.8 room-discovery investigation and #49's presence work both identified as missing: agent-registry.ts's listAgents still reads only the legacy CRDT-replicated agents Map, and #48's own issue body concluded room-discovery needs the identical prerequisite before it can gossip a room/hosted extension the same way presence/status already does. Building it once here, as its own foundational piece, rather than duplicating an aggregation inside each consumer.
Not wired into agent-registry.ts or room-lifecycle.ts yet -- that's each its own follow-up (per #48's own issue body: neither is a quick removal, each needs its own design pass). This PR is scoped to the transport-level primitive and its own direct tests only.
Refs #48, #49.