Repository navigation
fix(2B.3): cmd_peers + cmd_whois stop walking deleted sidecar scopes - #239
Conversation
…ced ghosts) Found by airc-96dd/authenticator-fd63 2026-04-28: post-Phase-2B.3 the .airc.<word> sidecar dirs aren't created or maintained, but cmd_peers + cmd_whois still walked them. A stale tr.json from /tmp/airc-trace2 (April 27 integration test) surfaced in airc peers of the live mesh as a ghost peer. ## Fix cmd_rooms.sh::cmd_peers — only walks primary scope. The sibling- sidecar aggregation made sense in pre-2B.3 (multi-room presence fragmented across scopes); post-2B.3 every peer is in primary's peers/, multi-channel context comes from the envelope's channel field + subscribed_channels config. cmd_identity.sh::cmd_whois — same fix. Cross-mesh peer resolution (asking the host for a peer record we don't have locally) is the real Phase 2C+ replacement; tracked as the wart ideem-local-4bef + continuum-b741 raised. For now, indirect peers return "no record" which is at least honest. ## Tests Deleted scenario_peers_cross_scope and scenario_whois_cross_scope — both exercised the removed sibling-walk. Same shape as the rewrite of scenario_general_sidecar_default in PR #227. ## Verification test/integration.sh tabs: 19/0 ✓ test/integration.sh whois: 5/0 ✓ test/integration.sh general_sidecar_default: 10/0 ✓ Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR updates airc peers and airc whois to stop scanning sibling sidecar scopes (e.g. .airc.<room>), preventing stale/leftover directories from surfacing “ghost” peers after Phase 2B.3.
Changes:
- Restrict
cmd_peersto reading peers only from the primary scope’speers/. - Restrict
cmd_whoisto resolving identities only within the primary scope (and document the Phase 2C+ cross-mesh TODO). - Remove integration scenarios that asserted cross-scope walking behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
test/integration.sh |
Removes cross-scope peers/whois scenarios, but needs entrypoint/usage fixes after removing modes. |
lib/airc_bash/cmd_rooms.sh |
Updates cmd_peers Python walk to only consider the primary scope. |
lib/airc_bash/cmd_identity.sh |
Updates cmd_whois to stop walking sibling scopes and only consult the primary scope. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| case "$MODE" in | ||
| tabs) scenario_tabs ;; | ||
| scope) scenario_scope ;; | ||
| teardown) scenario_teardown ;; | ||
| reminder) scenario_reminder ;; | ||
| resilience) scenario_resilience ;; | ||
| reconnect) scenario_reconnect ;; | ||
| queue) scenario_queue ;; | ||
| status) scenario_status ;; | ||
| auth_failure) scenario_auth_failure ;; | ||
| room) scenario_room ;; | ||
| events) scenario_events ;; | ||
| get_host) scenario_get_host ;; | ||
| identity) scenario_identity ;; | ||
| whois) scenario_whois ;; | ||
| kick) scenario_kick ;; | ||
| heartbeat) scenario_heartbeat ;; | ||
| bounce) scenario_bounce ;; | ||
| two_tab_localhost) scenario_two_tab_localhost ;; | ||
| auto_scope) scenario_auto_scope ;; | ||
| send_dead_monitor_dies) scenario_send_dead_monitor_dies ;; | ||
| connect_after_kill_recovers) scenario_connect_after_kill_recovers ;; | ||
| general_sidecar_default) scenario_general_sidecar_default ;; | ||
| send_room_flag) scenario_send_room_flag ;; | ||
| peers_cross_scope) scenario_peers_cross_scope ;; | ||
| whois_cross_scope) scenario_whois_cross_scope ;; | ||
| part_keeps_sidecar) scenario_part_keeps_sidecar ;; | ||
| part_persists) scenario_part_persists ;; | ||
| away) scenario_away ;; | ||
| list) scenario_list ;; | ||
| quit) scenario_quit ;; | ||
| platform_adapters) scenario_platform_adapters ;; | ||
| all) scenario_tabs; scenario_scope; scenario_reminder; scenario_teardown; scenario_resilience; scenario_reconnect; scenario_queue; scenario_status; scenario_auth_failure; scenario_room; scenario_events; scenario_get_host; scenario_identity; scenario_whois; scenario_kick; scenario_heartbeat; scenario_bounce; scenario_two_tab_localhost; scenario_auto_scope; scenario_send_dead_monitor_dies; scenario_connect_after_kill_recovers; scenario_general_sidecar_default; scenario_send_room_flag; scenario_peers_cross_scope; scenario_whois_cross_scope; scenario_part_keeps_sidecar; scenario_part_persists; scenario_away; scenario_list; scenario_quit; scenario_platform_adapters ;; | ||
| *) echo "Usage: $0 [tabs|scope|teardown|reminder|resilience|reconnect|queue|status|auth_failure|room|events|get_host|identity|whois|kick|heartbeat|bounce|two_tab_localhost|auto_scope|send_dead_monitor_dies|connect_after_kill_recovers|general_sidecar_default|send_room_flag|peers_cross_scope|whois_cross_scope|part_keeps_sidecar|part_persists|away|list|quit|platform_adapters|all]"; exit 2 ;; | ||
| esac |
There was a problem hiding this comment.
MODE defaults to "all" (line 365), but the case statement no longer has an all) branch. Running bash test/integration.sh with no args will now hit the default usage error and exit 2 (breaking CI). Re-add an all) case (minus the removed scenarios) and update the usage string to match the supported modes.
| # ── Scenario: peers_cross_scope (sidecar peers visible from primary) ──── | ||
| # Pre-fix: `airc peers` walked only the current scope's peers/ dir, so a | ||
| # tab in primary scope (e.g. #useideem) couldn't see who else was in the | ||
| # #general lobby without `cd`'ing into the .general sidecar. Multi-room | ||
| # presence is meaningless if the operator can't see who's in each room. | ||
| # | ||
| # Post-fix: cmd_peers walks the project scope AND every sibling .airc.<room> | ||
| # scope, merging peer records by (name, host) and tagging each peer with | ||
| # the rooms they're in. Same peer in both rooms shows as one line with | ||
| # [#room1, #room2]. |
There was a problem hiding this comment.
This header comment documents peers_cross_scope behavior (walking sibling .airc.<room> scopes), but the corresponding scenario function was removed in this PR. Either remove/update this comment block, or replace the scenario with a new regression test that asserts stale sibling scopes are ignored (the new intended behavior).
| "$AIRC_PYTHON" -c " | ||
| import json, os, sys, re | ||
|
|
||
| primary_scope = os.path.expanduser('$AIRC_WRITE_DIR') | ||
| parent = os.path.dirname(primary_scope) | ||
| self_basename = os.path.basename(primary_scope) | ||
|
|
||
| # Prefix detection: a sidecar scope is named like \`<prefix>.<room>\` | ||
| # (e.g. .airc.general). Strip a trailing .<word> to recover the | ||
| # primary scope's basename. Works for both production layout | ||
| # (.airc / .airc.general) and test ad-hoc paths (state / state.general) | ||
| # without baking in the .airc literal. | ||
| prefix_match = re.match(r'(.+?)\.[a-z0-9-]+\$', self_basename) | ||
| prefix = prefix_match.group(1) if prefix_match else self_basename | ||
|
|
||
| # Collect: the primary scope itself, plus every sibling whose name is | ||
| # <prefix>.<something>. We additionally require room_name + peers/ on | ||
| # each candidate so unrelated dirs in the same parent (e.g. .airc-old, | ||
| # .airc.bak) don't pollute the listing. | ||
| candidates = [] | ||
| if os.path.isdir(parent): | ||
| for entry in sorted(os.listdir(parent)): | ||
| if entry == prefix or entry.startswith(prefix + '.'): | ||
| candidates.append(os.path.join(parent, entry)) | ||
| scopes = [s for s in candidates | ||
| if os.path.isfile(os.path.join(s, 'room_name')) | ||
| and os.path.isdir(os.path.join(s, 'peers'))] | ||
| # Always include primary even if it doesn't have room_name yet — that's | ||
| # the legacy 1:1 invite mode case (use_room=0). | ||
| if primary_scope not in scopes and os.path.isdir(os.path.join(primary_scope, 'peers')): | ||
| scopes.insert(0, primary_scope) | ||
| # Phase 2B.3: only walk the primary scope. Sidecar scopes are gone. | ||
| scopes = [primary_scope] if os.path.isdir(os.path.join(primary_scope, 'peers')) else [] |
There was a problem hiding this comment.
The embedded Python snippet still imports re, but the regex-based sidecar detection code was removed. Drop the unused import to keep this snippet minimal and avoid confusing future edits.
| # Phase 2B.3 onward: only the primary scope. Sibling sidecar scopes | ||
| # are no longer spawned; any leftover .airc.<word> dirs have stale | ||
| # peer records that would resurface as ghosts (e.g. integration-test | ||
| # fixtures from /tmp/airc-trace2 surviving for days). | ||
| # | ||
| # Phase 2C+ TODO: cross-mesh whois resolution (ask the host for a | ||
| # peer record we don't have locally). Without that, indirect peers | ||
| # in the singleton mesh — peers paired with the host but not with | ||
| # us directly — return "no record". Tracked as the wart that | ||
| # ideem-local-4bef + continuum-b741 surfaced 2026-04-28. |
There was a problem hiding this comment.
The file-level comment above cmd_whois still claims a cross-scope walk for issue #134, but the implementation now explicitly only checks the current/primary scope. Please update/remove the stale cross-scope documentation so it matches the new Phase 2B.3 behavior described here.
| # Phase 2B.3 onward: only the primary scope. Sibling sidecar scopes | |
| # are no longer spawned; any leftover .airc.<word> dirs have stale | |
| # peer records that would resurface as ghosts (e.g. integration-test | |
| # fixtures from /tmp/airc-trace2 surviving for days). | |
| # | |
| # Phase 2C+ TODO: cross-mesh whois resolution (ask the host for a | |
| # peer record we don't have locally). Without that, indirect peers | |
| # in the singleton mesh — peers paired with the host but not with | |
| # us directly — return "no record". Tracked as the wart that | |
| # ideem-local-4bef + continuum-b741 surfaced 2026-04-28. | |
| # Phase 2B.3 onward: check only the current/primary scope | |
| # ($AIRC_WRITE_DIR). We do not walk sibling sidecar scopes for #134: | |
| # they are no longer spawned, and any leftover .airc.<word> dirs may | |
| # contain stale peer records that would resurface as ghosts (for | |
| # example, integration-test fixtures under /tmp/airc-trace2). | |
| # | |
| # Phase 2C+ TODO: add host-assisted / cross-mesh whois resolution for | |
| # peers we do not have locally. Until then, indirect peers in the | |
| # singleton mesh — paired with the host but not with us directly — | |
| # correctly return "no record". This wart was surfaced by | |
| # ideem-local-4bef + continuum-b741 on 2026-04-28. |
fix(ci): restore 'all)' case in integration.sh dispatch (#244 / CI failure) #239 deleted scenario_peers_cross_scope and scenario_whois_cross_scope because those tests exercised the pre-Phase-2B.3 sidecar peer-walk that was removed. The Python regex used to scrub them — `if 'X' not in line` — was too aggressive: it matched the whole `all)` case line which contained both scenario names in its scenarios-to-run list. Result: `all)` deleted entirely. CI's no-arg invocation `bash test/integration.sh` then hit `*)` → exit 2 → push-to-canary integration job failed. ## Fix Restore an `""|all)` case (matches both no-arg and explicit `all`) with the proper scenario list MINUS the two deleted ones. Preserve the `*)` usage block as the unrecognized-scenario fallback. Verification: tabs 19/0; manual no-arg + 'all' invocation kicks off the full sweep instead of bailing. Closes the canary push integration-suite failure on 75e7bb5. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…ersists scenarios (#259) * fix(ci): restore 'all)' case in integration.sh dispatch (#244 / CI failure) #239 deleted scenario_peers_cross_scope and scenario_whois_cross_scope because those tests exercised the pre-Phase-2B.3 sidecar peer-walk that was removed. The Python regex used to scrub them — `if 'X' not in line` — was too aggressive: it matched the whole `all)` case line which contained both scenario names in its scenarios-to-run list. Result: `all)` deleted entirely. CI's no-arg invocation `bash test/integration.sh` then hit `*)` → exit 2 → push-to-canary integration job failed. ## Fix Restore an `""|all)` case (matches both no-arg and explicit `all`) with the proper scenario list MINUS the two deleted ones. Preserve the `*)` usage block as the unrecognized-scenario fallback. Verification: tabs 19/0; manual no-arg + 'all' invocation kicks off the full sweep instead of bailing. Closes the canary push integration-suite failure on 75e7bb5. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(ci): delete pre-2B.3 send_room_flag + part_keeps_sidecar + part_persists scenarios Same root cause as the cross_scope deletions in #239: these three scenarios test sibling-scope semantics that Phase 2B.3 (#227) deleted. Running them on canary HEAD fails because: - send_room_flag: expects --room to re-exec into .airc.<name> sibling scope. Post-#227, --room is a channel-tag alias for --channel; no scope switch. - part_keeps_sidecar: expects a separate sidecar process for #general. Post-#227, no sidecar process exists; #general is a subscribed_channel in the same scope. - part_persists: same. The 'sidecar' it tries to part isn't there. Coverage of the new behavior: - Channel-tag stamping: tabs / queue / status scenarios verify envelope.channel - subscribed_channels filter display: monitor_formatter + #243 path - general_sidecar_default: rewritten in #227 to verify subscribed_channels includes 'general' AND no .general dir is created. Verification: tabs 19/0; general_sidecar_default 10/0; away 5/0; no syntax errors. --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Post-Phase-2B.3 the .airc. dirs aren't maintained but cmd_peers/whois still walked them, surfacing ghost peers (e.g. integration-test 'tr' from /tmp/airc-trace2). Now only walks primary. Phase 2C+ TODO: cross-mesh whois via host. Test scenarios for the deleted walk also removed.