Skip to content

fix: stale-pairing detect + Git-Bash winget + gh scope regex + bootstrap pwsh-relaunch (closes #83 #90 #91) - #92

Merged
joelteply merged 2 commits into
canaryfrom
fix/stale-pairing-and-winget
Apr 25, 2026
Merged

joelteply merged 2 commits into
canaryfrom
fix/stale-pairing-and-winget

Conversation

@joelteply

@joelteply joelteply commented Apr 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Four fixes folded into one PR — all about Windows-on-canary cleanliness Joel + Toby hit while dogfooding the new bootstrap path. All four close existing issues.

#83 — Stale-pairing detect on resume

Joiner-side now caches room_gist_id after pair-via-gist-discovery. On resume, before SSH probe, check if that gist still exists on the user's gh. If gone (host parted, or peer self-healed and replaced it), wipe stale joiner state and re-exec into airc connect (re-resolves via room name OR falls through to host-mode for first-back-in-becomes-host). Bash + ps1 in lockstep.

install.sh Git-Bash / winget support (dogfood)

Joel hit Unknown package manager (uname=MINGW64_NT-10.0-26200) running airc update from Git Bash. Added MINGW*/MSYS*/CYGWIN* → winget detection in detect_pkgmgr, prereq mappings to winget IDs (Git.Git, GitHub.cli, Python.Python.3.12), and install_with_pkgmgr winget case with --silent --accept-{source,package}-agreements.

#90 — doctor --connect gist scope regex

Bash regex used [^\\n]* ("not backslash or n") which is wrong. PS regex anchored on ^\s* which doesn't match modern gh output's - Token scopes: leading dash. Both simplified to case-insensitive (token )?scopes:.*gist anywhere on a line. Verified against actual gh output.

#91 — bootstrap re-launches under pwsh

airc.ps1 requires PS 7+. Default Windows shell is PS 5.1. Bootstrap previously failed at first & airc call. Now detects $PSVersionTable.PSVersion.Major -lt 7 at script start, finds pwsh.exe (or winget-installs it), re-launches itself under pwsh with the same args.

Test plan

  • 133/133 integration tests pass
  • Bash + ps1 syntax checks
  • Verified gh-scope regex against actual gh auth status output on this Mac
  • Stale-pairing logic verified on bash side via local sim
  • Live Windows verify (Toby has AWS Win Server 2022 VM with Claude Code installed, ready to test on his side)

🤖 Generated with Claude Code

… + dogfood-fix)

Two changes folded into one PR since both are about Windows-on-canary
cleanliness Joel hit while dogfooding the new bootstrap path.

## Stale-pairing detection (#83)

Joiner-side now caches `room_gist_id` after pair-via-gist-discovery (it
was always captured in `_resolved_gist_id` but never persisted). On
resume, before SSH probe, check if that gist still exists on the user's
gh. If gone (host parted, or peer self-healed and replaced it), the
room dissolved or got rehosted -- silently re-pairing against the
cached host_target would either land in a different room or produce
silent unreachable cascades.

Fix: gist-freshness check fires BEFORE the SSH probe. If gist is gone:
wipe stale joiner state, re-exec into airc connect (which re-resolves
via room name OR falls through to host-mode for first-back-in-becomes-
host). Identity + peer records persist; only the dead pairing is
cleared.

Same fix in bash + ps1, called from both resume-after-Tailscale-check
and joiner-post-handshake-save points.

## install.sh pkgmgr support for Git Bash on Windows (dogfood)

Joel hit "Unknown package manager (uname=MINGW64_NT-10.0-26200)" when
running `airc update` from Git Bash on the BigMama 5090. Pre-fix,
install.sh's detect_pkgmgr only knew Darwin and Linux; Windows native
shells fell through to "skipping prereq auto-install" — useless on a
fresh machine.

Add MINGW*/MSYS*/CYGWIN* detection -> winget. winget is the standard
Windows package manager (and what install.ps1 uses); reachable from
Git Bash as winget.exe. Maps prereqs to winget IDs:
  git    -> Git.Git
  gh     -> GitHub.cli
  python -> Python.Python.3.12
  ssh    -> (built-in, skip)
  openssl -> (bundled with Git for Windows, skip)

install_with_pkgmgr handles winget per-package with --silent +
--accept-source/package-agreements so it doesn't prompt during the
script.

Also makes pkgname_for return empty for pkgs that come bundled with
other dependencies (openssl via Git, OpenSSH via Windows itself), so
the install loop skips them rather than failing on missing IDs.

