Skip to content

fix(resume): stale-gist 404 must not silent-exit (closes #118) - #119

Merged
joelteply merged 1 commit into
canaryfrom
fix/resume-404-gist-silent-exit
Apr 26, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/resume-404-gist-silent-exit

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

Closes #118.

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 — the EXPECTED signal that the host wiped the gist and we should self-heal — trips set -e instead. Script exits 1 silently before the 404 classification + self-heal can run. The signal we use to detect "gist gone" was also the trigger that killed the script before processing it.

Hit 2026-04-26 by vhsm-Claude during PR #116/#117 verification: airc canary && airc teardown && airc join from the joiner after the host re-hosted produced Resuming as joiner of... followed by silent exit-1, no stderr.

Fix

Pre-declare _gist_probe_rc=0 + || _gist_probe_rc=\$? on the gh api call. set -e no longer trips on the expected 404; the existing classification (-ne 0 && stderr matches 404|not found) correctly self-heals into fresh discovery for the saved room_name.

Test plan

  • bash test/integration.sh resume_404_gist_no_silent_exit — 2/2 pass (no silent-exit, 404 self-heal banner fires). Skipped without gh+gist-scope.
  • Manual replay: synthesized joiner state with bogus gist_id + saved room_name. Pre-fix: silent exit-1. Post-fix: Saved room gist ... no longer on your gh — room dissolved or rehosted + re-exec into discovery.

Platform

||-rc-capture is POSIX-standard. No platform-specific change.

🤖 Generated with Claude Code

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]>
Copilot AI review requested due to automatic review settings April 26, 2026 17:14
@joelteply
joelteply merged commit 785bd50 into canary Apr 26, 2026
1 check passed
@joelteply
joelteply deleted the fix/resume-404-gist-silent-exit branch April 26, 2026 17:14

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

Fixes airc connect resume behavior in room mode so that an expected GitHub gist 404 (deleted/rotated room gist) does not trigger set -e and silently terminate before self-heal logic can run.

Changes:

  • Guard the gh api gists/<id> probe in the resume path so non-zero (notably 404) is captured instead of aborting under set -euo pipefail.
  • Add an integration scenario that reproduces the stale/deleted room_gist_id resume path and asserts “no silent exit” + 404 classification/self-heal messaging.
  • Wire the new scenario into the integration test runner modes and all.

Reviewed changes

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

File Description
airc Prevents set -e abort on expected gh api 404 by capturing the probe exit code for downstream classification/self-heal.
test/integration.sh Adds resume_404_gist_no_silent_exit scenario and hooks it into the test runner to prevent regressions of the silent-exit resume bug.

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

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