Skip to content

canary → main: morning fixes (#316 pidfile, #317 ping, #318 input-validation, #319 host bootstrap) - #320

Merged
joelteply merged 5 commits into
mainfrom
merge-canary-main-morning-fixes
Apr 29, 2026
Merged

joelteply merged 5 commits into
mainfrom
merge-canary-main-morning-fixes

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Bundle: 4 fixes from this morning's open-issue sweep.

68/68 unit tests + 5/5 monitor_formatter tests + 4/4 integration_smoke pass.

joelteply and others added 5 commits April 29, 2026 10:43
fix: pidfile any-alive contract — closes status/send disagreement (vhsm bug)

vhsm-d1f4 + authenticator-448f independently reproduced 2026-04-29:
.airc/airc.pid had 3 PIDs, 1 dead. cmd_status used any-alive logic
('running PID X'); cmd_send used all-alive logic ('Send NOT delivered
— pidfile stale'). Two liveness checks in the same binary disagreed
silently for ~10 minutes per repro.

Extract prune_pidfile_and_count to airc top-level. Both call sites
use it. Single contract: 'alive' means at least one PID in the
pidfile is alive. Auto-prunes dead orphans in-place so the file
converges on truth (no manual intervention to fix a poisoned
pidfile).

Live-tested: pidfile with 1 alive + 1 dead returns count=1, file
post-prune contains only the alive pid.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…#317)

Found via stderr in /tmp/airc-connect-*.log:
  [airc:monitor] dropping encrypted msg from <peer>: missing pubkey/privkey for decrypt

Pair handshake stores x25519 pubkeys ASYMMETRICALLY. Continuum had my
pubkey (could encrypt PONG to me); I didn't have theirs (couldn't
decrypt). monitor_formatter dropped the encrypted PONG silently with
that stderr line, auto-pong looked like it never fired, cmd_ping
timed out forever.

For [PING:uuid] / [PONG:uuid] specifically, encryption adds zero
security value — the body is a public uuid with no secret content.
Plaintext sidesteps the asymmetry entirely for control traffic.

Changes:
  - cmd_send: new --plaintext flag (skips envelope-layer wrap regardless
    of recipient's stored pubkey).
  - cmd_ping: routes via #general --plaintext (was just #general).
  - monitor_formatter auto-pong: subprocess argv now includes --plaintext.

The bigger pubkey-symmetry bug (peer record A.json missing x25519_pub
after handshake) is filed separately — this fix unblocks the ping
demo loop without depending on that fix.

TDD: test_monitor_formatter.py asserts auto-pong argv contains
--plaintext (regression guard against re-introducing encrypted control
traffic). test_ping_addressed_to_someone_else_does_not_fire_pong +
test_pong_is_suppressed_not_repeated + test_broadcast_ping_does_not_fire_pong
+ test_heartbeat_line_is_swallowed_no_stdout_output cover surrounding
contracts.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
fix: input-validation cluster — silent acceptance → loud rejection

continuum-b741 + ideem-local-4bef caught 2026-04-29 a batch of
silent-acceptance bugs. The pattern: bad input was absorbed into the
wrong code path with exit 0 and no diagnostic, exactly the swallowed-
errors anti-pattern CLAUDE.md targets.

Fixed:
  - cmd_send unknown flags ('airc msg --invalidflag value body'):
    pre-fix fell into *) catch-all and got broadcast as message body;
    now dies loudly. Added '--' POSIX terminator so users with literal
    --strings in message bodies aren't blocked.
  - cmd_send empty @ recipient ('airc msg @ body'): silently broadcast.
    Now dies. Also rejects double-@ ('@@peer') and invalid-charset
    peer names ('@12345', etc).
  - cmd_send empty broadcast body ('airc msg ""'): printed usage
    line but exited 0. Now dies.
  - cmd_rename silent sanitization ('two words' → 'two-words',
    'VHSMD1F4' → 'vhsmd1f4'): pre-fix the user had no signal that
    the name they typed wasn't the name that landed. Now prints a
    'Sanitized: <input> → <result>' line.
  - cmd_rename collision check: renaming to an active peer's name
    silently collided. Refuses now if PEERS_DIR has a record for the
    target name.
  - cmd_logs bad count ('airc logs 0' or 'airc logs notanumber'):
    pre-fix exited 0 with no output. Now dies.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…319)

fix(#301): host bootstrap uses canonical airc-room-<channel>.json filename

Pre-fix the host bootstrap in cmd_connect created the room gist with
a random temp basename (mktemp -t airc-invite.XXXXXX). Heartbeat (#297)
then tried to update airc-room-<channel>.json which didn't exist, gh
'gist edit' silently failed, host self-evicted on 3 consecutive
heartbeat-failures, gist deleted mid-conversation. continuum + ideem
flagged this convergence; #297 fixed the heartbeat side, this fixes
the create side.

Solution: bootstrap writes a temp dir + names the file
airc-room-<channel>.json (matching channel_gist.create_new's seed
filename) so subsequent gh edits via basename match work. Description
stays 'airc mesh' for the moment because joiner discovery uses
_mesh_find which matches that literal — full migration to
'airc room: #<channel>' description as a follow-up.

Also: spawn_real in test/integration_smoke.sh now waits for
channel_gists to actually be populated in config.json after starting
a host, not just for 'Hosting as' to appear in stdout. The latter
fires before the gist is published, so the next peer spawned right
after raced and saw no mesh on the account → bootstrapped as its own
host of the same room → test failed flakily. Fixed.

Smoke tests: 4/4 pass against real gh substrate.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
@joelteply
joelteply merged commit 01b58b2 into main Apr 29, 2026
@joelteply
joelteply deleted the merge-canary-main-morning-fixes branch April 29, 2026 15:56
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.

1 participant