Repository navigation
feat(rooms): persist /part across reboots (closes #136) - #138
Conversation
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.
There was a problem hiding this comment.
Pull request overview
Adds persistence for /part #general so that leaving the lobby remains effective across reboots/teardowns, and provides an explicit --general re-opt-in path.
Changes:
- Persist sidecar
/partstate in the primary scope config via aparted_roomslist. - Skip auto-spawning the
#generalsidecar whengeneralis listed inparted_rooms, with a user-visible notice. - Add an integration test scenario validating persistence +
--generalround-trip behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
airc |
Adds parted_rooms read/write helpers, persists /part into primary config, honors it during #general sidecar bootstrap, and adds --general re-opt-in behavior. |
test/integration.sh |
Adds scenario_part_persists and wires it into the test runner to validate the new persistence and re-opt-in semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # scope and force the sidecar back on. Done after arg parsing so we | ||
| # 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. |
There was a problem hiding this comment.
The comment for the --general re-opt-in path references waiting for ensure_init to run / AIRC_WRITE_DIR being set by ensure_init, but AIRC_WRITE_DIR is set at script startup and cmd_connect doesn’t call ensure_init in this area. Updating the comment to match the actual control flow would avoid confusion for future maintenance.
| # scope and force the sidecar back on. Done after arg parsing so we | |
| # 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. | |
| # scope and force the sidecar back on. Done after arg parsing so all | |
| # flags are settled before we override any session opt-out. AIRC_WRITE_DIR | |
| # is already available here; if config exists, clear the primary scope's | |
| # parted state for #general immediately. Since _clear_parted_room is | |
| # idempotent, this eager cleanup is safe, and forcing general_sidecar=1 | |
| # ensures the later sidecar logic resubscribes even after a prior /part. |
| parent=$(dirname "$scope") | ||
| self_base=$(basename "$scope") | ||
| prefix=$(printf '%s' "$self_base" | sed -E 's/\.[a-z0-9-]+$//') | ||
| if [ "$prefix" = "$self_base" ]; then | ||
| # Already primary — no trailing .<word> suffix to strip. |
There was a problem hiding this comment.
_primary_scope_for strips any trailing "." from the scope basename. If someone sets AIRC_HOME to a primary scope whose basename itself contains a dot (e.g. /tmp/airc.dev), this will incorrectly treat it as a sidecar and compute the wrong “primary” path, causing parted_rooms writes/clears to hit the wrong config.json. Consider only stripping known sidecar suffixes (currently ".general"), or verify the stripped directory is actually the primary (e.g. has config.json) before rewriting the path.
| # Wait a couple seconds for any stray sidecar spawn before asserting. | ||
| sleep 2 | ||
| [ ! -f "${home1}.general/airc.pid" ] \ | ||
| && pass "phase 3: sidecar does NOT auto-respawn (parted_rooms honored)" \ | ||
| || fail "phase 3: sidecar respawned despite /part persistence" |
There was a problem hiding this comment.
In phase 3 the test only sleeps 2s before asserting the sidecar pidfile does not exist. Phase 1 waits up to 8s for the sidecar pidfile to appear, so a slow sidecar start could slip past this check (false pass) or make the test flaky. Prefer waiting the same max window and failing immediately if ${home1}.general/airc.pid appears during it, then assert it’s still absent at the end.
| # Wait a couple seconds for any stray sidecar spawn before asserting. | |
| sleep 2 | |
| [ ! -f "${home1}.general/airc.pid" ] \ | |
| && pass "phase 3: sidecar does NOT auto-respawn (parted_rooms honored)" \ | |
| || fail "phase 3: sidecar respawned despite /part persistence" | |
| # Watch the same max startup window used elsewhere and fail immediately | |
| # if the sidecar pidfile appears at any point. | |
| local sidecar_respawned=0 | |
| for i in 1 2 3 4 5 6 7 8; do | |
| sleep 1 | |
| if [ -f "${home1}.general/airc.pid" ]; then | |
| sidecar_respawned=1 | |
| fail "phase 3: sidecar respawned despite /part persistence" | |
| break | |
| fi | |
| done | |
| if [ "$sidecar_respawned" -eq 0 ]; then | |
| [ ! -f "${home1}.general/airc.pid" ] \ | |
| && pass "phase 3: sidecar does NOT auto-respawn (parted_rooms honored)" \ | |
| || fail "phase 3: sidecar respawned despite /part persistence" | |
| fi |
…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.
Bug
`airc part #general` was session-only. 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 what AI agents can't drift past on their own.
Fix
Override hierarchy (deliberate)
Why session-only opt-outs DON'T touch parted_rooms: test harnesses set `AIRC_NO_GENERAL=1` to suppress sidecar noise during runs — they shouldn't accidentally persist the choice into the user's real config.
Test (`scenario_part_persists`, 8 phases)
Adjacent: `part_keeps_sidecar` (6/6) + `general_sidecar_default` (12/12), no regressions.
Future-ready for #137
`parted_rooms` is a list, not a single bool, so per-repo / per-org sidecars (issue #137) can use the same mechanism without schema migration.