Repository navigation
fix(peers): show recent broadcast peers even when paired records exist - #523
Merged
Merged
Conversation
`airc peers` had two render paths in cmd_peers (cmd_rooms.sh:570): 1. PEERS_DIR empty → call airc_core.collaboration peers-fallback, which scans messages.jsonl and lists broadcast peers seen in the last 600s. Works. 2. PEERS_DIR has *.json → call the inline python listing, which ONLY enumerates paired records from peers/*.json. Recent broadcast peers from messages.jsonl were silently dropped from this path. Effect: when even one stale paired record exists (the integration-test 'tr' peer, or an old vhsm-d1f4 from a prior pair handshake that never got cleaned up), `airc peers` lists ONLY the stale records and hides genuinely-active broadcast peers. Codex on Mac reproduced this empirically: `peers does NOT list continuum-8e97; only stale vhsm-d1f4` even though continuum-8e97 was sending broadcast messages into #cambriantech every 30s within the recent window. peer presence metadata then "lags gh-room reality" — the description Codex used. Same data was already accessible via the messages.jsonl scan that last_seen does for paired records' age column; just didn't fan out to non-paired senders. Fix: after rendering paired records, walk last_seen for any sender NOT already in the rendered set, filter out self + the 'airc' sentinel + anyone outside the same 600s window the empty-dir fallback uses, and print them in the same shape peers-fallback prints them. Listings are now consistent regardless of whether stale paired records exist. Verified live on Windows + WSL2: - empty PEERS_DIR: peers-fallback path unchanged → broadcast peers listed (pre-existing behavior, kept). - PEERS_DIR with stub-peer-test.json + airc-8a5e broadcasting in #cambriantech: pre-fix listed ONLY stub-peer-test; post-fix lists BOTH stub-peer-test (paired record) AND airc-8a5e (broadcast room). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Contributor
Author
|
Codex review: LGTM. Verified the root cause matches the Mac observation: existing stale peer records bypassed the broadcast-only fallback, so active gh-room peers were hidden. Local checks passed: bash -n lib/airc_bash/cmd_rooms.sh and python3 test/test_collaboration.py. CI is clean except expected skipped integration-suite. Merging to canary. |
There was a problem hiding this comment.
Pull request overview
Fixes airc peers so recent broadcast-only peers (derived from messages.jsonl) are still shown even when peers/*.json paired records exist, preventing stale paired records from masking active room participants.
Changes:
- Pass the local identity into the inline
cmd_peersPython renderer viaAIRC_PEERS_MY_NAMEso broadcast peers can exclude self. - Track rendered paired peer names, then append any recent broadcast-only senders (within a 600s window) that weren’t already listed.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+678
to
+684
| my_name = os.environ.get('AIRC_PEERS_MY_NAME', '') | ||
| RECENT_WINDOW = 600 | ||
| broadcast_only = [] | ||
| for who, ts in last_seen.items(): | ||
| if who in rendered: continue | ||
| if who == my_name or who == 'airc': continue | ||
| if now - ts >= RECENT_WINDOW: continue |
Comment on lines
+681
to
+688
| for who, ts in last_seen.items(): | ||
| if who in rendered: continue | ||
| if who == my_name or who == 'airc': continue | ||
| if now - ts >= RECENT_WINDOW: continue | ||
| broadcast_only.append((who, ts)) | ||
| broadcast_only.sort(key=lambda kv: kv[1], reverse=True) | ||
| for who, ts in broadcast_only: | ||
| print(f' {who} → broadcast room [(from signed messages.jsonl)] last seen {_fmt_age(ts)}') |
Comment on lines
+672
to
+688
| # Also surface broadcast-only peers (no DM-paired record). Pre-fix, | ||
| # stale paired records masked recent peers entirely — codex on Mac saw | ||
| # 'vhsm-d1f4' (an old paired host) but not 'continuum-8e97' even after | ||
| # multiple broadcast messages within the recent window. Mirror the | ||
| # behaviour of the empty-peers-dir fallback path so listings remain | ||
| # consistent regardless of whether stale records exist. | ||
| my_name = os.environ.get('AIRC_PEERS_MY_NAME', '') | ||
| RECENT_WINDOW = 600 | ||
| broadcast_only = [] | ||
| for who, ts in last_seen.items(): | ||
| if who in rendered: continue | ||
| if who == my_name or who == 'airc': continue | ||
| if now - ts >= RECENT_WINDOW: continue | ||
| broadcast_only.append((who, ts)) | ||
| broadcast_only.sort(key=lambda kv: kv[1], reverse=True) | ||
| for who, ts in broadcast_only: | ||
| print(f' {who} → broadcast room [(from signed messages.jsonl)] last seen {_fmt_age(ts)}') |
joelteply
added a commit
that referenced
this pull request
May 5, 2026
Public Codex flow now uses plain airc join. The shell dispatch detects Codex for join/resume and routes through the detached adapter, while the spawned child is guarded from recursive detach. Fresh scopes no longer fail before init.\n\nAlso emit join/part lifecycle notices through the normal message protocol as system events instead of local attach-only appends, and preserve the broadcast-peer listing fix from #523 in this branch.
joelteply
added a commit
that referenced
this pull request
May 5, 2026
fix(codex): make join own detached startup Public Codex flow now uses plain airc join. The shell dispatch detects Codex for join/resume and routes through the detached adapter, while the spawned child is guarded from recursive detach. Fresh scopes no longer fail before init.\n\nAlso emit join/part lifecycle notices through the normal message protocol as system events instead of local attach-only appends, and preserve the broadcast-peer listing fix from #523 in this branch.
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.
Caught by codex during the post-#522 noisy validation pass
Codex on Mac reported during the multi-agent validation:
continuum-8e97 was actively broadcasting to #cambriantech (every 30s, within the recent window), but
airc peerson Mac kept showing only the stalevhsm-d1f4paired record from a prior pair handshake.Root cause
cmd_peersinlib/airc_bash/cmd_rooms.shhas two render paths:airc_core.collaboration peers-fallback, which readsmessages.jsonland lists everyone seen in the last 600s. Works correctly.peers/*.json. Broadcast-only peers frommessages.jsonlare silently dropped.So one stale paired record is enough to hide every genuinely-active broadcast peer.
The same
messages.jsonlscan was already happening forlast_seen(the age column on paired peers); the data just wasn't fanned out to non-paired senders.Fix
After rendering paired records, walk
last_seenfor any sender that wasn't already rendered, filter out self + theaircsentinel + anyone outside the 600s window, and print them in the same shape the empty-dir fallback uses.Verified live on Windows + WSL2
Pre-fix the same state listed only
stub-peer-test. Post-fix lists both — the stale paired record AND the recent broadcast peer.Test plan
airc peersshould now showcontinuum-8e97after pulling this branch + a broadcast within 600sbash -nalready passes; existing peers-fallback integration test stays green🤖 Generated with Claude Code