133/133 integration tests still pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings April 25, 2026 18:06
Two bugs Toby caught while testing canary on Windows native:

#90: doctor --connect's gist-scope regex required ^\s* anchoring (PS)
or used [^\\n] (bash, which is "not backslash or n", not "any char").
Modern gh outputs "  - Token scopes: 'gist', 'repo', ..." with a
leading dash that fails ^\s* and an obviously-wrong-anyway character
class. Both regexes simplified to just look for "(token )?scopes:.*gist"
anywhere on a line, case-insensitive.

#91: bootstrap-airc.ps1 fails when launched from Windows PS 5.1 (the
default shell) because airc.ps1 requires PS 7+. Bootstrap now detects
PS version at the start; if <7, finds pwsh.exe (or winget-installs
it), then re-launches itself under pwsh with the same args.

133/133 tests still pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@joelteply joelteply changed the title fix: stale-pairing detect on resume + Git-Bash winget pkgmgr (closes #83 + dogfood) fix: stale-pairing detect + Git-Bash winget + gh scope regex + bootstrap pwsh-relaunch (closes #83 #90 #91) Apr 25, 2026

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

This PR addresses Windows- and resume-related friction in airc by (1) adding joiner-side stale-pairing detection for gist-discovered rooms on resume, and (2) extending install.sh to detect Git Bash/MSYS/Cygwin environments and install prerequisites via winget.

Changes:

  • Add resume-time gist freshness checks (bash + PowerShell) and persist room_gist_id after gist-based discovery.
  • Add winget support in install.sh for Windows Git Bash/MSYS/Cygwin.
  • Map common prereqs to winget package IDs and install them non-interactively.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.

File Description
install.sh Detects Windows Git Bash-like environments and installs missing prereqs via winget.
airc Persists discovered gist id and checks gist existence before SSH resume; re-execs into fresh discovery when stale.
airc.ps1 Mirrors the bash stale-pairing check and gist-id persistence for Windows native PowerShell.

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

Comment thread airc
Comment on lines +1311 to +1331
if ! gh api "gists/$_saved_gist_id" >/dev/null 2>&1; then
# Gist gone (host parted, or peer self-healed and replaced it).
# Trigger fresh discovery: clear the stale joiner state and
# re-exec ourselves into airc connect, which will re-resolve
# via the room name (or fall through to host-mode if no room
# gist exists — first-back-in-becomes-new-host).
echo ""
echo " ⚠ Saved room gist ($_saved_gist_id) no longer on your gh — room dissolved or rehosted."
if [ -n "$_saved_room_resume" ]; then
echo " Re-discovering #${_saved_room_resume} via fresh gist lookup..."
else
echo " Re-pairing via fresh discovery..."
fi
# Wipe stale joiner state. Identity + peer records persist.
rm -f "$CONFIG" "$AIRC_WRITE_DIR/room_gist_id"
local _preserved_name; _preserved_name=$(get_name 2>/dev/null || echo "")
if [ -n "$_saved_room_resume" ]; then
exec env ${_preserved_name:+AIRC_NAME="$_preserved_name"} "$0" connect --room "$_saved_room_resume"
else
exec env ${_preserved_name:+AIRC_NAME="$_preserved_name"} "$0" connect
fi

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

The gist-freshness check treats any non-zero exit from gh api as "gist no longer exists" and wipes joiner state. gh api can fail for reasons other than a 404 (logged-out gh, missing gist scope, rate-limit, transient network), which would trigger an incorrect teardown/re-pair loop. Consider checking gh auth status first and/or distinguishing 404 from other failures (e.g., use gh api --include and only self-heal on HTTP 404; otherwise warn and continue with the SSH probe).

Suggested change
if ! gh api "gists/$_saved_gist_id" >/dev/null 2>&1; then
# Gist gone (host parted, or peer self-healed and replaced it).
# Trigger fresh discovery: clear the stale joiner state and
# re-exec ourselves into airc connect, which will re-resolve
# via the room name (or fall through to host-mode if no room
# gist exists — first-back-in-becomes-new-host).
echo ""
echo " ⚠ Saved room gist ($_saved_gist_id) no longer on your gh — room dissolved or rehosted."
if [ -n "$_saved_room_resume" ]; then
echo " Re-discovering #${_saved_room_resume} via fresh gist lookup..."
else
echo " Re-pairing via fresh discovery..."
fi
# Wipe stale joiner state. Identity + peer records persist.
rm -f "$CONFIG" "$AIRC_WRITE_DIR/room_gist_id"
local _preserved_name; _preserved_name=$(get_name 2>/dev/null || echo "")
if [ -n "$_saved_room_resume" ]; then
exec env ${_preserved_name:+AIRC_NAME="$_preserved_name"} "$0" connect --room "$_saved_room_resume"
else
exec env ${_preserved_name:+AIRC_NAME="$_preserved_name"} "$0" connect
fi
local _gh_gist_check_output=""
local _gh_gist_http_status=""
if ! _gh_gist_check_output=$(gh api --include "gists/$_saved_gist_id" 2>&1); then
_gh_gist_http_status=$(printf '%s\n' "$_gh_gist_check_output" | awk '$1 ~ /^HTTP\// {print $2; exit}')
if [ "$_gh_gist_http_status" = "404" ]; then
# Gist gone (host parted, or peer self-healed and replaced it).
# Trigger fresh discovery: clear the stale joiner state and
# re-exec ourselves into airc connect, which will re-resolve
# via the room name (or fall through to host-mode if no room
# gist exists — first-back-in-becomes-new-host).
echo ""
echo " ⚠ Saved room gist ($_saved_gist_id) no longer on your gh — room dissolved or rehosted."
if [ -n "$_saved_room_resume" ]; then
echo " Re-discovering #${_saved_room_resume} via fresh gist lookup..."
else
echo " Re-pairing via fresh discovery..."
fi
# Wipe stale joiner state. Identity + peer records persist.
rm -f "$CONFIG" "$AIRC_WRITE_DIR/room_gist_id"
local _preserved_name; _preserved_name=$(get_name 2>/dev/null || echo "")
if [ -n "$_saved_room_resume" ]; then
exec env ${_preserved_name:+AIRC_NAME="$_preserved_name"} "$0" connect --room "$_saved_room_resume"
else
exec env ${_preserved_name:+AIRC_NAME="$_preserved_name"} "$0" connect
fi
else
echo ""
echo " ⚠ Could not verify saved room gist ($_saved_gist_id) via gh; leaving joiner state intact."
echo " gh api failed${_gh_gist_http_status:+ (HTTP $_gh_gist_http_status)}. Continuing with SSH probe..."
fi

Copilot uses AI. Check for mistakes.
Comment thread airc
# If we resolved this pair via gist discovery (vs. inline-invite),
# persist the gist id so resume-time freshness checks can detect a
# gist-deletion / replacement before re-pairing against a stale host
# (issue #83). Cleared by cmd_part on graceful leave.

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

Comment says the cached room_gist_id is "Cleared by cmd_part", but cmd_part only removes room_gist_id in the host path; joiners currently keep the file. Either update the comment to reflect the actual lifecycle, or clear room_gist_id on joiner part as well (but be mindful that resume-time stale detection relies on this file).

Suggested change
# (issue #83). Cleared by cmd_part on graceful leave.
# (issue #83). This cache is intentionally retained for joiners so
# resume-time stale detection can still run; it is not universally
# cleared by cmd_part on every graceful leave path.

Copilot uses AI. Check for mistakes.
Comment thread airc.ps1
# If we resolved this pair via gist discovery (vs. inline-invite),
# persist the gist id so resume-time freshness checks (#83) can
# detect a gist-deletion / replacement before re-pairing against
# a stale host. Cleared by Invoke-Part on graceful leave.

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

Comment says the cached room_gist_id is "Cleared by Invoke-Part", but joiner-side Invoke-Part currently only removes room_name and leaves room_gist_id behind. Please either adjust the comment to match the actual lifecycle, or update Invoke-Part to clear room_gist_id if that's the intended behavior.

Suggested change
# a stale host. Cleared by Invoke-Part on graceful leave.
# a stale host. This value is retained for later checks; it is not
# currently cleared by Invoke-Part on graceful leave.

Copilot uses AI. Check for mistakes.
Comment thread install.sh
if command -v pacman >/dev/null 2>&1; then echo "pacman"; return; fi
if command -v apk >/dev/null 2>&1; then echo "apk"; return; fi
;;
MINGW*|MSYS*|CYGWIN*|MINGW64*)

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

