Skip to content

canary→main: cross-scope whois, sticky /part, IRC verb coverage - #144

Merged
joelteply merged 5 commits into
mainfrom
canary
Apr 27, 2026
Merged

joelteply merged 5 commits into
mainfrom
canary

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Promotes 4 canary PRs to main. All merged to canary, dogfooded across 3-peer mesh (vhsm-d1f4, continuum-b741, this tab) on this Mac, validated through QA roundtrips today.

Included

QA roundtrip evidence

vhsm-d1f4 verified PR #139 on canary 1e4d2bf:

✓ 'airc away thinking' → 'away: thinking'
✓ whois shows status: thinking after away
✓ 'airc back' → 'back — away cleared.'
✓ status field after back: '(unset; airc away to set)'
✓ 'airc list' tally: '11 open on your gh account:'
✓ Error string: 'Try: airc help' (was 'relay help')

continuum-b741 verified the cross-scope work via 3-peer mesh on the same SHA.

Out of scope (filed)

Test posture

10 IRC-relevant scenarios green: identity 19/19, whois 5/5, whois_cross_scope 6/6, kick 12/12, away 5/5, list 4/4, quit 9/9, part_persists 8/8, part_keeps_sidecar 6/6, general_sidecar_default 12/12. 86 assertions pass, 0 fail. Pre-existing 2 teardown-thoroughness failures (port held / outage simulation) remain, deferred per session note.

Risk

