Skip to content

fix(monitor): rediscover cadence 60s → 30s (halve rotation blackout) - #414

Merged
joelteply merged 1 commit into
canaryfrom
fix/airc-bearer-fail-immediate-rediscover
May 2, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/airc-bearer-fail-immediate-rediscover

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Iteration #2 of the cadence parameter: 300s → 60s (#407) → 30s. Tonight's repro: rotated host gist, 60s+ later b69f still on dead gist. 30s halves the window. Still gh-rate-limit safe (120 calls/hour vs 5000 limit). Bearer-fail-triggers-rediscover sentinel-file approach is the next architectural move if 30s ever isn't tight enough.

🤖 Generated with Claude Code

Tonight's repro 2026-05-02: I rotated my host gist via teardown,
60s+ later b69f still couldn't reach me — Joel had to relay. 30s
halves the worst-case rotation blackout window and starts
approaching the bearer's own 15s poll cadence so the rediscover
happens at most 2 polls late from the bearer's PoV.

Cost: 120 gh api calls/hour/peer (was 60), still well under the
5000/hr authenticated limit.

This is iteration #2 of the cadence parameter:
  300s (original) → 60s (#407) → 30s (this)

Hard floor on this approach is the gh-list-gists rate +
single-cycle latency. To go lower would need bearer-fail-triggers-
rediscover (sentinel file pattern or in-process signal) — that's
the next-PR architectural move when 30s isn't tight enough.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings May 2, 2026 16:36
@joelteply
joelteply merged commit e1115fc into canary May 2, 2026
8 checks passed
@joelteply
joelteply deleted the fix/airc-bearer-fail-immediate-rediscover branch May 2, 2026 16:37

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 tightens the mesh self-healing loop in airc by reducing the default host-gist rediscovery interval from 60s to 30s, aiming to shorten the blackout window after a host rotates its gist. It fits into the monitor/mesh recovery path that keeps joiners subscribed to the live shared gist without requiring manual rejoin.

Changes:

  • Reduce _mesh_rediscover_loop default cadence from 60 seconds to 30 seconds.
  • Update the inline rationale/comments to describe the new recovery window and API-call budget.

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

Comment thread airc
Comment on lines +1982 to +1991
# Cadence: 30s default. Was 300s → 60s in #407 → 30s here. Joel's
# "satellite/bios" framing wants the tightest cadence that's still
# gh-rate-limit safe. _mesh_find does ~1 gh api call per cycle
# (~120 calls/hour/peer at 30s), well under gh's 5000/hr limit.
# Tonight's repro 2026-05-02: I rotated my host gist via teardown,
# 60s+ later b69f still couldn't reach me — Joel had to relay.
# 30s halves that worst-case window and starts approaching the
# bearer's own 15s poll cadence so the rediscover happens at most
# 2 polls late from the bearer's PoV.
local interval="${AIRC_MESH_REDISCOVER_SEC:-30}"
Comment thread airc
# 30s halves that worst-case window and starts approaching the
# bearer's own 15s poll cadence so the rediscover happens at most
# 2 polls late from the bearer's PoV.
local interval="${AIRC_MESH_REDISCOVER_SEC:-30}"
joelteply added a commit that referenced this pull request May 2, 2026
…irective, 2026-05-02) (#415)

fix(teardown): KEEP hosted gist on teardown — bus stability over orphan-cleanliness

Joel 2026-05-02: "you can't have a bus if everyone speaks on a
different one." The hosted gist is the BUS for a channel — stable,
shared, channel-scoped. NOT the host process's property to delete on
restart.

Pre-fix: every `airc teardown` of a host deleted the hosted gist.
Routine restarts (code update, daemon swap, sleep cycle) rotated
the bus address. Peers couldn't reach the new host until they
auto-rediscovered (30s+ blackout per #414's tightened cadence).
Joel had to manually relay every rotation. Scaling fail.

New behavior: teardown PRESERVES the gist. Only `airc part` (the
explicit "I'm leaving this channel" command) actually deletes it.
On next host start, discovery finds the existing gist + reuses it
as the same channel address. Restarts are now bus-transparent.

Tradeoffs accepted:
- Joiners may briefly see no new messages while host is mid-restart.
  Fine — better than bus rotating under them.
- Stale gist if host never returns: existing _self_heal_stale_host
  takeover handles this (heartbeat-based; another peer claims gist).
- --flush wipes local scope but NOT gist (separate concerns).

This closes the architectural defect that drove most of tonight's
"why are you both dormant" pattern. Substrate-rotation was happening
on every teardown; recovery was reactive (cadenced rediscover).
With this PR, the bus address stays stable across restarts. The
auto-rediscover loops still exist for the genuine host-rotation
case (when one host parts and another claims) but no longer have
to fire on every routine restart.

Companion follow-up: heartbeat-based host election (when the gist's
host goes silent, peers detect + claim host role automatically
without rotating gist address). _self_heal_stale_host has the
mechanism; just need to verify it works reliably with this change.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
joelteply added a commit that referenced this pull request May 2, 2026
…routing) (#418)

Captures the architecture conversation Joel surfaced 2026-05-02 end of the
22-PR airc hardening session. Replaces "single transport at a time" with a
reticulum-style fusion routing layer above pluggable interface drivers
(loopback / LAN / Tailscale / gh / Reticulum-future).

Core principles, all from Joel verbatim:

- "airc is you as an agent's complex vocal learning trait" — substrate is
  constitutive of cognition, not infrastructure under it
- "you never require these dependencies to exist" — every transport is
  optional, auto-detected, gracefully absent
- "since we know it is a rate limited feature it should be used sparingly
  if possible. because when you do, gh suffers an outage and we are down"
  — gh as scarce resource, not default channel
- "its like sensor fusion, if we lose accelerometer we dont lose position,
  it all works together" — fusion not failover; loss of one transport
  degrades the fused estimate gracefully, layer above sees one virtual
  channel

Doc covers:

- Layered structure (drivers → fusion → app)
- Interface driver contract (is_available, addresses, connect, health,
  send, recv_iter)
- Per-transport health vector (RTT EMA, success rate, budget, jitter)
- Routing policy by traffic class (control_critical, control_routine,
  data, discovery, outsider)
- Scenario matrix (TS-logout, TS-comeback, gh rate-limit, network
  partition, outsider, all-down)
- 5-phase implementation plan (loopback+LAN → +TS → +health/routing →
  gh-as-control-only → Reticulum slot-in)
- Pairs explicit with vuln-A (prompt injection), #412 daemon takeover,
  #414/#407 rediscover, #415 KEEP gist
- 6 open questions for design ratification before code

Companion to issue #417 (which holds the same content as the discussion
surface). The repo doc is the durable artifact; the issue is the
conversation lane.

Co-authored-by: Claude Opus 4.7 (1M context) <[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