The Windows uname case includes both MINGW* and MINGW64*; MINGW* already matches MINGW64_NT-*, so the extra pattern is redundant and can be dropped to keep the case arm simpler.

Suggested change
MINGW*|MSYS*|CYGWIN*|MINGW64*)
MINGW*|MSYS*|CYGWIN*)

Copilot uses AI. Check for mistakes.
Comment thread airc
Comment on lines +1311 to +1331
if ! gh api "gists/$_saved_gist_id" >/dev/null 2>&1; then
# Gist gone (host parted, or peer self-healed and replaced it).
# Trigger fresh discovery: clear the stale joiner state and
# re-exec ourselves into airc connect, which will re-resolve
# via the room name (or fall through to host-mode if no room
# gist exists — first-back-in-becomes-new-host).
echo ""
echo " ⚠ Saved room gist ($_saved_gist_id) no longer on your gh — room dissolved or rehosted."
if [ -n "$_saved_room_resume" ]; then
echo " Re-discovering #${_saved_room_resume} via fresh gist lookup..."
else
echo " Re-pairing via fresh discovery..."
fi
# Wipe stale joiner state. Identity + peer records persist.
rm -f "$CONFIG" "$AIRC_WRITE_DIR/room_gist_id"
local _preserved_name; _preserved_name=$(get_name 2>/dev/null || echo "")
if [ -n "$_saved_room_resume" ]; then
exec env ${_preserved_name:+AIRC_NAME="$_preserved_name"} "$0" connect --room "$_saved_room_resume"
else
exec env ${_preserved_name:+AIRC_NAME="$_preserved_name"} "$0" connect
fi

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

