Repository navigation
fix(sidecar): inherit --no-gist flag so tests stop leaking live #general gists - #154
Conversation
…op leaking #general gists Bug found by continuum-b69f via cross-Mac/Windows substrate-bypass gist 2026-04-27. After the python3 detection fix landed on Windows (PR #153), continuum's airc connect resolved a #general gist that pointed at port 7556 — a Mac-side TEST FIXTURE corpse. Pre-fix: spawn_general_sidecar_if_wanted at airc:1159 spawned the sidecar with `--room general` only, ignoring the parent cmd_connect's `--no-gist` flag. Test scenarios (scenario_part_persists, scenario_general_sidecar_default, scenario_part_keeps_sidecar) spawn the primary with --no-gist --no-discovery to stay isolated, but the sidecar then went and PUBLISHED a real `airc room: general` gist on the live joelteply gh namespace. cleanup_all's `kill -9` bypasses the on-exit gist-delete trap, so the gist orphans forever. Real users discovering #general via auto-scope hit the orphan first (usually most-recent), try TCP to a port whose process exited 30 minutes ago, get RST, end up confused. ## Fix If `use_gist=0` (set by --no-gist on the primary), pass --no-gist to the sidecar spawn too. The flag inherits via the new `_sidecar_args` array. AIRC_NO_DISCOVERY=1 already inherits via subshell environment; only the flag needed explicit forwarding. ## Why integration tests didn't catch this The leakage happens on the live gh account. Integration tests run as Joel on his own gh account, so the leaked gists pollute his own substrate — invisible to test assertions, very visible to real users on the same gh account. Cross-account QA caught it (continuum-b69f's Windows tab discovered the orphan that Mac tests had created an hour earlier). ## Aftermath Already manually deleted 6 orphan gists post-cleanup (alpha #general + 5x cakr-test-*). With this fix, future test runs stop creating new ones. The trap-bypassed-by-kill-9 issue is a separate bug (test fixtures should kill politely). ## Test posture - part_keeps_sidecar: 6/6 - part_persists: 8/8 - general_sidecar_default: 12/12
There was a problem hiding this comment.
Pull request overview
Fixes sidecar spawning so a primary airc connect started with --no-gist doesn’t allow the #general sidecar to publish a real GitHub gist (preventing leaked/orphaned “airc room: general” gists from test fixtures).
Changes:
- Build a
_sidecar_argsarray for the sidecar spawn and conditionally append--no-gistbased on the primary’suse_gist. - Replace the inline
connect --room generalinvocation with the new argument array. - Add explanatory comments documenting the leak scenario and rationale.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # primary with `--no-gist --no-discovery`, but those flags do not | ||
| # propagate to the sidecar's spawn here. The sidecar then publishes | ||
| # an `airc room: general` gist with the test fixture's host info | ||
| # (e.g. host=alpha, port=7556). Test exits via cleanup_all's `kill -9` | ||
| # which bypasses the on-exit gist-delete trap, leaving the gist | ||
| # orphaned. Real users (continuum-b69f's Windows tab) discover it, | ||
| # try to TCP-connect, get RST. Two layers of test isolation hole; | ||
| # this fix patches the upstream half. (The downstream half — kill -9 | ||
| # bypassing the trap — is harder to fix; tracked separately.) |
There was a problem hiding this comment.
The comment mentions passing --no-discovery, but there is no --no-discovery flag parsed by cmd_connect (only AIRC_NO_DISCOVERY=1). This is misleading in-code documentation; update the wording to reference the actual mechanism used to disable discovery in tests/fixtures (or add the flag if it’s intended to exist).
| # primary with `--no-gist --no-discovery`, but those flags do not | |
| # propagate to the sidecar's spawn here. The sidecar then publishes | |
| # an `airc room: general` gist with the test fixture's host info | |
| # (e.g. host=alpha, port=7556). Test exits via cleanup_all's `kill -9` | |
| # which bypasses the on-exit gist-delete trap, leaving the gist | |
| # orphaned. Real users (continuum-b69f's Windows tab) discover it, | |
| # try to TCP-connect, get RST. Two layers of test isolation hole; | |
| # this fix patches the upstream half. (The downstream half — kill -9 | |
| # bypassing the trap — is harder to fix; tracked separately.) | |
| # primary with `--no-gist` and `AIRC_NO_DISCOVERY=1`, but only the | |
| # env var propagates automatically to the sidecar's spawn here. The | |
| # sidecar then publishes an `airc room: general` gist with the test | |
| # fixture's host info (e.g. host=alpha, port=7556). Test exits via | |
| # cleanup_all's `kill -9` which bypasses the on-exit gist-delete trap, | |
| # leaving the gist orphaned. Real users (continuum-b69f's Windows tab) | |
| # discover it, try to TCP-connect, get RST. Two layers of test | |
| # isolation hole; this fix patches the upstream half. (The downstream | |
| # half — kill -9 bypassing the trap — is harder to fix; tracked | |
| # separately.) |
| local _sidecar_args=(connect --room general) | ||
| if [ "${use_gist:-1}" = "0" ]; then | ||
| _sidecar_args+=(--no-gist) | ||
| fi |
There was a problem hiding this comment.
spawn_general_sidecar_if_wanted now relies on use_gist via bash dynamic scoping to decide whether to append --no-gist. The function header comment above lists which cmd_connect locals are read via dynamic scoping, but it doesn’t mention use_gist; please update that list so future refactors don’t accidentally break this linkage.
| # +1, but better to start the sidecar from the canonical default and | ||
| # let it find its own free port without the conflict-detect dance. | ||
| ( env -u AIRC_PORT "${_env_args[@]}" "$0" connect --room general ) & | ||
| ( env -u AIRC_PORT "${_env_args[@]}" "$0" "${_sidecar_args[@]}" ) & |
There was a problem hiding this comment.
There’s an existing integration test (scenario_general_sidecar_default) that documents the expectation that --no-gist applies to the sidecar transitively, but it doesn’t assert that the sidecar scope avoided creating room_gist_id (i.e., no gist publish). Adding an assertion that ${home}.general/room_gist_id is absent when the primary is started with --no-gist would make this regression detectable.
…nd-to-end (#177) fix(msys): export MSYS2_ARG_CONV_EXCL at airc startup — last layer of cross-machine fix (continuum's catch + verify) continuum-b69f's diagnosis 2026-04-27: even with PR #174 + #176's argparse `--flags`, MSYS Git Bash on Windows translates argv VALUES that look like Unix-rooted paths when bash invokes a Windows-native binary. So `--host-airc-home /Users/joelteply/.airc` arrived at python.exe as `--host-airc-home C:/Program Files/Git/Users/joelteply/.airc`, the joiner cached the corrupted path, the SSH command later sent it to a real Unix host that had no such file. Silent broadcast failure. ## Fix ```bash export MSYS2_ARG_CONV_EXCL="${MSYS2_ARG_CONV_EXCL:-/Users/;/home/;/root/}" ``` Set once at airc startup, exported, every airc_core invocation inherits the same translation policy. Targeted prefix list covers macOS / Linux / root home prefixes without breaking `/tmp/` or `/c/` paths (which DO need translation for `--config "$CONFIG"` where $CONFIG is on the local Windows filesystem). Honors a user override via the `${...:-...}` default-fallback. ## End-to-end verification continuum-b69f shipped a test broadcast from Windows after their local patch: > WORKING TEST: Windows-Mac airc msg via continuum-msyspatch with > targeted MSYS exclude. should land! Verified live in MY host's messages.jsonl on Mac: ``` {"from":"continuum-msyspatch","to":"all","ts":"2026-04-27T23:30:13Z", "msg":"WORKING TEST: Windows-Mac airc msg via continuum-msyspatch with targeted MSYS exclude. should land!","sig":"..."} ``` **Cross-machine Mac↔Windows airc end-to-end working.** This was the last bug in the chain that started at PR #153 (Microsoft Store python3 stub). ## Test posture (Mac, where the env var is a no-op) - tabs 19/19, identity 19/19, whois 5/5, part_persists 8/8, list 4/4, general_sidecar_default 12/12, kick 12/12, events 5/5, platform_adapters 11/11, whois_cross_scope 6/6 ## Today's full chain of cross-machine fixes #153 → #154 → #155 → #156 → #157 → #158 → #159 → #160 → #162 → #164 → #165 → #166 → ... → #176 → this. 27+ PRs to ship a working cross-machine airc on Windows. Every step revealed a new layer.
…st never empty the board Continuum #154, live in the persona room: `airc work board` printed "(no work cards)" while 9 cards durably existed and claims flowed. The interactive board verb read a recent-window projection (limit x WORK_BOARD_FETCH_MULTIPLIER transcript events, work-event-filtered); four personas chatting push every work event outside that window within the hour, so the instrument lied about a full board. Lane status, manager status, and workspace list shared the same trap. - Airc::work_board() now delegates to the complete cached projection (work_board_complete + WORK_BOARD_PROJECTION_PAGE_SIZE — cheap since card 1291173d snapshot/resume); the recent-window read, its 4x over-fetch multiplier, and the work-event transcript filter are deleted (they were the minimum-viable patch for this same disease). - `airc work board --limit` becomes an announced display-row cap (newest kept, "showing N of M"); lane/manager/workspace `--limit` flags stay parseable as documented no-ops so existing invocations don't break. - New integration pin: board_survives_chat_flood (card + 600 chat events -> card still on the board). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…e pid-named file Live tail of continuum #154 (2026-07-13): every persona's core log showed PAIRED 'failed to persist snapshot (No such file or directory)' lines. try_save named its tmp file per-PROCESS (`.tmp.<pid>`); an embedded consumer (continuum core) runs many board reads concurrently in one process, so two saves shared one tmp — the first rename consumed it, the second ENOENT'd, the snapshot never persisted, and every read full-replayed the room (exactly the cost card 1291173d's cache exists to avoid). Tmp names now carry an atomic per-attempt sequence. New pin: concurrent_saves_to_one_path_all_persist (8 threads, one snapshot path, every save must succeed). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…st never empty the board (#1286) * fix(work): board verb reads the complete projection — chat traffic must never empty the board Continuum #154, live in the persona room: `airc work board` printed "(no work cards)" while 9 cards durably existed and claims flowed. The interactive board verb read a recent-window projection (limit x WORK_BOARD_FETCH_MULTIPLIER transcript events, work-event-filtered); four personas chatting push every work event outside that window within the hour, so the instrument lied about a full board. Lane status, manager status, and workspace list shared the same trap. - Airc::work_board() now delegates to the complete cached projection (work_board_complete + WORK_BOARD_PROJECTION_PAGE_SIZE — cheap since card 1291173d snapshot/resume); the recent-window read, its 4x over-fetch multiplier, and the work-event transcript filter are deleted (they were the minimum-viable patch for this same disease). - `airc work board --limit` becomes an announced display-row cap (newest kept, "showing N of M"); lane/manager/workspace `--limit` flags stay parseable as documented no-ops so existing invocations don't break. - New integration pin: board_survives_chat_flood (card + 600 chat events -> card still on the board). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(work): per-attempt tmp names — concurrent cache saves raced on one pid-named file Live tail of continuum #154 (2026-07-13): every persona's core log showed PAIRED 'failed to persist snapshot (No such file or directory)' lines. try_save named its tmp file per-PROCESS (`.tmp.<pid>`); an embedded consumer (continuum core) runs many board reads concurrently in one process, so two saves shared one tmp — the first rename consumed it, the second ENOENT'd, the snapshot never persisted, and every read full-replayed the room (exactly the cost card 1291173d's cache exists to avoid). Tmp names now carry an atomic per-attempt sequence. New pin: concurrent_saves_to_one_path_all_persist (8 threads, one snapshot path, every save must succeed). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Fable 5 <[email protected]>
Bug (continuum-b69f via cross-machine QA, 2026-04-27)
After PR #153 unblocked airc on Windows, continuum's first `airc connect` discovered `airc room: general` gist `2ae0eda255...` advertising host=alpha port=7556. Mac-side: alpha was a test-fixture process that exited 38 minutes earlier. Heartbeat frozen at creation timestamp. Continuum got TCP RST on connect.
Root cause
`spawn_general_sidecar_if_wanted` at airc:1159 spawns the sidecar with `--room general` only:
```bash
( env -u AIRC_PORT "${_env_args[@]}" "$0" connect --room general ) &
```
If the primary has `--no-gist`, the flag does NOT propagate. The sidecar happily publishes a real gist for #general on the live gh account. cleanup_all's `kill -9` bypasses the on-exit gist-delete trap, leaving the gist orphaned. Other peers (real users on the same gh account) discover the orphan and try to connect to its dead host.
Fix
```bash
local _sidecar_args=(connect --room general)
if [ "${use_gist:-1}" = "0" ]; then
_sidecar_args+=(--no-gist)
fi
( env -u AIRC_PORT "${_env_args[@]}" "$0" "${_sidecar_args[@]}" ) &
```
`AIRC_NO_DISCOVERY=1` inherits via subshell env automatically; only the flag needs explicit forwarding.
Why integration tests didn't catch this
Tests run as Joel against his own gh account → leaked gists are invisible to test assertions but very visible to real users on the SAME gh account. Cross-account QA caught it — continuum-b69f's Windows tab discovered an orphan that Mac integration tests had created an hour earlier.
Test posture
Out of scope (separate bug)
The `kill -9` → trap-bypassed leakage is the OTHER half of the test isolation hole. Tests should kill politely (SIGTERM, then SIGKILL after a grace period) so the trap can clean up. File for follow-up.