Repository navigation
fix(join): three resume bugs from a single dogfooding session - #116
Merged
Merged
Conversation
1. **Auto-scope re-enabled as default.** PR #104 gated the git-org-derived default room behind AIRC_AUTO_SCOPE_ROOM=1, citing that two tabs in different cwds would silently land in different rooms. The converse bug was worse: two tabs in the SAME project (useideem/authenticator) both fell back to #general and never converged on #useideem — directly contradicting the /join skill contract. Re-default to auto-scope; opt out via AIRC_NO_AUTO_ROOM=1 or `--room general`. Comment captures the trade-off so the next person reverting this knows the history. 2. **Explicit `--room` no longer silently resumes a stale pairing for a different room.** Pre-fix: `airc join --room foo` after pairing into #bar resumed #bar's host blindly; the flag was ignored. User had to manually `airc teardown --flush` first. Post-fix: when --room is explicit AND saved room_name differs, discard CONFIG/room_name/ room_gist_id and fall through to discovery for the requested room. Identity (ssh_key, peer records) survives. 3. **Stale-auth resume in room mode self-heals instead of dying.** Pre-fix: stale SSH keys (host reinstalled, authorized_keys rotated) on a saved room-mode pairing died with "Resume aborted — re-pair required" and demanded `airc teardown --flush` + paste an invite. Post-fix: when there's a saved room_name and gh is available, wipe the stale pair and re-exec with --room <saved> so discovery either finds a live host or we become the new host. The 1:1 invite path (no saved room) keeps its die-loud behavior — there's nothing to fall through to. Hit all three back-to-back in one session on 2026-04-26 (vhsm-2c84 dead host, then auto-scope siloing into #general instead of #useideem, then explicit --room useideem ignored after a part). The bugs compound: each fix surfaces the next. Tests: three new scenarios (auto_scope, room_overrides_resume, stale_auth_room_selfheal) covering the default-on auto-scope + opt-out, the --room override + identity preservation, and the room-mode self-heal path. 14 new assertions, all green. Existing scenario_resume_stale_auth keeps testing the legacy 1:1-invite die-path (still correct for that case). All changes are in the platform-agnostic decision layer — no new platform-specific code, so WSL/Git-Bash-on-Windows/POSIX share the same logic with no divergence. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Fixes several issues in airc join/airc connect resume + room discovery flow so that room selection is consistent, explicit --room overrides stale saved state, and room-mode resume can self-heal from stale SSH auth instead of forcing a manual flush.
Changes:
- Re-enable default room auto-scoping (with
AIRC_NO_AUTO_ROOM=1/--room generalopt-out) and update the banner text. - When
--roomis explicit and differs from savedroom_name, discard stale saved pairing state and fall through to discovery/host for the requested room. - Add integration scenarios covering auto-scope default,
--roomoverriding resume, and stale-auth room self-heal.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
airc |
Updates join defaults (auto-scope) and improves resume behavior for room overrides and stale-auth recovery. |
test/integration.sh |
Adds new integration scenarios to validate auto-scope, room override behavior, and stale-auth room self-heal. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| room_name="${_inferred%|*}" | ||
| local _source="${_inferred#*|}" | ||
| echo " Auto-scoped: #${room_name} (AIRC_AUTO_SCOPE_ROOM=1, from git ${_source})" | ||
| echo " Auto-scoped: #${room_name} (from git ${_source}; override with --room or AIRC_NO_AUTO_ROOM=1)" |
| # discovery succeeds, just like the non-auth self-heal does. | ||
| rm -f "$CONFIG" "$AIRC_WRITE_DIR/room_name" "$AIRC_WRITE_DIR/room_gist_id" | ||
| echo "" | ||
| exec env ${_preserved_name_a:+AIRC_NAME="$_preserved_name_a"} "$0" connect --room "$_saved_auth_room" |
Comment on lines
+1734
to
+1740
| grep -qE 'Hosting as|Auto-scoped' /tmp/airc-it-auto-h.log 2>/dev/null && break | ||
| done | ||
|
|
||
| grep -qE 'Auto-scoped: #useideem \(from git org' /tmp/airc-it-auto-h.log \ | ||
| && pass "auto-scope banner: 'Auto-scoped: #useideem (from git org)'" \ | ||
| || fail "auto-scope banner MISSING (got: $(head -3 /tmp/airc-it-auto-h.log | tr '\n' '|'))" | ||
|
|
Comment on lines
+1917
to
+1921
| # --room ${rname}. AIRC_NO_DISCOVERY is NOT inherited across the | ||
| # re-exec, but with no real gh probe configured here the discovery | ||
| # path will silently no-op and fall through to host mode — beta | ||
| # becomes the new host of #${rname}. We just need to verify it | ||
| # DIDN'T die and DID land in the room. |
| # this gh-free). | ||
| AIRC_HOME="$home" AIRC_NAME=alpha AIRC_PORT=7563 AIRC_NO_DISCOVERY=1 \ | ||
| "$AIRC" connect --room new-room --no-gist > /tmp/airc-it-ror.log 2>&1 & | ||
| local pid=$! |
This was referenced Apr 26, 2026
Closed
joelteply
added a commit
that referenced
this pull request
Apr 26, 2026
When a joiner's saved room_gist_id refers to a gist that's been deleted (host teardown'd), the resume path's gist-probe runs 'gh api gists/<id>' under 'set -euo pipefail' with no '||' guard. A 404 — which is the EXPECTED signal that the host wiped the gist and we should self-heal — trips set -e instead. The script exits 1 silently, BEFORE the 404 classification + self-heal logic below it can run. The very signal the code uses to detect "gist gone" was also the trigger that killed the script before processing it. Symptom: 'airc canary && airc teardown && airc join' from the joiner side, after the host re-hosted, prints 'Resuming as joiner of...' and then exits 1 with no stderr in the user's event stream. Hit 2026-04-26 by vhsm-Claude during PR #116/#117 verification — wasted ~10 minutes thinking it was a Bug-3 self-heal regression before tracing to set-e on the gh api call. Fix: pre-declare '_gist_probe_rc=0' and use '|| _gist_probe_rc=\$?' on the 'gh api' line. set -e no longer trips on 404; the existing classification correctly self-heals into discovery for the saved room_name. Test: scenario_resume_404_gist_no_silent_exit synthesizes joiner state with a known-bogus gist_id and saved room_name, asserts neither silent-exit nor missing self-heal banner. Skipped when gh isn't authed or lacks gist scope (the gh-health gate would short- circuit before the bug fires). Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced Apr 26, 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.
Summary
Three bugs in the
airc joinresume / discovery flow, all hit back-to-back in one session on 2026-04-26 (vhsm-2c84 dead host → auto-scope siloing into #general instead of #useideem → explicit--room useideemignored after a part). They compound: each fix surfaces the next.Auto-scope re-enabled as default. PR fix: airc join defaults to #general, not cwd-derived scope #104 gated git-org-derived rooms behind
AIRC_AUTO_SCOPE_ROOM=1to avoid cross-project siloing, but the converse bug was worse — two tabs in the sameuseideem/authenticatorcheckout both fell back to#generalinstead of converging on#useideem. Re-default to auto-scope; opt out viaAIRC_NO_AUTO_ROOM=1or--room general. Comment captures the trade-off.Explicit
--roomdiscards a stale saved pairing for a different room. Pre-fix:airc join --room fooafter pairing into #bar silently resumed #bar. Post-fix: when--roomis explicit and savedroom_namediffers, wipeCONFIG/room_name/room_gist_idand fall through to discovery. Identity (ssh_key, peer records) survives.Stale-auth resume in room mode self-heals instead of dying. Pre-fix: stale SSH keys (host reinstalled, authorized_keys rotated) died with
Resume aborted — re-pair requiredand demandedteardown --flush+ paste invite. Post-fix: with a savedroom_nameand gh available, wipe stale pair + re-exec with--room <saved>so discovery either finds a live host or we become the new host. The 1:1 invite path (no saved room) keeps die-loud behavior — there's nothing to fall through to.All three changes live in the platform-agnostic decision layer — no new platform-specific code, so WSL / Git-Bash-on-Windows / POSIX share identical logic with zero divergence.
Test plan
bash test/integration.sh auto_scope— 4/4 pass (banner fires, room takes effect,AIRC_NO_AUTO_ROOM=1opt-out works, falls back to#general)bash test/integration.sh room_overrides_resume— 4/4 pass (discard banner, host new-room, no resume of deadhost, ssh_key preserved)bash test/integration.sh stale_auth_room_selfheal— 6/6 pass (self-heal banner fires, doesn't die, lands in saved room, ssh_key survives re-exec)bash test/integration.sh resume_stale_auth— existing scenario for the 1:1-invite die-path still passes (covers the no-saved-room branch we kept unchanged)airc joinfrom a cloned repo lands in the org room, not#general🤖 Generated with Claude Code