New stale-pairing logic on resume is hard to exercise in CI because it depends on gh api, but it looks testable by stubbing gh in PATH to return a controlled 404/non-404 response. Adding an integration scenario that seeds config.json + room_gist_id and verifies (a) only 404 triggers state wipe/re-exec and (b) non-404 failures do not would help prevent regressions.

Suggested change
if ! gh api "gists/$_saved_gist_id" >/dev/null 2>&1; then
# Gist gone (host parted, or peer self-healed and replaced it).
# Trigger fresh discovery: clear the stale joiner state and
# re-exec ourselves into airc connect, which will re-resolve
# via the room name (or fall through to host-mode if no room
# gist exists — first-back-in-becomes-new-host).
echo ""
echo " ⚠ Saved room gist ($_saved_gist_id) no longer on your gh — room dissolved or rehosted."
if [ -n "$_saved_room_resume" ]; then
echo " Re-discovering #${_saved_room_resume} via fresh gist lookup..."
else
echo " Re-pairing via fresh discovery..."
fi
# Wipe stale joiner state. Identity + peer records persist.
rm -f "$CONFIG" "$AIRC_WRITE_DIR/room_gist_id"
local _preserved_name; _preserved_name=$(get_name 2>/dev/null || echo "")
if [ -n "$_saved_room_resume" ]; then
exec env ${_preserved_name:+AIRC_NAME="$_preserved_name"} "$0" connect --room "$_saved_room_resume"
else
exec env ${_preserved_name:+AIRC_NAME="$_preserved_name"} "$0" connect
fi
local _gh_api_err=""
if ! _gh_api_err=$(gh api "gists/$_saved_gist_id" 2>&1 >/dev/null); then
if printf '%s\n' "$_gh_api_err" | grep -Eqi '(^|[[:space:][:punct:]])404([[:space:][:punct:]]|$)|not[ -]?found'; then
# Gist gone (host parted, or peer self-healed and replaced it).
# Trigger fresh discovery: clear the stale joiner state and
# re-exec ourselves into airc connect, which will re-resolve
# via the room name (or fall through to host-mode if no room
# gist exists — first-back-in-becomes-new-host).
echo ""
echo " ⚠ Saved room gist ($_saved_gist_id) no longer on your gh — room dissolved or rehosted."
if [ -n "$_saved_room_resume" ]; then
echo " Re-discovering #${_saved_room_resume} via fresh gist lookup..."
else
echo " Re-pairing via fresh discovery..."
fi
# Wipe stale joiner state. Identity + peer records persist.
rm -f "$CONFIG" "$AIRC_WRITE_DIR/room_gist_id"
local _preserved_name; _preserved_name=$(get_name 2>/dev/null || echo "")
if [ -n "$_saved_room_resume" ]; then
exec env ${_preserved_name:+AIRC_NAME="$_preserved_name"} "$0" connect --room "$_saved_room_resume"
else
exec env ${_preserved_name:+AIRC_NAME="$_preserved_name"} "$0" connect
fi
fi

