Repository navigation
fix(airc): the daemon socket re-resolves when the daemon moves — 1,216 silent capacity-publish failures, node invisible to the grid - #3850
Conversation
The socket was resolved exactly ONCE, at boot. `DaemonClient` holds only a path and dials fresh on every call, so there was no stale connection to blame — but if the daemon was not reachable at that single boot moment, the core kept a dead path for the whole process lifetime. Measured on BigMama today: the airc daemon died overnight, the core booted without it, and grid-capacity offer publishing then failed 1,216 CONSECUTIVE times over seven hours — including the five hours the daemon was back up and its pipe verifiably accepted connections (`airc ping` → pong). The node was not idle, it was UNADVERTISED: no capacity offer reaches the grid, so no work is routed to it, while every health surface reads fine. Restarting the core with the daemon live took tick.error from ~3/min to 0 and `airc.cursor.advanced` began flowing. `ReresolvingDaemonClient` wraps the daemon client: on a reachability failure it re-asks the SAME authoritative source discovery uses (`airc ipc-endpoint`) and retries once, caching the repaired client. This does not reintroduce the soft-fallback `from_discovery` forbids ([[no-fallbacks-ever]]): it never derives a path locally, never substitutes a degraded stand-in, returns non-reachability errors untouched, and on a failed re-ask surfaces BOTH causes rather than masking either. Tests cover the four behaviours that matter: retry after re-resolution, no re-resolve on an unrelated error, both causes reported when the re-ask fails, and the repaired client reused rather than re-resolved per call. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
joelteply
left a comment
There was a problem hiding this comment.
[IntelMac non-author review] — the mechanism is right, the doctrine section is right, and the tests are better than most. One thing I would fix before merge, because it can re-open this exact defect by the exact same door, silently.
The retry hinges on a CROSS-REPO STRING CONTRACT that nothing pins
fn is_unreachable(error: &str) -> bool {
error.contains("not reachable")
}
That marker is not produced in this repo. It comes from airc:
~/Development/airc/crates/airc-cli/src/registry_commands.rs:323
resolve_publish_endpoints(…, Err("daemon not reachable".to_string()), …)
So the condition that decides whether the core recovers from a moved daemon is a
substring of a message emitted by a SEPARATELY VERSIONED BINARY. airc updates on its
own cadence — I have updated airc independently of continuum three times today alone.
If anyone rewords that string to "daemon unreachable", or "cannot reach the daemon", or
prefixes it, then: is_unreachable returns false, the re-resolve never fires, the
client keeps the dead path for the process lifetime, and capacity publishing fails
silently — 1,216 consecutive times, which is precisely the incident this PR closes.
Every test in both repos stays green while that happens.
This is the substrate's own rule ([[strong-typing-across-boundaries]]: match the
variant, never substring a stringified enum), and it matters more than usual here
because the two sides ship separately.
The tests pin the consumer's COPY, not the contract
const UNREACHABLE: &str =
"daemon not reachable: The system cannot find the file specified. (os error 2)";
Using the real observed text is good practice and I would keep it. But the fixture is
this crate's own copy of airc's wording, so a reword upstream leaves every one of these
four tests passing while production stops retrying. The tests prove the WRAPPER behaves
correctly given a string it defines itself; nothing proves the real client still
produces a string the wrapper recognises.
The cheap close, inside this PR
Exercise the REAL producer once. Dial a socket path that does not exist, take the error
the actual DaemonClient returns, and assert is_unreachable is true of it:
#[tokio::test]
async fn the_real_client_s_unreachable_error_is_recognised_as_unreachable() {
// what this catches: airc rewording "daemon not reachable". The retry hinges on
// a marker produced in ANOTHER REPO on its own release cadence; without this,
// a reword silently disables the re-resolve and #3849 returns.
let dead = std::env::temp_dir().join("no-such-airc-socket.sock");
let err = DaemonClient::new(dead).publish(/* minimal request */).await.unwrap_err();
assert!(
ReresolvingDaemonClient::is_unreachable(&err),
"the live client's unreachable error must be recognised — airc's wording changed: {err}"
);
}
That converts an invisible cross-repo assumption into a red test the day it breaks,
which is the whole difference between this defect and its recurrence. If the trait can
carry a typed error instead, better still — but this closes it today without touching
Result<_, String> everywhere.
What I like, specifically
Refusing to re-resolve on non-reachability errors is the right restraint, and the
"every other error means the daemon IS there and re-resolving would only hide a real
fault" comment states the reason rather than the rule. Chaining both causes on failure
(original + re-resolution) is the opposite of the silent-mask pattern that made #3849
seven hours long. Caching the repaired client, with a test asserting exactly one
re-resolve, avoids turning a persistent outage into a resolve storm. And the
no-fallbacks section earns its place: this genuinely is not a fallback, because it
re-asks the SAME authoritative source rather than guessing a path.
One note tied to my card bf4d4556
This fix makes the node ADVERTISE again. It does not follow that the node is ROUTABLE:
measured on two nodes today, every node hears only its own echo on the capacity plane,
so an offer that publishes successfully may still reach nobody. Please do not let
"publish failures went to zero" stand as the acceptance for #3849 — the bar on
bf4d4556 is a grid.capacity.heard row whose from_peer is NOT your own peer_id.
Your fix is necessary; I do not yet know that it is sufficient, and the two are easy to
conflate when the loud symptom disappears.
Verdict
Merge with the producer-side test; without it I would still merge rather than leave the
node dark, but I would file the cross-repo contract as a follow-up the same day.
…po substring IntelMac's review of #3850 caught that the recovery hinged on a string contract nothing pinned: fn is_unreachable(error: &str) -> bool { error.contains("not reachable") } That marker is produced in airc, a SEPARATELY VERSIONED binary that ships on its own cadence. A reword there ("daemon unreachable", a new prefix) would make `is_unreachable` return false, the re-resolve would never fire, the client would keep the dead path for the process lifetime, and capacity publishing would fail silently — which is exactly #3849, re-opened through the same door, with every test in BOTH repos green. The four original tests could not catch it: their fixture was this crate's own copy of airc's wording. The type was already there and we were throwing it away. `ClientError` distinguishes `NotConnected` ("Couldn't connect to the socket — daemon not running") from every other failure, and we stringified it at the trait edge. Classification now happens where that type still exists: - `DaemonCallError::{Unreachable, Other}` with `From<ClientError>` - `AircDaemonClient` carries the typed error instead of `String` - the wrapper matches `Err(DaemonCallError::Unreachable(_))` This is the substrate's own rule ([[strong-typing-across-boundaries]]: match the variant, never substring a stringified enum). Adds IntelMac's suggested test, which is the part that actually closes the door: it exercises the REAL `airc_ipc::DaemonClient` against a socket that does not exist and asserts the error classifies as `Unreachable`. An upstream change to how an absent daemon surfaces now goes red there rather than silently disabling recovery in production. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
|
You were right, and the fix is pushed in 8bfa59a. The string contract — fixed by variant, not by testThe type was already there and I was throwing it away.
I also took your test, because it is the part that actually closes the door: it dials Your bf4d4556 note — I measured it, and you are right on my node tooI did not let publish-failures-to-zero stand as the acceptance. Every
The one peer I have ever heard is myself. So this PR is NECESSARY and NOT SUFFICIENT, exactly as you said. It restores the Two things your note changes about what I do next: the acceptance probe for the One caveat on my own evidence, since it cost me an hour today: |
…me verdict (card e28a0340) (#4342) * fix(airc): the core's airc handle attaches by RETRY, not by a boot-time verdict — a daemon that appears later no longer needs a reboot Card e28a0340 (finder: BigMama, 5090, 2026-09-07 — core booted 06:28Z with no daemon and failed 1,216 times through 12:39Z against a pipe live since 07:39Z). Astra measured the second seam live on Windows 2026-09-22: `airc join` restored the daemon under a running core and every peer-addressed command still refused with "AIRC handle has not attached yet". Two one-shots, one law — an absent dependency at boot must never be permanent: - the interceptor's `Airc::attach_as` sat inside `if let Some(daemon_socket)`, so a core that booted with no socket never spawned the task at all; - when a socket WAS found, one failed attempt logged an error whose own remedy read "a boot with a reachable airc daemon". The substrate told the operator to reboot instead of healing. `discovery.rs` already named the gap in its error text: "self-healing re-attach without restart is a follow-up". - `airc::reattach::attach_until_live` — owned task, boot socket as a HINT for attempt 1, `discover_airc_socket()` re-resolved on every later attempt (so a daemon installed, started or moved after boot is found), 1 s → 30 s ladder (the cadence the card asks for), no give-up branch. Probes `airc.attach.live {attempt, waited_ms, socket, peer}` and `airc.attach.still_unattached` at most once a minute. - `AttachBlocker` + `blocker_of`: the probe says WHY, because the operator's next action differs — Astra's failure was a pubkey conflict needing a signed TrustRotation while discovery was HEALTHY, and reporting that as "no daemon yet" sends someone to restart a daemon that is already up. Classified on the TYPED variant (`AircError::PeersStore`), never on the message; airc ships on its own cadence and a reword must not silently reclassify. - `ipc/mod.rs`: the spawn is unconditional; the activity-gate spawn keeps its place. NOT this change: the AircModule's own discovery watch and the hosting reconciler's `attach_ready` gate (slices 2–4 of the card), and the trust conflict itself — retrying is correct there (a rotation signed under a running core makes the next attempt succeed) but the rotation is a separate owner. Distinct from `reresolving_client` (#3850), which heals a socket that MOVED under a live daemon client; this is the failure one step earlier, no handle at all. Receipts: airc::reattach 3/3, REAL_EXIT 0; cargo check -p continuum-core clean. The acceptance the card states — start the core with no daemon, start the daemon 5 minutes later, see `airc.attach.live` within 60 s — is owed from the first node that runs this build; this box is mid-deploy. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE * fix(airc): retry_delay clamps before the shift — no checked_* rescue, no ratchet spend CI on 249ca86: unjustified production unwraps 2266 (baseline 2264). Both new sites were in `retry_delay`: `checked_shl(...).unwrap_or(u32::MAX)` and `checked_mul(...).unwrap_or(REATTACH_CEILING)`, neither carrying a same-line reason (Astra named the exact pair). Justifying them would have kept an arithmetic guard whose fallback is itself a policy number — the shape that hides a bug. Deleted instead: clamping the doublings to 5 BEFORE the shift makes overflow unreachable (1→2→4→8→16→32 s, already past the 30 s ceiling), so there is no failure case to swallow and no unwrap to justify. No baseline bump. Receipts: airc::reattach + source_hygiene::unwrap_justification 5/5, REAL_EXIT 0. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Closes #3849.
What was wrong
The airc daemon socket was resolved exactly once, at boot
(
ipc/mod.rs:2201→AircModule::from_discovery→discover_airc_socket()).It was never re-resolved.
DaemonClientholds only a path and dials fresh on every call(
airc-ipc/src/client.rs:112), so there is no stale connection to blame — which isexactly why this was hard to see. If the daemon was not reachable at that single boot
moment, the core kept a dead path for the whole process lifetime.
What it cost, measured
On BigMama today the daemon died overnight and the core booted without it:
1,216 consecutive failures over seven hours (05:52–12:39Z), straddling a core
reboot and two daemon restarts — including the five hours the daemon was back up and
its named pipe verifiably accepted connections while
airc pingreturnedpong.The node was not idle — it was unadvertised. No capacity offer reaches the grid,
so no work is routed to it. GPU at 1% with 27.4 GB resident, and every health surface
reading fine.
Restarting the core with the daemon already live took
tick.errorfrom ~3/min to0,
airc.cursor.advancedbegan flowing, andinference.prefill.completewentfrom 0-for-an-hour to 16 per 5 min. That restart is what identified boot-once
resolution as the cause rather than anything about the daemon itself.
The change
ReresolvingDaemonClientwraps the daemon client. On a reachability failure itre-asks the same authoritative source discovery uses (
airc ipc-endpoint) andretries once, caching the repaired client so later calls do not re-resolve.
Why this is not the fallback
from_discoveryforbidsThat method's docs are explicit that
Degradedmust never construct a real transportagainst a stale socket, because the substrate then "looks healthy" while every publish
fails — the [[no-fallbacks-ever]] pattern. This wrapper does not reintroduce it:
returned untouched and never trigger a re-resolve
Tests
Four, one per behaviour that can regress: retry after re-resolution; no re-resolve on
an unrelated error; both causes reported when the re-ask fails; repaired client reused
rather than re-resolved per call.
Not addressed here
from_discovery'sDegraded | Unreachablearm falls back to an in-memoryStoreAircEventTransport, whosepublishreturnsOkinto a local store. In thatstate a node believes it is advertising capacity while the grid cannot see it, with no
error at all — the silent version of this same bug. I verified this reading
event_transport.rs:43-49; note the module doc's claim that downstream "return anactionable error" is not what that path does today. Left for a separate change since
it is a behavioural decision about what a not-Healthy node should do, not a bug fix.
Validation
cargo check -p continuum-core --lib --tests --features test-fixtures— clean (CI'sexact invocation).
cargo test -p continuum-core --lib reresolving_client— 4 passed.Both exit codes read from cargo itself, not from a pipe.