Skip to content

fix(ux): cmd_send confirms success; cmd_invite gets framing; help text catches up - #240

Merged
joelteply merged 1 commit into
canaryfrom
fix/cmd-send-confirms-success-not-silent
Apr 28, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/cmd-send-confirms-success-not-silent

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

QA pass triage. cmd_send + cmd_invite were silent/contextless; help text drifted post-Phase-2. Knocks out 4 of 12 QA bugs.

…to Phase 2

QA pass 2026-04-28 found 12 user-facing bugs. This PR knocks out 4
of the silent / confusing-UX ones:

## cmd_send: success confirmation

Before: airc msg <text>  → completely silent. User has no signal.
After:  airc msg <text>  → "  → #channel (broadcast)"
        airc msg @peer X → "  → @peer on #channel"

--internal callers (cmd_rename's [rename] propagation) stay silent
on purpose; the user-invoked surface gets the confirmation.

## cmd_invite: framing + usage hint

Before: bare 200-char base64 invite string with no context.
After:  labeled block + "Receiver runs: airc connect <paste>" hint
        + nudge that same-account peers can use the mesh gist instead.

## airc help text: post-Phase-2 catch-up

  + airc msg @A @b <text>      multi-DM (also @A,b,c csv)
  + airc msg --channel <name>  stamp display channel
  - "cross-peer-via-host" promise on whois — Phase 2B.3 deleted that
    walk; now annotated as Phase 2C+ TODO.

Verification: tabs 19/0; manual exercise of msg / multi-DM / invite.

Bug list remaining: #4 daemon ping timeout, #5 last_recv stuck,
#7 kick @-prefix inconsistency, #8 identity link/unlink verb, #9
--channel without subscription, #10/12 (mostly addressed here),
#11 (addressed here).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings April 28, 2026 20:10
@joelteply
joelteply merged commit dac1dd4 into canary Apr 28, 2026
1 check passed
@joelteply
joelteply deleted the fix/cmd-send-confirms-success-not-silent branch April 28, 2026 20:10

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

Improves CLI UX clarity for messaging and invitations, and updates top-level airc help text to reflect current Phase-2 behavior.

Changes:

  • Add a one-line success confirmation to cmd_send for user-invoked sends.
  • Wrap cmd_invite’s long join string with explanatory framing and a receiver hint.
  • Update airc help text for send/channel/whois behavior.

Reviewed changes

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

File Description
lib/airc_bash/cmd_send.sh Adds user-facing send confirmation output (skips --internal).
lib/airc_bash/cmd_rooms.sh Changes cmd_invite output from raw join string to a framed multi-line block.
airc Updates help text for send/msg, --channel, multi-DM, and whois.

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

Comment thread lib/airc_bash/cmd_send.sh
Comment on lines +320 to +325
# gets the confirmation.
if [ "$internal" != "1" ]; then
if [ "$peer_name" = "all" ]; then
echo " → #${active_channel} (broadcast)"
else
echo " → @${peer_name} on #${active_channel}"

Copilot AI Apr 28, 2026

Copy link

Choose a reason for hiding this comment

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

The new confirmation line prints unconditionally for non---internal sends, even when the joiner path queued the message due to a network error (the function doesn’t return after writing pending.jsonl). That means users can see a “→ …” confirmation for a message that wasn’t actually appended remotely (only queued), which is misleading. Consider tracking a delivery state (delivered vs queued) and either suppressing the confirmation for queued sends or printing a distinct queued confirmation (and/or returning immediately after queuing).

Suggested change
# gets the confirmation.
if [ "$internal" != "1" ]; then
if [ "$peer_name" = "all" ]; then
echo " → #${active_channel} (broadcast)"
else
echo " → @${peer_name} on #${active_channel}"
# gets the confirmation. Keep the wording neutral here because some
# network-failure paths queue to pending.jsonl and continue, so a
# delivered-looking confirmation would be misleading.
if [ "$internal" != "1" ]; then
if [ "$peer_name" = "all" ]; then
echo " ✓ accepted for #${active_channel} (broadcast; queued on host failure)"
else
echo " ✓ accepted for @${peer_name} on #${active_channel} (queued on host failure)"

Copilot uses AI. Check for mistakes.
Comment on lines +344 to +355
# QA pass 2026-04-28: bare invite-string output was confusing — fresh
# user sees a 200-char base64 blob with no context and has no idea
# what to do with it. Wrap it with a one-line label + a usage hint
# for the receiver. Same gh-account-based discovery still works (gist
# mnemonic is the friendlier path), but the long invite is the
# cross-account fallback so it gets the explicit framing.
echo " Cross-account share invite (one-time pairing string):"
echo ""
echo " $join_string"
echo ""
echo " Receiver runs: airc connect <paste-the-above>"
echo " Same-account peers can use: airc rooms (then 'airc connect' auto-resolves the mesh gist)."

Copilot AI Apr 28, 2026

Copy link

Choose a reason for hiding this comment

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

cmd_invite used to emit only the join string on stdout; wrapping it in labels/blank lines makes $(airc invite) / piping into clipboard / other automation no longer work (the join-string alias strongly implies machine-readable output). To preserve scriptability while keeping the new UX framing, consider printing just the raw join string to stdout and sending the explanatory framing to stderr, or add a --raw/--quiet flag that outputs only the join string.

Suggested change
# QA pass 2026-04-28: bare invite-string output was confusing — fresh
# user sees a 200-char base64 blob with no context and has no idea
# what to do with it. Wrap it with a one-line label + a usage hint
# for the receiver. Same gh-account-based discovery still works (gist
# mnemonic is the friendlier path), but the long invite is the
# cross-account fallback so it gets the explicit framing.
echo " Cross-account share invite (one-time pairing string):"
echo ""
echo " $join_string"
echo ""
echo " Receiver runs: airc connect <paste-the-above>"
echo " Same-account peers can use: airc rooms (then 'airc connect' auto-resolves the mesh gist)."
# Keep stdout machine-readable for command substitution / piping while
# still showing interactive guidance in terminals.
printf '%s\n' "$join_string"
echo " Cross-account share invite (one-time pairing string):" >&2
echo "" >&2
echo " $join_string" >&2
echo "" >&2
echo " Receiver runs: airc connect <paste-the-above>" >&2
echo " Same-account peers can use: airc rooms (then 'airc connect' auto-resolves the mesh gist)." >&2

Copilot uses AI. Check for mistakes.
joelteply added a commit that referenced this pull request Jul 27, 2026
…coning peer no longer stuck at 0-connected (#240) (#1293)

* fix(work): settled cards (Review/Merged/Closed) are not claimable — claims gate on CardState, not just lease expiry

Live evidence (2026-07-24): personas repeatedly re-claimed already-completed
cards because ensure_work_card_unclaimed only checked lease status — settled
work read as open backlog to every board reader, wasting persona cycles on
finished work. New WorkCardNotClaimable error names the state and the
explicit reopen path (airc work state). Test debt noted: the guard needs a
board-fixture regression test when the work-board test harness grows one
(none exists today for this seam).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(self-heal): proof-of-life revives a DEAD dial endpoint — live-beaconing peer no longer stuck at 0-connected (#240)

The failure-counted eviction (5 consecutive dial failures → DEAD) could only be
revived by a strictly-fresher endpoint ADVERTISEMENT (`endpoints_advertised_at_ms`),
which is written only when a rendezvous import ALSO rewrites the peer's endpoint set
(`set_endpoints_json`, gated on the beacon carrying endpoints + the monotonic guard).

So a peer that is provably ALIVE — beaconing, `last_seen_ms` advancing on every
registry import via `touch_last_seen` — but whose endpoint set is unchanged (or whose
stamp write is skipped for a cycle) would keep producing `PeerDialSkip{dead:true}`
forever: its DEAD verdict never cleared, its route read 0-connected, and the only
recovery was a manual `airc join`. That is exactly the field symptom in #240.

Fix: recognize proof-of-life as a second DEAD-revival signal, parallel to the advert
stamp. `DialQuarantine::gate` now also takes the peer's `last_seen_ms`; a DEAD endpoint
is revived for ONE probe when the peer has been seen alive SINCE this streak's last
failure (`proof_of_life_ms > entry.failed_at_ms`), even with no new advertisement. It
is strictly more robust than the advert stamp (last_seen advances on every import; the
advert stamp only when the endpoint set is also rewritten), and keeps the identical
anti-noise contract: a failure under the fresher signal re-kills immediately
(`record_failure` re-stamps `failed_at_ms`), so a live-but-unreachable endpoint costs
at most one 3s dial per fresh beacon, never one per tick. Only the DEAD branch is
affected — timed backoff and the never-failed path are unchanged.

Threaded `last_seen_ms` from `StoredPeer` (collected monotonic-max alongside
`advert_stamps` in `dial_stored_peer_endpoints`) through `dial_one_peer` →
`dial_quarantine_gate` → `gate`, for both the LAN/Tailscale and relay dial arms.

The honest send-receipt half of #240 was already fixed (#1243): `format_send_receipt`
loudly reports "reached 0 of N enrolled peer(s): NONE currently connected" when the
daemon holds no live route. This closes the self-heal half so that receipt stops being
the steady state for a peer that is actually reachable.

Tests: new `fresh_proof_of_life_revives_a_dead_endpoint_without_a_new_advertisement`
unit test pins the revival + one-probe-per-beacon re-kill; all 325 airc-lib unit tests
+ 13 stored_endpoint_dial integration tests stay green; fmt + clippy clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* style: cargo fmt work.rs — WorkCardNotClaimable literal left unformatted by 5546292

Picked up by `cargo fmt` while formatting the #240 change; keeps the pre-push
fmt gate green. No logic change.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Fable 5 <[email protected]>
joelteply added a commit that referenced this pull request Jul 28, 2026
…dpoints NOW (#240 event-driven heal) (#1294)

feat(self-heal): registry import nudges route-refresh — dial fresh endpoints NOW, not up to an interval later (#240 event-driven heal)

Follow-up to the proof-of-life quarantine revival (#1293). That fix made a live
peer's DEAD endpoint eligible to dial again; this closes the SCHEDULING gap after it.

Two loops drive reconnection: the 60s route-refresh loop (dials stored endpoints) and
the ~120s account-registry loop (imports fresh beacons/endpoints from the rendezvous
into the trust store). They were decoupled — a registry import could land a
disconnected peer's fresh endpoint and then sit until the next route-refresh TICK fired,
up to a full REFRESH_INTERVAL later.

This adds the mirror of the existing `endpoint_resync` nudge (route→registry: "my IP
moved, republish"). New `route_wake` nudge (registry→route): the registry loop notifies
it after every tick that actually imports, and the route-refresh loop grows a `wake`
select arm that runs a refresh IMMEDIATELY instead of waiting out the remaining interval.
Freshly-advertised endpoints for a disconnected peer are dialed at once.

Disciplined, not spammy:
- Edge-triggered on a REAL import only — `gated_tick` now returns whether a publish+refresh
  ran and succeeded; a gate-skip or failed tick imports nothing, so no nudge.
- The woken refresh is the SAME idempotent work — connected peers skipped, quarantine/ghost
  gates apply — so in steady state (all connected) it's a cheap no-op. Real work happens
  only when a reconnect is actually pending.
- `Notify` stores one permit, so a nudge landing during a refresh is consumed by the next
  wait (never lost, coalesced).

Wiring: `DaemonState.route_wake: Arc<Notify>` (shared by both loops, same clone as
`endpoint_resync`); threaded into `route_refresh::run_periodic_refresh(shutdown, wake, ..)`
and `registry_refresh::run_loop(.., resync, route_wake, shutdown)`.

Tests: new `a_wake_nudge_runs_a_refresh_before_the_interval_elapses` (start_paused) pins
that a nudge runs a refresh mid-interval, not at the next timer tick. All airc-daemon (8)
+ airc-lib (325) unit tests green; fmt + clippy --all-targets -D warnings clean.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Jul 28, 2026
…ct at once (#240 event-driven heal, peer-dropped leg) (#1295)

feat(self-heal): a dropped LAN session nudges route-refresh — reconnect at once, not up to an interval later (#240 event-driven heal, peer-dropped leg)

Third and final leg of the #240 event-driven heal, completing the symmetry:
- peer CAME BACK: registry import nudges route-refresh (#1294) ✓
- peer DROPPED:   this — a terminated live session nudges route-refresh

Before this, when a live LAN session dropped (clean EOF, I/O error, or a
malformed/oversized frame) the daemon only noticed on its next route-refresh
tick — up to a full REFRESH_INTERVAL (60s) later. That is the "two trusted
peers can't maintain a conversation" latency: a transient blip left the link
dark for up to a minute even though the peer was still reachable.

Now the transport fires a disconnect observer the instant a peer leaves the
`connections` map, and the daemon turns that into a `route_wake` nudge, so a
reconnection dial is attempted AT ONCE — quarantine-gated, so a genuinely
offline peer still costs at most one dial while a transient drop reconnects in
seconds. The wake permit coalesces a burst of drops (partition) into one refresh.

Wiring (mirrors the existing `on_inbound` learned-IP observer end to end):
- airc-transport: `Inner.on_disconnect` + `DisconnectObserver` type +
  `set_disconnect_observer`; a `disconnect()` helper removes the peer and fires
  the observer (lock released before the callback), called at all four session-
  termination sites in `read_loop`.
- airc-lib: `AircInner.on_disconnect` SLOT (so registration order is irrelevant
  — the adapter's observer, wired once at lazy adapter creation, reads the slot
  each drop) + `Airc::set_disconnect_observer`.
- airc-cli daemon boot: register `move |_peer| route_wake.notify_one()` on the
  shared daemon handle, right beside the route-refresh spawn.

Tests: new `disconnect_removes_the_peer_and_fires_the_observer` pins the remove
+ observer-fire contract. airc-transport (33) + airc-lib (325) + airc-daemon (8)
unit tests green; fmt + clippy --all-targets -D warnings clean.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Jul 28, 2026
…t strike — self-heal when a peer returns under a new identity (#240 follow-up) (#1296)

fix(route): a cert-identity-mismatch dial evicts the orphan on the FIRST strike, not the fifth — self-heal when a peer returns under a new identity (#240 follow-up)

Glass-boxed 2026-07-28 on the M5↔bigmama grid: bigmama re-installed and came back
under a NEW peer identity, so her old advertised relay endpoint now presents a cert for
a different peer. Every dial to it failed forever with
`server cert is for peer 71dcc50f, expected 2f0aed7f`. The survivor (M5) stayed "stuck on
the orphan" — it kept hammering the dead identity and the grid wedged; recovery needed a
manual reconnect on bigmama's side. This is the "one node goes down and comes back, the
other stuck on the orphan" reliability gap #240 didn't cover.

Root cause: a cert-identity-mismatch is DETERMINISTIC — the endpoint's identity is
provably wrong, so retrying the SAME stored endpoint can never succeed — but the dial loop
recorded it as a TRANSIENT failure, so it took `DEAD_AFTER_CONSECUTIVE_FAILURES` (5) strikes
across ~5 refresh cycles to evict, and the relay path had no mismatch handling at all.

Fix:
- `DialQuarantine::record_terminal_failure` — jumps the streak straight to the DEAD
  threshold so `gate` evicts on the first strike. It changes ONLY the strike count: the
  revival conditions are untouched, so a FRESHER advertisement (the returning peer's new
  endpoint) or a proof-of-life still lifts the eviction. The returning peer reconnects on
  its own — no manual `airc join`.
- `discovery.rs`: both the direct-dial path (after the identity self-heal retry fails to
  adopt the presented identity) and the relay-dial path now classify a mismatch verdict
  (`presented_peer_from_mismatch_error`) as terminal and evict immediately; a transient
  failure still counts normally.

Note the common orphan case is even cleaner: the returning peer's NEW identity is a NEW
quarantine key with no entry → dials immediately; the terminal eviction just stops the
survivor wasting cycles on the dead OLD identity.

Validated: `cargo test -p airc-lib dial_quarantine` (11 passed incl. new
`terminal_failure_is_dead_on_the_first_strike_but_still_revives`); airc-lib fmt + clippy
(deny-warnings) clean. NOT yet end-to-end validated on a live 2-node down/up — that needs a
coordinated bigmama reconnect; the unit test pins the eviction+revival logic.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Jul 31, 2026
…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]>
joelteply added a commit that referenced this pull request Aug 4, 2026
…iscovery to death

Measured live on the M5, 2026-08-04, in ONE daemon log:

    44,704  relay self-elections
     4,951  "gh request budget exceeded for Registry (30/30 of 30 in 60s)"
        52  enrolled peers, ZERO reachable
      ~4.5s refresh re-entry against a 60s REFRESH_INTERVAL

The mechanism is a closed cycle. `set_disconnect_observer` nudges `route_wake`
on every session drop (#240, so a real reconnect doesn't wait out 60s). A
refresh DIALS every stored peer. On a node whose registry is mostly dead peers,
those dials drop, each drop nudges again, and the next refresh starts ~4.5s
later — the length of the dial sweep. Nothing bounded it.

The damage isn't the CPU, it's the starvation: every pass spends GitHub
requests until the governor cuts the node off at 30/60s, and the account
registry is HOW PEERS FIND EACH OTHER. So the loop consumed the budget that
discovery needs, then kept hammering the closed door 44,704 times. It cannot
climb out on its own, which is why a restart "fixes" it for a minute and the
ghost returns a few times a day.

`MIN_REFRESH_SPACING` (15s) floors re-entry on the wake path only. The nudge is
kept — a genuine reconnect still beats the 60s interval by 4× — it simply cannot
re-enter faster than the floor, bounding the cycle at 4/min instead of
unbounded. The timer path is untouched (it already waits 60s).

Test pins the storm shape directly: 600 nudges across 60 virtual seconds must
produce at most `1 + 60/MIN_REFRESH_SPACING + 1` refreshes. Unfloored this test
counts hundreds — it fails on the exact defect measured above.

This bounds the spin. It does NOT yet make the gh governor's "retry in 60s"
actual backpressure (the loop still re-attempts inside the refused window) —
that is the sibling fix and it is next.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Aug 4, 2026
…annot run (#1317)

* fix(daemon): floor the wake path — the drop-nudge loop was spinning discovery to death

Measured live on the M5, 2026-08-04, in ONE daemon log:

    44,704  relay self-elections
     4,951  "gh request budget exceeded for Registry (30/30 of 30 in 60s)"
        52  enrolled peers, ZERO reachable
      ~4.5s refresh re-entry against a 60s REFRESH_INTERVAL

The mechanism is a closed cycle. `set_disconnect_observer` nudges `route_wake`
on every session drop (#240, so a real reconnect doesn't wait out 60s). A
refresh DIALS every stored peer. On a node whose registry is mostly dead peers,
those dials drop, each drop nudges again, and the next refresh starts ~4.5s
later — the length of the dial sweep. Nothing bounded it.

The damage isn't the CPU, it's the starvation: every pass spends GitHub
requests until the governor cuts the node off at 30/60s, and the account
registry is HOW PEERS FIND EACH OTHER. So the loop consumed the budget that
discovery needs, then kept hammering the closed door 44,704 times. It cannot
climb out on its own, which is why a restart "fixes" it for a minute and the
ghost returns a few times a day.

`MIN_REFRESH_SPACING` (15s) floors re-entry on the wake path only. The nudge is
kept — a genuine reconnect still beats the 60s interval by 4× — it simply cannot
re-enter faster than the floor, bounding the cycle at 4/min instead of
unbounded. The timer path is untouched (it already waits 60s).

Test pins the storm shape directly: 600 nudges across 60 virtual seconds must
produce at most `1 + 60/MIN_REFRESH_SPACING + 1` refreshes. Unfloored this test
counts hundreds — it fails on the exact defect measured above.

This bounds the spin. It does NOT yet make the gh governor's "retry in 60s"
actual backpressure (the loop still re-attempts inside the refused window) —
that is the sibling fix and it is next.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(install): verify the deploy — never report "Installed" for a binary that cannot run

Lived 2026-08-04: a locally-built airc landed on PATH and was SIGKILLed by macOS
on every invocation — exit 137, zero output. `airc --version`, `airc status`,
`airc join` and the daemon each silently did nothing. Twenty minutes of a
completely dead mesh that read, from the outside, exactly like a transport bug.
One `codesign -s -` and it ran immediately.

(The corrupt signature was a hand-run `cp` straight over the installed path, not
this script — install.sh already does the correct cp-to-temp + atomic mv. The
gap this closes is different: the script printed "Installed airc" without ever
executing what it installed.)

"Installed" was a claim about a file existing. It is now a claim about a binary
that answered `--version`, and the reported line carries the version it actually
printed. The check is deliberately cause-agnostic — bad signature, missing dylib,
wrong-arch build all fail identically and all get caught. On macOS it attempts one
ad-hoc re-sign and re-verifies before giving up, so the common case self-heals
instead of stranding the operator.

A silently-dead airc is indistinguishable from a broken mesh, which is the most
expensive failure this project has: it sends you hunting the network for a defect
that is a file permission bit.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(registry): honor the gh governor's backoff — advisory retry is not backpressure

The starvation half of the M5 ghost. One daemon log, 2026-08-04: 4,951
"gh request budget exceeded for Registry (30/30 of 30 in 60s); retry in 60s"
while 52 enrolled peers stayed unreachable. The account registry is HOW PEERS
FIND EACH OTHER, so a permanently-refused registry is a permanently blind node.

The governor had already computed the answer — "retry in 60s" — and the code
threw it away. `gh_run` formatted the denial into an `Adapter(String)`, the
refresh loop logged it, and the ticker brought it straight back to be refused
again inside the window it had just been told was closed. The node could not
climb out on its own, which is why a restart "fixed" it for a minute.

Three changes, one idea — make the wait DATA the caller can honor:

- `AccountRegistryError::RateLimited { retry_after_secs }` — typed, not prose.
  `gh_run` returns it (clamping the governor's i64 rather than panicking on a
  clock oddity); `reason` still reaches the operator via Display + a debug probe.
- `TickOutcome { Imported, NoChange, RateLimited { .. } }` replaces `gated_tick`
  returning a bare bool, which could only say "nudge or don't" and had nowhere
  to put "the door is shut for N seconds".
- `honor()` acts on it: nudge route-refresh on an import, and actually SLEEP a
  denial before the loop comes back around.

Tests pin both directions: a denial costs exactly its window (60s virtual), and
a normal tick costs zero wall-clock, so the backoff can't silently become a
stall. Needed tokio `test-util` in dev-deps for paused time.

Pairs with the wake-path floor in this branch. That one bounded how often we
DIAL; this one stops us spending the discovery budget we'd already been refused.
Neither is yet proven to end the disconnects — the floor measured a 5× spin
reduction on the live M5 but budget denials continued at ~1.2/min, which is the
gap this commit closes. Verification is a real observation window, not this
message.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
joelteply added a commit that referenced this pull request Oct 3, 2026
…ne (#1511)

* fix(lan-tcp): a session owns its socket; a redial ends the replaced one

Measured 2026-10-03: 56 ESTABLISHED TCP connections from BigMama into the M5's airc
port, and 69 the other way on BigMama, one per redial. install_and_spawn_loops replaced
a peer's map entry, which dropped the old outbound sender and so ended the old write loop,
but the old read loop kept its TLS half and the socket open for as long as the far side
did. And when such a stale reader finally ended, disconnect(peer) removed the NEW session
for that peer, knocking out the live link.

Each map entry is now a Session { outbound, id, reader: AbortHandle }:
- install aborts the replaced session's reader (its outbound drops with the entry), so
  both halves drop and the socket closes; the reader is gated on a oneshot until its
  entry is in the map, so an immediate EOF cannot leave a dead session installed;
- a read loop that ends calls disconnect_session(peer, id), which removes the entry
  only if it is still that session;
- disconnect(peer) (drop_connection, #240) removes and aborts, and notifies as before.

Coordinated with Astra (ac873384), who owns the same-key alias lookup: the TLS-authenticated
key field lands with that lookup, its only reader, rather than here unread.

Tests: a_redial_ends_the_replaced_session_and_a_stale_reader_cannot_end_the_new_one
(three dialers with bob's identity; alice keeps one session, the two replaced dialers see
their sockets close, the live one survives; fails with the abort removed) and the
disconnect test now asserts the reader is aborted. airc-transport 38/38, clippy -D warnings
clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(lan-tcp): ending a session aborts its writer too, not only its reader

Astra's blocking review of #1511: dropping a session's sender ends its write loop only
while that loop is idle in recv. A writer blocked in write_all/flush, on a peer that
stopped reading, keeps the TLS write half and the socket alive; aborting the reader
alone left exactly that.

Session now holds the writer's AbortHandle too, and Session::end aborts both. Every way
a session ends goes through it: a redial replacing it, disconnect(peer), and a reader
that ends on its own (disconnect_session aborts the writer; the reader is that task).

Test: a_redial_releases_a_session_whose_writer_is_blocked. A 64-byte in-memory duplex
whose far end never reads blocks the writer on a 4 KiB frame; after the redial the far
end must see the stream fully released (a write into it fails). It never reads, so it
cannot unblock the writer itself, and it fails with the writer abort removed.
airc-transport 39/39, clippy -D warnings and fmt clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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