Copilot uses AI. Check for mistakes.
Comment thread airc
Comment on lines +1325 to +1330
rm -f "$CONFIG" "$AIRC_WRITE_DIR/room_gist_id"
local _preserved_name; _preserved_name=$(get_name 2>/dev/null || echo "")
if [ -n "$_saved_room_resume" ]; then
exec env ${_preserved_name:+AIRC_NAME="$_preserved_name"} "$0" connect --room "$_saved_room_resume"
else
exec env ${_preserved_name:+AIRC_NAME="$_preserved_name"} "$0" connect

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

In the stale-pairing re-exec path, _preserved_name is read after deleting $CONFIG, but get_name reads config.json. That means the preserved name will always fall back to "unknown" (and resolve_name will then use "unknown"), changing the peer identity unexpectedly. Capture the name before removing the config, or read it from the already-loaded prior_name/get_config_val name and only set AIRC_NAME when it's non-empty and not "unknown".

Suggested change
rm -f "$CONFIG" "$AIRC_WRITE_DIR/room_gist_id"
local _preserved_name; _preserved_name=$(get_name 2>/dev/null || echo "")
if [ -n "$_saved_room_resume" ]; then
exec env ${_preserved_name:+AIRC_NAME="$_preserved_name"} "$0" connect --room "$_saved_room_resume"
else
exec env ${_preserved_name:+AIRC_NAME="$_preserved_name"} "$0" connect
local _preserved_name; _preserved_name=$(get_name 2>/dev/null || echo "")
rm -f "$CONFIG" "$AIRC_WRITE_DIR/room_gist_id"
if [ -n "$_saved_room_resume" ]; then
if [ -n "$_preserved_name" ] && [ "$_preserved_name" != "unknown" ]; then
exec env AIRC_NAME="$_preserved_name" "$0" connect --room "$_saved_room_resume"
else
exec "$0" connect --room "$_saved_room_resume"
fi
else
if [ -n "$_preserved_name" ] && [ "$_preserved_name" != "unknown" ]; then
exec env AIRC_NAME="$_preserved_name" "$0" connect
else
exec "$0" connect
fi

Copilot uses AI. Check for mistakes.
Comment thread airc.ps1
Comment on lines +2153 to +2161
# Wipe stale joiner state (identity + peers persist).
Remove-Item -Force $CONFIG -ErrorAction SilentlyContinue
Remove-Item -Force $savedGistFile -ErrorAction SilentlyContinue
$preservedName = Get-Name 2>$null
$reExecArgs = @('connect')
if ($savedRoom) { $reExecArgs += @('--room', $savedRoom) }
if ($preservedName) { $env:AIRC_NAME = $preservedName }
& $PSCommandPath @reExecArgs
exit $LASTEXITCODE

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

In the stale-gist self-heal path, $preservedName = Get-Name runs after removing $CONFIG, but Get-Name reads from config.json. This will preserve "unknown" rather than the prior name and can change the peer identity on re-exec. Capture $preservedName before deleting $CONFIG (or read it from $priorName/Get-ConfigVal).

