Repository navigation
Conversation
…closes #152) (#262) The PS port was 2968 lines — a parallel codebase to the bash 'airc'. After Phase 1+2 substrate landed (PRs #222-#243+) it lagged ~100 commits behind canary because every fix had to be hand-ported and never was. Issue #152 tracked the drift. ## Resolution Stop maintaining a parallel codebase. Git Bash ships with Git for Windows (install.ps1 already ensures git is installed). The new airc.ps1 is an 80-line shim: 1. Locate bash.exe (PATH → standard Git install paths → fallback). 2. Exclude System32\bash.exe (WSL Linux bash can't see Windows paths). 3. Forward all args via @Args splat to bash 'airc'. 4. Print clear install instructions if Git Bash is missing. ## Net effect airc.ps1: 2968 → 80 lines (-2888) Windows users running 'airc' (whether via airc.cmd → pwsh → airc.ps1 or directly via airc.ps1) now execute the same bash binary as Mac/Linux users. Zero drift forever. Every Phase 1+2 substrate fix instantly applies on Windows. ## What this requires - Git for Windows (provides bash.exe). install.ps1 already installs it. - For users on the OLD airc.ps1 who haven't reinstalled: re-run install.ps1 (or 'curl install.sh | bash' from Git Bash) to pull this change. ## What this drops The parallel PS port's value was 'works without Git Bash'. In practice nobody ran without Git Bash because install.ps1 ships it as a hard dep. The maintenance burden vastly exceeded the value. Closes #152. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…se (closes #188) (#263) jq was a hard dep that overlapped with python3 (the existing truth- layer dep since #152 Phase 0). Joel called this out 2026-04-28: 'why do we have so many damn dependencies now?' — the answer was 'we shouldn't.' ## What changed New `lib/airc_core/gistparse.py` (Python stdlib JSON only) with subcommands: - get <path> [--default ...] — extract dot/index path - get_json <path> — same but always emits compact JSON - get_first_of <p1> <p2> ... — fallback chain (jq's `a // b`) - pick_addr <scope> — first {addr|port} matching scope - pick_addr_first — first entry's {addr|port} - list_lan_entries — each LAN entry as compact JSON - gist_content — extract first file's .content from gh-api response ## Sites converted (27 jq calls → 0) airc top-level (host_address_set / peer_pick_address): 8 sites → gistparse cmd_connect.sh (gist envelope parsing): 19 sites → gistparse install.sh: dropped jq from prereq probe + winget package map cmd_doctor.sh: dropped jq from environment health checks ## Why the bash bare-grep fallback path is also gone The old code had a 'jq missing' fallback that grepped raw_content for '@.*@' lines and sed-stripped JSON syntax. With Python now mandatory and gistparse handling envelopes structurally, the fallback path's trigger condition is gone — but we kept it as a last-resort for truly malformed gist content (legacy raw-string envelopes from before the JSON envelope landed). ## Verification test/integration.sh tabs: 19/0 ✓ test/integration.sh queue: 7/0 ✓ test/integration.sh general_sidecar_default: 10/0 ✓ test/integration.sh room: 14/0 ✓ Standalone gistparse smoke: get / get_json / get_first_of / pick_addr / list_lan_entries / gist_content all return expected values per jq -r equivalents. ## Effect on installs install.sh prereq list shrinks from 6 commands (git gh jq openssl ssh-keygen python3) to 5 (jq dropped). Linux/macOS/Windows installers all benefit; users with restricted package managers (Windows Server without winget) have one less thing to install. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
#266) fix(update): write .channel BEFORE install.sh, not after (closes regression in #264) continuum-b741 caught during #264 regression sweep: 'airc version' reports 'on canary' but 'airc channel' reports 'main' after running 'airc update --main'. Disagreement between branch and saved-channel preference. ## Root cause cmd_update.sh sequence on 'airc update --main': 1. requested_channel='main'; channel='main' 2. checkout main branch (success) 3. ★ run install.sh 4. write .channel='main' install.sh has an auto-recovery block (install.sh:797-809) for users on a non-channel branch. It reads .channel + current branch and 'fixes' disagreement by reverting branch to the saved channel. Step 3 sees: branch='main' (just switched), .channel='canary' (stale, not yet updated). The 'fix' switches branch BACK to canary. Step 4 then writes .channel='main' to the now-canary install dir. Net: branch=canary, .channel=main. Reported version disagrees with saved channel — looks broken even though the underlying state is just inconsistent. ## Fix Reorder: write .channel BEFORE running install.sh. install.sh now sees .channel='main' + branch='main' = consistent, leaves branch alone, ff-pulls cleanly. Result: branch=main, .channel=main, version correctly reports 'on main'. Trade-off: if install.sh fails after the .channel write, the file records the intended channel but the install dir might be partially on the new branch. That's strictly better than the prior bug — the prior order had the same partial-state risk plus the disagreement above on the success path. Either way, the dirty-tree check (#247) catches most pre-failure conditions. ## Verification test/integration.sh tabs: 19/0 ✓ Manual repro on Mac: Before: branch=canary, .channel=main, version='on canary' (wrong) After: branch=main, .channel=main, version='on main' (correct) Closes the regression in #264. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Hotfix bundle addressing a channel/branch consistency regression during airc update, while also removing the jq dependency (routing gist/envelope parsing through a Python truth-layer) and simplifying the Windows PowerShell entrypoint to avoid Bash↔PowerShell drift.
Changes:
- Fix
cmd_updateordering by persisting.channelbefore runninginstall.shto prevent branch auto-recovery from undoing the requested channel switch. - Introduce
lib/airc_core/gistparse.pyand update bash callers to use it, removingjqfrom install/doctor prerequisites. - Replace the large
airc.ps1implementation with a thin forwarder that dispatches to the bashaircvia Git Bash.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
lib/airc_core/gistparse.py |
Adds a Python CLI for extracting gist/envelope fields and picking addresses, replacing jq usage. |
lib/airc_bash/cmd_update.sh |
Writes .channel before install.sh to keep channel/branch state consistent across update. |
lib/airc_bash/cmd_doctor.sh |
Removes jq from prerequisite probes. |
lib/airc_bash/cmd_connect.sh |
Switches gist content + envelope parsing from jq to airc_core.gistparse. |
install.sh |
Removes jq from prereqs and package mapping. |
airc.ps1 |
Refactors to a minimal shim that forwards to bash airc via Git Bash. |
airc |
Updates address picking logic to use airc_core.gistparse instead of jq. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Locate the bash `airc` script next to this file. | ||
| $aircDir = Split-Path -Parent $MyInvocation.MyCommand.Path | ||
| $bashAirc = Join-Path $aircDir 'airc' | ||
| if (-not (Test-Path -LiteralPath $bashAirc)) { | ||
| Write-Error "airc.ps1: cannot find sibling 'airc' bash script at $bashAirc. Reinstall via install.ps1." |
There was a problem hiding this comment.
The shim assumes the bash airc script lives next to airc.ps1, but install.ps1 only places/symlinks airc.ps1 + airc.cmd into BIN_TARGET. When invoked via airc.cmd, $MyInvocation.MyCommand.Path will point at BIN_TARGET, so Join-Path $aircDir 'airc' likely won’t exist and the shim will exit 1. Suggest resolving the symlink target (or using $PSScriptRoot/$PSCommandPath -> Get-Item ... | Select-Object -Expand Target) to find the clone dir, and/or fall back to $env:AIRC_DIR / $env:USERPROFILE\.airc-src\airc.
| # Locate the bash `airc` script next to this file. | |
| $aircDir = Split-Path -Parent $MyInvocation.MyCommand.Path | |
| $bashAirc = Join-Path $aircDir 'airc' | |
| if (-not (Test-Path -LiteralPath $bashAirc)) { | |
| Write-Error "airc.ps1: cannot find sibling 'airc' bash script at $bashAirc. Reinstall via install.ps1." | |
| function Resolve-BashAirc { | |
| $candidates = New-Object System.Collections.Generic.List[string] | |
| $scriptPath = $PSCommandPath | |
| if (-not $scriptPath) { | |
| $scriptPath = $MyInvocation.MyCommand.Path | |
| } | |
| if ($scriptPath) { | |
| $candidates.Add((Join-Path (Split-Path -Parent $scriptPath) 'airc')) | |
| $scriptItem = Get-Item -LiteralPath $scriptPath -ErrorAction SilentlyContinue | |
| if ($scriptItem -and $scriptItem.Target) { | |
| $targetPath = $scriptItem.Target | |
| if ($targetPath -is [System.Array]) { | |
| $targetPath = $targetPath[0] | |
| } | |
| if ($targetPath) { | |
| $candidates.Add((Join-Path (Split-Path -Parent $targetPath) 'airc')) | |
| } | |
| } | |
| } | |
| if ($env:AIRC_DIR) { | |
| $candidates.Add((Join-Path $env:AIRC_DIR 'airc')) | |
| } | |
| if ($env:USERPROFILE) { | |
| $candidates.Add((Join-Path $env:USERPROFILE '.airc-src\airc')) | |
| } | |
| foreach ($candidate in $candidates) { | |
| if ($candidate -and (Test-Path -LiteralPath $candidate)) { | |
| return $candidate | |
| } | |
| } | |
| return $null | |
| } | |
| # Locate the bash `airc` script from the current script path, resolving | |
| # symlinks when present, then fall back to known install locations. | |
| $bashAirc = Resolve-BashAirc | |
| if (-not $bashAirc) { | |
| Write-Error "airc.ps1: cannot find the 'airc' bash script. Checked the current script location, its symlink target, `$env:AIRC_DIR, and `$env:USERPROFILE\.airc-src\airc. Reinstall via install.ps1 or set AIRC_DIR." |
| python -m airc_core.gistparse pick_addr <scope> (stdin = host.addresses list) | ||
| python -m airc_core.gistparse pick_addr_first (stdin = host.addresses list, .[0]) | ||
| python -m airc_core.gistparse list_lan_entries (stdin = host.addresses list) | ||
|
|
||
| Each subcommand returns "" + exit 0 on missing field — bash callers | ||
| read stdout into a local var. Errors (malformed JSON, etc.) also | ||
| exit 0 with empty output unless --strict is passed; jq's behavior was | ||
| quiet-and-empty for malformed input and we preserve that. |
There was a problem hiding this comment.
The module docstring says parse errors "exit 0 with empty output unless --strict is passed", but the CLI parser doesn’t define a --strict flag and all subcommands currently always return 0. Also, the docstring’s CLI section omits the implemented gist_content and get_first_of subcommands. Please either implement --strict (and document exit codes) or update the docstring to match the actual interface.
| python -m airc_core.gistparse pick_addr <scope> (stdin = host.addresses list) | |
| python -m airc_core.gistparse pick_addr_first (stdin = host.addresses list, .[0]) | |
| python -m airc_core.gistparse list_lan_entries (stdin = host.addresses list) | |
| Each subcommand returns "" + exit 0 on missing field — bash callers | |
| read stdout into a local var. Errors (malformed JSON, etc.) also | |
| exit 0 with empty output unless --strict is passed; jq's behavior was | |
| quiet-and-empty for malformed input and we preserve that. | |
| python -m airc_core.gistparse get_first_of <path> [<path> ...] (stdin → first present value) | |
| python -m airc_core.gistparse gist_content (stdin → gist content payload) | |
| python -m airc_core.gistparse pick_addr <scope> (stdin = host.addresses list) | |
| python -m airc_core.gistparse pick_addr_first (stdin = host.addresses list, .[0]) | |
| python -m airc_core.gistparse list_lan_entries (stdin = host.addresses list) | |
| Missing fields return "" and exit 0 so bash callers can read stdout | |
| into a local var. Malformed JSON and other parse errors are also | |
| handled quietly with empty output and exit 0 to preserve the prior jq | |
| compatibility behavior. This module does not currently implement a | |
| `--strict` CLI flag. |
| # #188: jq removed — airc's gist envelope parser now uses Python's | ||
| # stdlib JSON (lib/airc_core/gistparse.py). Python was already a hard | ||
| # dep since #152 Phase 0; jq was redundant. Drop the dep + the | ||
| # winget step that would install it. | ||
| for cmd in git gh openssl ssh-keygen python3; do |
There was a problem hiding this comment.
jq is removed from install-time prereqs here, but the integration suite still shells out to jq for gist/envelope assertions (e.g. test/integration.sh scenario_heartbeat and multi-address checks). That means CI/dev runs without jq will now silently skip those scenarios, reducing coverage exactly where this change is refactoring behavior. Suggest updating the tests to use python -m airc_core.gistparse (or another stdlib JSON helper) so they continue to run without jq.
…l fix) (#268) fix(airc.ps1): resolve bash 'airc' via AIRC_DIR, not sibling PR #262 made airc.ps1 a thin Git Bash forwarder that locates the bash `airc` next to itself. install.ps1 copies airc.ps1 to $BIN_TARGET (on PATH) but the bash `airc` + `lib/` tree stays in $CLONE_DIR — they're NOT siblings on Windows. Linux/Mac sidesteps this with a symlink at $BIN_DIR/airc; Windows can't symlink reliably so it copies, which broke the sibling resolution. After install: $BIN_TARGET\airc.ps1 ← copied $BIN_TARGET\airc.cmd ← copied $CLONE_DIR\airc ← bash entry point (lives with its lib/) $CLONE_DIR\lib\airc_bash ← sourced by bash airc Symptom (clean-install-windows CI): airc.ps1: cannot find sibling 'airc' bash script at C:\Users\runneradmin\AppData\Local\Programs\airc\airc. Reinstall via install.ps1. Fix: resolve via $env:AIRC_DIR (matching bash convention), default $HOME\.airc-src. Keep sibling lookup as a dev-checkout fallback so running airc.ps1 directly from a git checkout still works. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…e endpoints (#267) (#1302) * fix(route): terminal cert-mismatch eviction ignores proof-of-life revival — kill the 0↔1 route flap (self-heal #2) Glass-boxed live on the M5↔bigmama grid 2026-07-28: transport health oscillated 0↔1 healthy route every ~20s. Root cause: record_terminal_failure (the cert-identity-mismatch path, #1296) evicts the orphan endpoint on the first strike but left BOTH revival signals live — a fresher advert OR proof-of-life. Proof-of-life revival is wrong for a DETERMINISTIC failure: the peer being alive changes nothing about a cert that mismatches forever on the SAME stored endpoint. So every presence beacon (last_seen_ms advances each registry import) revived the corpse → re-dial → re-mismatch → re-kill → next beacon revives again. That IS the flap ('cert is for 71dcc50f, expected 2f0aed7f' cycling). Fix: mark terminal entries `terminal: true` on QuarantineEntry; gate()'s alive_since_failure is now `!entry.terminal && proof_of_life_ms > failed_at_ms`. A terminal eviction revives SOLELY on a genuinely fresher endpoint ADVERTISEMENT (new addr/port/cert) — the only thing that can actually clear a deterministic cert mismatch. Non-terminal (transient) failures keep both signals, preserving the #240 live-peer heal untouched. Tests: renamed the terminal test to _revives_only_on_fresher_advert (drops the now- wrong proof-of-life-revives assertion); added terminal_eviction_is_not_revived_by_ proof_of_life_no_flap pinning the flap regression (advancing PoL stays DEAD every tick; only a fresher advert lifts it). #240 non-terminal PoL-heal test stays green. 12 dial_quarantine + 44 route tests pass. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(daemon): attach cursor HEARTBEAT — AttachCursorAdvanced rides live streaming, throttled 1/s The seam summary was the ONLY advance a consumer ever saw: during live streaming the watermark never moved, so a cursor-persisting consumer (continuum #261, found by its PR #2057 review) re-received the WHOLE session's events on every reattach — five reboots of full-session redelivery produced a persona echo storm on 2026-07-30. After each forwarded Event the daemon now emits an advance frame carrying that event's cursor, throttled to one per second (kinds:None attaches carry StreamChunk bursts — never a frame storm). The unadvanced tail at shutdown shrinks from the whole session to ≤1s of events. skipped=0 on heartbeats (nothing suppressed). Contract change, test re-pinned: AttachCursorAdvanced may interleave on ANY attach shape; clients must tolerate it. The no-skip property the test now asserts: an advance NEVER precedes the delivery of the event it points at — persisting advanced_to can only resume at-or-before what was seen. attach_backlog_coalesce 3/3, airc-daemon suite green. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(route): #267 — stable relay port + self-relay live-port dial + honest doctor on zero routes Three layers of the 'airc always broken' shape, glass-boxed live today (peers dialing relay :65280 while the live listener sat on :57958, Connection refused, 0 healthy routes — and doctor stamping [ok] on it): 1. doctor: 'degraded == 0' was vacuously true for an EMPTY health list — zero routes with enrolled remote peers now WARNS 'remote delivery is DOWN' instead of [ok] 0 route(s) healthy. 2. dial: a relay endpoint pinning THIS node's peer id is rewritten onto the LIVE relay listener port before dialing — the node is the authority on its own listener; it must never dial (then quarantine) a previous incarnation's dead port. 3. election: become_relay_with_stable_port persists the bound port in the runtime dir and re-binds it on restart, so every peer's imported airc-relay://me@ip:port card stays valid across daemon restarts — OS-assigned is only the first-election / port-stolen fallback. Tests: self-relay substitution (live port wins / foreign relay dials as recorded) + bind-candidate order (persisted first, no double-zero). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(cli): room lists ALL subscriptions + inbox names what it is NOT showing (#270) The day's fourth silent-drop layer was pure presentation: bare 'airc room' printed only the CURRENT room (read as a membership list) and 'airc inbox' silently paged only the current room — so a subscribed-but-not-current channel's messages sat invisible while both agents diagnosed a transport failure that did not exist. Membership must be visible to be trusted: room now lists every subscription with the current one marked; inbox headlines 'room X ONLY — N other subscribed room(s) NOT shown: ...'. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(cli): keep 'room:' as the current-room label — output formats are APIs The #270 rename to 'current:' broke continuum-core's airc bootstrap, which parses `airc room` stdout for the 'room: <name>' line (degraded probe on next boot). Restore the stable label; the subscription list stays beneath. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(cli): wire:/channel: labels stay at column 0 — start-server.sh awks /^channel:/ Second downstream parser of the same human output (continuum's start-server.sh derives AIRC_DEFAULT_CHANNEL via awk anchored at line start); the #270 indent broke it and fail-loud full-citizen boot refused. Exact legacy shape restored; subscription list still appended after. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(cli): transport-health endpoints come from the MACHINE DAEMON, not the CLI scope The five-month 'airc is broken' pattern was mostly this class: short-lived CLI probes building their own scope-local view of state the machine daemon owns. 'endpoints: none' printed while the daemon listened on two ports with live inbound connections — a lie of omission that misdirected every transport debug toward routes that were fine. Now: ask the daemon (Request::RouteEndpoints, the op card 4b6a0ffa already built for exactly this reason); print each advertised endpoint; empty-from-daemon says loudly 'NOT dialable'; daemon-unreachable falls back to the scope view LABELED non-authoritative. Verified live: daemon-advertised LanTcp 192.168.1.249:57958 now visible where 'none' printed before. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(daemon): relay-hood is a DURABLE ROLE — re-assume the persisted relay on every tick Regression glass-boxed 2026-07-31 morning: overnight daemon restart dropped the :65280 relay listener because self-election only fires when NO peer is reachable — and a direct LAN peer was connected. But peers hold airc-relay://me@ip:port cards; a relay that only exists during total isolation refuses every card-holder the rest of the time. The persisted relay-port file IS the role record: when it exists, become_relay runs every tick unconditionally (idempotent — already-relaying is a cheap re-advertise). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(feed): ONE event = ONE line — multi-line bodies must never fragment the live feed Glass-boxed 2026-07-31 after a full day of it: a multi-paragraph room message printed its body raw, so every line-tailing consumer (agent monitors, Codex hooks, grep pipelines, both grid agents' feeds) saw one attributed '[Message] a -> b: <first line>' and then a storm of orphan fragments ('1. **', '- Investigate', 'Let') with no sender, no channel, no kind — hours of unattributable noise per message, on BOTH nodes ('the version-drift rendering'). render_feed_line now flattens newlines to a visible pilcrow so the line contract holds unconditionally; regression test pins it. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(ci): kill the relay-election expect() + un-pin the stale endpoints assertion Two CI-only reds on #1302, both genuinely ours: - clippy (-D clippy::expect-used): become_relay_with_stable_port ended in last_err.expect(). Restructured so the OS-assigned bind (port 0 — always the terminal candidate, pinned by the relay_bind_candidates tests) is the final attempt whose error propagates via ?. No Option, no panic path. - transport_health_reports_no_routes_on_fresh_scope asserted the OLD scope-local 'endpoints: none' literal — exactly the line this PR replaced with daemon-authoritative rendering. A fresh scope now prints one of two honest states (daemon advertising nothing / daemon unreachable, labeled scope-local) depending on whether the environment auto-spawned the scope daemon; the test accepts both and still rejects the killed lie. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
Three commits ahead of main since the last bundle (#191):
Real-user-facing fix: anyone on canary who ran 'airc update --main' got a confusing 'version says canary, channel says main' state. Ship to main so they recover on next 'airc update'.
🤖 Generated with Claude Code