Low. Three of four PRs are additive (new commands / new persistence path). The fourth (#135) is a refactor of an existing code path (whois) with new test coverage and unchanged single-scope behavior. Worst-case rollback: revert the merge commit, no data migration needed (parted_rooms is opt-in via /part).

Pre-fix: cmd_whois only consulted the primary scope's host /
local-peer-file / cross-peer-via-host SSH lookups. A peer in the
#general sidecar but not the primary project room returned "no
record" — even after airc peers (post-#124) already showed them
across rooms. JOIN events in the sidecar emitted names the IRC-style
mental model said should be reachable, but whois 404'd.

Post-fix: cmd_whois walks sibling scopes (.airc + .airc.<room>) using
the same prefix-detection pattern cmd_peers uses. Each scope tries
its own host / local-peer-file / cross-peer-via-host lookups; first
hit wins. Per-scope logic factored into _whois_in_scope so primary
and siblings share one code path.

The cross-peer-via-host SSH path uses the SCOPE's identity/ssh_key
(not the primary scope's), so a sidecar joiner can authenticate
to its sidecar host even when the primary scope is paired with a
different host on different keys.

Test (scenario_whois_cross_scope) covers:
  - sidecar local peer found from primary scope (the vhsm bug)
  - sidecar HOST resolved from primary scope
  - primary host still resolves (no regression)
  - unknown peer still 404s after exhausting all scopes
  - symmetric: sidecar→primary lookup also works

No wire-format change; backward compatible with single-scope users.
Pre-fix: airc part #general left the lobby for the session, but the
next airc join auto-respawned the sidecar — your /part was useless.
The substrate replayed the same noise after every reboot or teardown,
which is exactly the case AI agents can't drift past on their own.

Post-fix: cmd_part records the parted room into the PRIMARY scope's
parted_rooms list (single source of truth, even when /part runs from
a sidecar scope — _primary_scope_for resolves the parent). On bootstrap,
spawn_general_sidecar_if_wanted reads parted_rooms and skips spawn for
any room in it, with a "previously parted" notice so the skip isn't
silent.

New explicit re-opt-in: airc join --general clears "general" from
parted_rooms and forces sidecar=1 (overrides AIRC_GENERAL_SIDECAR /
AIRC_NO_GENERAL session env). Symmetric inverse of --no-general.

Override knobs (--no-general, AIRC_NO_GENERAL=1, AIRC_GENERAL_SIDECAR=1
recursion guard) are session-only and DO NOT touch parted_rooms — only
explicit /part persists. This preserves test-harness ergonomics
(AIRC_NO_GENERAL=1 in CI doesn't accidentally write parted state).

Future-ready for issue #137: parted_rooms is a list, not a single bool,
so per-repo / per-org sidecars can use the same mechanism without
schema migration.

Test scenario_part_persists exercises the full cycle:
  Phase 1: primary + sidecar both up, parted_rooms empty
  Phase 2: /part writes "general" to primary parted_rooms
  Phase 3: bootstrap honors parted_rooms (sidecar does NOT respawn)
  Phase 4: --general clears parted_rooms (round-trip works)

Adjacent: part_keeps_sidecar (6/6) + general_sidecar_default (12/12)
no regressions.
…QA) (#139)

* feat(irc): airc away/back + complete IRC verb coverage

Adheres to README's IRC table — every IRC verb that maps to airc now
has a direct CLI form, not just a verbose composite. Caught vhsm
QA'ing the table and getting "Unknown command: away" because the
shortcut didn't exist; the pre-rename "relay help" stale string also
surfaced.

Changes:
- New `airc away [msg]` (alias `airc back`): IRC /away analog. With
  message → sets identity.status. Without args → clears it. Both forms
  end up in the same identity.status field exchanged at handshake, so
  whois reflects the change without a wire round-trip. Pre-fix: only
  `airc identity set --status "..."` worked, which is verbose and
  doesn't match the IRC mental model.
- New scenario_away (5 assertions): set/clear, multi-word, whois
  reflects, back alias.
- New scenario_list (4 assertions): list / rooms / ls aliases all
  dispatch to cmd_rooms cleanly; output shape matches.
- New scenario_quit (9 assertions): quit / disconnect aliases drop
  host-pairing fields but preserve identity (name, ssh_key, pronouns,
  role, bio).
- Fix "Unknown command: $1. Try: relay help" → "airc help". Stale
  string from the pre-rename era; user-facing every time someone fat-
  fingers a subcommand. Caught by vhsm in QA.
- README table: /away row now shows `airc away "<msg>"` as the
  primary form (the verbose `identity set --status` is still
  available, but no longer how users learn the feature).

Joel's directive: "adhere to IRC otherwise" — this PR closes the
last gap in that contract for the README's IRC table.

* fix(identity): hint airc away in unset-status output (continuum QA)

continuum-b741 found in QA that whois shows the status field even
when unset, with no obvious command to set it — "feels half-baked,
would feel cleaner if the field had '(use airc away to set)' hint."

Replace the bare "(unset)" fallback for status with
"(unset; airc away <msg> to set)" so users discover the new IRC-
aligned command from the showing surface itself.

Originally tried to use an em-dash + escaped quotes in the hint,
but apostrophes inside the python3 -c '...' heredoc broke bash
quoting at line 3271. Lesson: heredoc-embedded comments cannot
contain apostrophes. Switched comment to "do not" + simplified
the hint text to avoid escape sequences.
…143)

chore(readme,skills): bring docs to spec for canary→main

README updates:
- Integration suite count: 88 assertions / 11 scenarios → ~245 / 32
- Core Commands: add `airc msg --room <name>` (sibling-room send) and
  `airc away` / `airc back` (IRC /away alias)
- Default Rooms: document /part stickiness (parted_rooms persists in
  primary scope's config) and `airc join --general` re-opt-in flag
- Skills table: add /whois, /away, /kick rows so the table covers
  every IRC verb in the IRC↔airc table (no more "documented in table,
  missing from skills")

New skills (install.sh auto-symlinks; no installer changes):
- skills/away/SKILL.md — IRC /away alias for status set/clear
- skills/whois/SKILL.md — identity lookup + cross-scope walk note
- skills/kick/SKILL.md — host-only peer eviction with SSH key drop

Why now: vhsm and continuum drove the IRC-table audit through QA.
README and skills were the last surfaces still claiming the
pre-#122/#138/#139 shape. Closing the gap before promoting canary
to main so the merged tree presents a coherent story.
Copilot AI review requested due to automatic review settings April 27, 2026 16:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Promotes several canary-proven IRC-surface improvements to main, focusing on making identity/room behavior consistent across primary + sidecar scopes and aligning the CLI with IRC verbs (/whois, /away, /kick, /list, /quit).

Changes:

  • Add cross-scope whois resolution (primary scope + sibling sidecar scopes) and new whois_cross_scope integration coverage.
  • Persist /part decisions across sessions via parted_rooms, plus airc join --general re-opt-in behavior and integration coverage.
  • Add airc away / airc back command support, refresh help/error strings, and update README + skills documentation accordingly.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
airc Implements cross-scope whois, sticky /part via parted_rooms, adds away/back, and updates CLI help/error strings.
test/integration.sh Adds scenarios covering whois cross-scope, part persistence, away/back, list aliases, and quit semantics.
README.md Updates IRC verb mapping, documents sticky /part, and refreshes command/test/skills tables.
skills/whois/SKILL.md New skill doc for /whois, including cross-scope behavior and resolution order.
skills/away/SKILL.md New skill doc for /away + /back behavior and expected outputs.
skills/kick/SKILL.md New skill doc for host-only /kick semantics and limitations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread skills/whois/SKILL.md
bio: wallet/merchant bridging cert flow on vhsm-canary
status: in a meeting til 3pm
integrations: (none)
host: [email protected]

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The /whois example hardcodes a specific 100.91.x.y Tailscale/CGNAT IP. This repo explicitly avoids committing real-looking tailnet IPs because it can be low-grade PII and is often wrong for other users (see test/integration.sh:86-88). Replace it with a non-identifying placeholder (e.g., 100.64.0.1 or 203.0.113.10) or use a generic token like .

Suggested change
host: joelteply@100.91.51.87
host: joelteply@<tailscale-ip>

Copilot uses AI. Check for mistakes.
Comment thread airc
Comment on lines +1786 to +1791
# know AIRC_WRITE_DIR (set by ensure_init below) is meaningful — but
# we have to wait for ensure_init to run, since --general can be
# called before any prior init. The cleanup happens via a deferred
# check in spawn_general_sidecar_if_wanted: since _clear_parted_room
# is idempotent, we can call it eagerly here when config exists, and
# also force general_sidecar=1 to override any session env opt-out.

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment says AIRC_WRITE_DIR is “set by ensure_init below”, but cmd_connect never calls ensure_init (it’s allowed to run before initialization). AIRC_WRITE_DIR is set at script init via detect_scope, so this explanation is misleading; update the wording to reflect the actual control flow.

Suggested change
# know AIRC_WRITE_DIR (set by ensure_init below) is meaningful — but
# we have to wait for ensure_init to run, since --general can be
# called before any prior init. The cleanup happens via a deferred
# check in spawn_general_sidecar_if_wanted: since _clear_parted_room
# is idempotent, we can call it eagerly here when config exists, and
# also force general_sidecar=1 to override any session env opt-out.
# can honor the final flag state. AIRC_WRITE_DIR is already set at
# startup by scope detection; what may not exist yet is initialized
# config state, since --general can be called before any prior init.
# The cleanup therefore remains conditional here and is also covered
# by the deferred check in spawn_general_sidecar_if_wanted: since
# _clear_parted_room is idempotent, we can call it eagerly when
# config exists, and also force general_sidecar=1 to override any
# session env opt-out.

Copilot uses AI. Check for mistakes.
#144) (#150)

fix(scope): _primary_scope_for must not strip when basename is leading-dot-only

Bug found by vhsm-d1f4 in PR #144 e2e (2026-04-27): \`airc join --general\`
silently failed to clear parted_rooms after a /part. Trace:

1. cmd_part on .airc.general writes parted_rooms=['general'] to primary's
   config.json (works — _primary_scope_for(.airc.general) → .airc, correct).
2. airc join --general triggers _force_general_sidecar=1 in cmd_connect.
3. cmd_connect calls _primary_scope_for "$AIRC_WRITE_DIR" where
   AIRC_WRITE_DIR is the PRIMARY scope ('.airc').
4. The regex 's/\.[a-z0-9-]+\$//' over-strips '.airc' (the entire basename
   IS one dot-segment) → prefix=''.
5. The 'is this a sidecar?' check (prefix != self_base) was true (since
   '' != '.airc'), so _primary_scope_for returned '<parent>/' (bogus).
6. _clear_parted_room got that bogus path, the python wrapper caught
   FileNotFoundError, sys.exit(0), silent no-op.

Net: --general printed the same "previously parted" message every time,
parted_rooms never cleared, sidecar never resubscribed. README #143 already
documented "airc join --general" as THE recovery path; would have shipped
broken-as-documented to main without the e2e catch.

## Fix

Add empty-prefix guard: if the regex eats the entire basename, the basename
was a leading-dot-only name (canonical primary scope), not a sidecar.
Return self instead of the bogus parent/empty-string concat.

## Why integration tests missed it

scenario_part_persists used fixture path '/tmp/airc-it-pp/state' /
'state.general'. Basename 'state' has no dots → regex no-ops → prefix=='state'
== self_base → primary case. The leading-dot code path was never exercised.
Real deployments use $repo/.airc — which IS leading-dot.

## Test fix

Renamed scenario_part_persists fixture from 'state' → '.airc' so the
basename matches production layout. Verified:
- pre-fix + .airc fixture: phase 4 fails (--general didn't respawn / parted_rooms didn't clear)
- post-fix + .airc fixture: 8/8 phases green

The class of bug ("test fixture diverges from real layout in a way that
hides a code path") is worth grepping for elsewhere — paths starting with
'.' are common enough that any regex over basename should account for them.
@joelteply
joelteply merged commit 69178d1 into main Apr 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants