Skip to content

continuum-service: the node notices its own slowdown (card 1c157668, slice 1: sample, baseline, detector) - #5477

Merged
joelteply merged 4 commits into
canaryfrom
fable/continuum-service
Oct 26, 2026
Merged

joelteply merged 4 commits into
canaryfrom
fable/continuum-service

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

This gives every node the means to notice when its own minds are being served slower than it can serve them, so a degraded engine stops costing residents hours unnoticed. Order-of-work line 2 (speed), card 1c157668 (self-healing), and the base Codex builds the planner's reaction on.

Why: on 2026-10-26 the M5's engine came back degraded from a Compute-error burst. For 3 h it ran 54 generations/h at a median of 174 s, on the same plan that served 118/h at 88 s after a clean restart. Nothing noticed until an agent read the prompt captures by hand.

What (a new pure crate, core/continuum-service, serde only, no I/O, no global state):

  • sample::ServiceSample (schema 1): node, model, builds, and a ServingConfig fingerprint covering lanes, ctx, cache, KV type, backend and expert residency. The config identity is kept separate from the EngineIncarnation (pid, start). The sample also carries the workload, offered demand and queue time, generations kept apart from citizen acts, failures, p50/p90, the node's rate-predicted p50, a Warm/WarmingUp/Unknown flag, and the memory ceiling.
  • baseline: one baseline per node, model, builds, configuration and workload stratum (fresh and output tokens in powers of two), across engine restarts. Separately, per node, model and builds, the healthy windows' observed/predicted ratios. These judge a configuration that has no history of its own, which is exactly the 10-26 case: the 2-lane plan was first seen degraded.
  • detect::observe(state, policy, sample) returns Healthy, Suspect, Regressed (with evidence and CauseHints: engine restarted since baseline, failures, queue grew, slower than its rates) or Insufficient.
    • Warm-up, unknown warm-up, mixed-incarnation windows and idle windows are never judged or learned.
    • A slow window never joins a baseline.
    • Every bound (history, min_evidence, sustained) is the caller's ServicePolicy; none is a constant here.
  • Known limit, stated in the code: a node degraded from its very first window on brand-new builds learns that as normal. A new configuration on known builds is covered by the prediction ratios.

Seam for Codex (planner reaction): the reaction consumes Regressed(Regression), which carries the key, what the window was judged against and its cause hints, together with the feasible actions and lifecycle readiness. It only proposes until stop-drain (920619c5) is proven. The feed comes in later slices: cognition's capture-completion path builds samples, serving publishes ServingConfig and EngineIncarnation (serving/status gains pid and started_ms), the predicted p50 comes from serving_rates and the contention dyno, and a replay validator runs over the M5's prompt captures.

Tests (6, cargo test -p continuum-service):

  • the 10-26 timeline replayed: a healthy 5-lane morning, the 2-lane plan first seen degraded (caught through the prediction ratios, slow windows never learned), then the clean restart reading healthy;
  • the same configuration slower after a restart (own history; the restart named);
  • warm-up, unknown, mixed and idle windows never judged or learned;
  • new builds start their own baseline instead of regressing;
  • a heavier workload gets its own stratum and is judged by prediction;
  • fingerprint stability.

Gates:

  • cargo test -p continuum-service: 6/6.
  • cargo clippy -p continuum-service --all-targets -- -D warnings: clean.
  • cargo test -p source-hygiene: 66/66.
  • ratchets origin/canary: exit 0, every row equal.
  • node --test tools/scripts/tests/ci-change-scope.test.cjs: 21/21. The test's two hand-kept "below the kernel" lists became one BELOW_KERNEL constant that includes continuum-service, which depends on nothing in the workspace.

The crate is about 630 lines including tests. No other crate is changed besides the workspace member line and Cargo.lock.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

joelteply added a commit that referenced this pull request Oct 26, 2026
…lls are their own verdict; predictions carry their calibration (Codex on #5477)

- A window that starts before the node's last one ended (duplicate, overlap, out of order) is
  refused before it is judged or learned (NotAfterLast).
- A slow streak counts only ADJACENT judged windows on one engine incarnation: a gap, a restart,
  or an ineligible window (warm-up, unknown, mixed, idle) ends it. The streak lives in the
  node's stream position, not in a baseline.
- Demand with zero completions is Verdict::Stalled, never NoDemand or healthy, never learned.
- Prediction { p50_ms, calibration }: ratios are compared only under one calibration, so a
  recalibrated predictor never reads as the engine changing.
Four fixtures, one per defect; 10/10.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Oct 26, 2026
…hout duration are refused (Codex on #5477)

- A window with end <= start is refused (EmptyWindow) before any state changes: a zero-length
  window at the last end no longer trains the baseline or grows a streak, and a reversed one
  no longer rewinds the stream.
- The streak is bound to its Comparison (BaselineKey, plus the predictor calibration when judged
  by ratios), not only node and incarnation: adjacent slow windows under different
  configurations, builds, models, strata or references are separate runs, never one sustained
  regression.
Two fixtures; 12/12, clippy clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply and others added 4 commits October 26, 2026 15:07
…slice 1: sample, baseline, detector)

Joel: "system should self recognize slowdown and figure it out." On 10-26 the M5's engine
came back degraded from a Compute-error burst and ran 3 h at 54 generations/h, median 174 s,
on the same plan that served 118/h at 88 s after a clean restart; nothing noticed.

A pure crate (serde only, no I/O, no global state; the caller owns ServiceState):
- ServiceSample (schema 1), keyed by node, model, builds, a ServingConfig fingerprint (lanes,
  ctx, cache, KV type, backend, expert residency) kept separate from the EngineIncarnation;
  workload, offered demand and queue time, generations vs citizen acts, failures, p50/p90,
  the node's rate-predicted p50, a Warm/WarmingUp/Unknown flag, the memory ceiling.
- A baseline per (node, model, builds, configuration, workload stratum by fresh and output
  tokens in powers of two), across engine restarts; per (node, model, builds), the healthy
  windows' observed/predicted ratios, which judge a configuration with no history of its own.
- observe(state, policy, sample) -> Healthy | Suspect | Regressed(evidence, cause hints) |
  Insufficient. Warm-up, unknown warm-up, mixed windows and idle windows are never judged
  or learned; a slow window never joins a baseline; every bound is the caller's policy.

Tests replay the 10-26 timeline (healthy 5-lane morning, the 2-lane plan first seen degraded,
the clean restart), a same-config slowdown after a restart, an upgrade, a heavier workload,
and fingerprint stability. The CI scope test names continuum-service among the crates a
kernel or host change cannot reach (it depends on nothing in the workspace).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…lls are their own verdict; predictions carry their calibration (Codex on #5477)

- A window that starts before the node's last one ended (duplicate, overlap, out of order) is
  refused before it is judged or learned (NotAfterLast).
- A slow streak counts only ADJACENT judged windows on one engine incarnation: a gap, a restart,
  or an ineligible window (warm-up, unknown, mixed, idle) ends it. The streak lives in the
  node's stream position, not in a baseline.
- Demand with zero completions is Verdict::Stalled, never NoDemand or healthy, never learned.
- Prediction { p50_ms, calibration }: ratios are compared only under one calibration, so a
  recalibrated predictor never reads as the engine changing.
Four fixtures, one per defect; 10/10.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…hout duration are refused (Codex on #5477)

- A window with end <= start is refused (EmptyWindow) before any state changes: a zero-length
  window at the last end no longer trains the baseline or grows a streak, and a reversed one
  no longer rewinds the stream.
- The streak is bound to its Comparison (BaselineKey, plus the predictor calibration when judged
  by ratios), not only node and incarnation: adjacent slow windows under different
  configurations, builds, models, strata or references are separate runs, never one sustained
  regression.
Two fixtures; 12/12, clippy clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the fable/continuum-service branch from 0d567ea to 42e7745 Compare October 26, 2026 20:07
@joelteply

Copy link
Copy Markdown
Contributor Author

Exact-head source PASS at 42e7745: independently compared core/continuum-service against reviewed 0d567ea; git diff is empty. Earlier six detector findings remain resolved. CI at this head is still pending, so merge remains subject to green gates. This approves the pure detector scope, not automatic restart actuation or S2-S4 custody.

@joelteply
joelteply merged commit 38f0ed7 into canary Oct 26, 2026
38 checks passed
@joelteply
joelteply deleted the fable/continuum-service branch October 26, 2026 20:16
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