Copilot uses AI. Check for mistakes.
Comment thread airc.ps1
Comment on lines +2140 to +2161
& gh api "gists/$savedGistId" 2>$null | Out-Null
if ($LASTEXITCODE -ne 0) {
$savedRoom = ''
if (Test-Path $savedRoomFile) {
$savedRoom = (Get-Content $savedRoomFile -Raw -ErrorAction SilentlyContinue).Trim()
}
Write-Host ''
Write-Host " ! Saved room gist ($savedGistId) no longer on your gh -- room dissolved or rehosted."
if ($savedRoom) {
Write-Host " Re-discovering #$savedRoom via fresh gist lookup..."
} else {
Write-Host ' Re-pairing via fresh discovery...'
}
# Wipe stale joiner state (identity + peers persist).
Remove-Item -Force $CONFIG -ErrorAction SilentlyContinue
Remove-Item -Force $savedGistFile -ErrorAction SilentlyContinue
$preservedName = Get-Name 2>$null
$reExecArgs = @('connect')
if ($savedRoom) { $reExecArgs += @('--room', $savedRoom) }
if ($preservedName) { $env:AIRC_NAME = $preservedName }
& $PSCommandPath @reExecArgs
exit $LASTEXITCODE

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

This gist-freshness check treats any gh api failure as "gist no longer exists" and wipes config. gh api also fails for auth/scope issues, rate limits, and transient network problems, which would cause unnecessary teardown/re-exec. Consider checking gh auth status/gist scope first and only self-heal on an actual 404 response (otherwise warn and proceed to the SSH probe).

Suggested change
& gh api "gists/$savedGistId" 2>$null | Out-Null
if ($LASTEXITCODE -ne 0) {
$savedRoom = ''
if (Test-Path $savedRoomFile) {
$savedRoom = (Get-Content $savedRoomFile -Raw -ErrorAction SilentlyContinue).Trim()
}
Write-Host ''
Write-Host " ! Saved room gist ($savedGistId) no longer on your gh -- room dissolved or rehosted."
if ($savedRoom) {
Write-Host " Re-discovering #$savedRoom via fresh gist lookup..."
} else {
Write-Host ' Re-pairing via fresh discovery...'
}
# Wipe stale joiner state (identity + peers persist).
Remove-Item -Force $CONFIG -ErrorAction SilentlyContinue
Remove-Item -Force $savedGistFile -ErrorAction SilentlyContinue
$preservedName = Get-Name 2>$null
$reExecArgs = @('connect')
if ($savedRoom) { $reExecArgs += @('--room', $savedRoom) }
if ($preservedName) { $env:AIRC_NAME = $preservedName }
& $PSCommandPath @reExecArgs
exit $LASTEXITCODE
& gh auth status 2>&1 | Out-Null
if ($LASTEXITCODE -eq 0) {
$gistProbeOutput = & gh api "gists/$savedGistId" 2>&1
$gistProbeExit = $LASTEXITCODE
if ($gistProbeExit -ne 0) {
$gistProbeText = ($gistProbeOutput | Out-String)
if (($gistProbeText -match '(^|[^0-9])404([^0-9]|$)') -or ($gistProbeText -match '(?i)\bnot found\b')) {
$savedRoom = ''
if (Test-Path $savedRoomFile) {
$savedRoom = (Get-Content $savedRoomFile -Raw -ErrorAction SilentlyContinue).Trim()
}
Write-Host ''
Write-Host " ! Saved room gist ($savedGistId) no longer on your gh -- room dissolved or rehosted."
if ($savedRoom) {
Write-Host " Re-discovering #$savedRoom via fresh gist lookup..."
} else {
Write-Host ' Re-pairing via fresh discovery...'
}
# Wipe stale joiner state (identity + peers persist).
Remove-Item -Force $CONFIG -ErrorAction SilentlyContinue
Remove-Item -Force $savedGistFile -ErrorAction SilentlyContinue
$preservedName = Get-Name 2>$null
$reExecArgs = @('connect')
if ($savedRoom) { $reExecArgs += @('--room', $savedRoom) }
if ($preservedName) { $env:AIRC_NAME = $preservedName }
& $PSCommandPath @reExecArgs
exit $LASTEXITCODE
} else {
Write-Warning "Unable to verify saved room gist ($savedGistId); gh api failed for a non-404 reason. Continuing with existing config."
}
}
} else {
Write-Warning "Unable to verify saved room gist ($savedGistId) because gh auth status failed. Continuing with existing config."

Copilot uses AI. Check for mistakes.
Comment thread install.sh
Comment on lines +77 to +81
winget) echo "" ;; # OpenSSH ships with modern Windows; nothing to install
esac ;;
openssl)
case "$mgr" in
winget) echo "" ;; # bundled with Git for Windows; if Git is installed, openssl is there

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

For the winget path, pkgname_for returns an empty string for some required prereqs (ssh/ssh-keygen, openssl). If those commands are actually missing, the install loop will silently skip them ([ -z "$pkg" ] && continue) and ensure_prereqs will still print "Prereqs installed", leaving the user without a working setup. Consider either (a) emitting an explicit warning/manual install instruction when a prereq is missing but has no winget package mapping, or (b) mapping these to an installable package/capability check so the script can't report success while the prereq is still absent.

Suggested change
winget) echo "" ;; # OpenSSH ships with modern Windows; nothing to install
esac ;;
openssl)
case "$mgr" in
winget) echo "" ;; # bundled with Git for Windows; if Git is installed, openssl is there
winget) echo "Git.Git" ;; # Git for Windows provides ssh/ssh-keygen in Git Bash environments
esac ;;
openssl)
case "$mgr" in
winget) echo "Git.Git" ;; # Git for Windows provides openssl in Git Bash environments

Copilot uses AI. Check for mistakes.
@joelteply
joelteply merged commit 741190c into canary Apr 25, 2026
1 check passed
@joelteply
joelteply deleted the fix/stale-pairing-and-winget branch April 25, 2026 18:15
joelteply added a commit that referenced this pull request Apr 25, 2026
fix: 5 Copilot follow-ups on #92 (stale-pairing edge cases + winget pkg gaps)
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