Skip to content

feat(serving): governor surfaces grid_overflow_lanes — recognize overload, place don't thrash (#234/#56) - #2050

Merged
joelteply merged 1 commit into
canaryfrom
fix/governor-grid-overflow-signal
Jul 27, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/governor-grid-overflow-signal

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

What

plan_serving now emits grid_overflow_lanes on ServingPlan — the count of persona lanes that DEMANDED serving but couldn't get a local lane (demand_lanes − lanes; the full demand on the fits_on_gpu=false degrade path). The honest "over local capacity by N" signal, instead of silently cramming N personas into the local lanes and thrashing.

Why (log-proven)

The serving-quality "2 tok/s" symptom is slot contention, not decode speed or cache size. From the live llama-server-58057.log:

  • prompts are stable (sim_best=1.0, f_keep=0.99 on warm hits), RAM prompt-cache never misses (cache-load failures=0);
  • but the server picks a slot by LRU 65% of the time (2 live slots < N personas), and every LRU pick forces the ~8s KV save+restore round-trip ("prompt cache update took 8235ms").

On one box this is the memory fixpoint (lanes × (KV+compute) ≤ budget; more lanes → per-slot window < ~9k prompt → overflow). MAX_LANES=2 is the settled-correct clamp and the system-wide admission ceiling (resource_admission), so it can't just be raised. The fix is the governor recognizing its overload and surfacing it for grid placement (Σdemand vs Σresource, one decision; single box = pool-of-one).

Scope

Additive only — no change to lanes / served_context_window. New field surfaced (never a silent clamp), ts-rs ServingPlan.ts binding regenerated. 21/21 serving_plan tests green, incl. new demand_over_local_capacity_surfaces_grid_overflow_not_silent_cram.

Next

The consumer (BigMama's AircRemoteInferenceAdapter, cross-grid dispatch #17) reads this signal and routes the N overflow lanes to a grid peer — that's where the ~20s→3s win lands. This PR is the producer half.

🤖 Generated with Claude Code

…load, place don't thrash (#234/#56)

The serving-quality "2 tok/s" bug is log-proven SLOT CONTENTION, not decode/cache-size:
2 live slots (--parallel 2) < N active personas → the server picks a slot by LRU 65%
of the time (vs 35% LCP; when it DOES hit a warm slot sim_best=1.0/f_keep=0.99 and
cache-load failures=0), and every LRU pick forces the ~8s KV save+restore round-trip
("prompt cache update took 8235ms"). On one box this is the memory fixpoint
(lanes × (KV+compute) ≤ budget; more lanes → per-slot window < the ~9k prompt →
--no-context-shift overflow); MAX_LANES=2 is the settled-correct clamp AND the
system-wide admission ceiling (resource_admission), so it can't simply be raised.

The good-governor fix is to RECOGNIZE the overload instead of silently cramming:
plan_serving now emits grid_overflow_lanes = demand_lanes − lanes (saturating; the
FULL demand on the fits_on_gpu=false degrade path). That is the honest "over local
capacity by N" signal the pooled governor routes to a grid peer — Σdemand vs Σresource,
one decision, a single box being the pool-of-one case. Demand is bounded by the actual
beings/workloads (one Asha), so pooled grid capacity easily absorbs it and the thrash
dissolves.

Additive only: no change to lanes/served_context_window; new field surfaced (never a
silent clamp), ts-rs ServingPlan.ts binding regenerated, 21 serving_plan tests green
incl. the new demand_over_local_capacity_surfaces_grid_overflow_not_silent_cram. The
grid-placement CONSUMER of this signal is the next slice.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply merged commit d5ddc36 into canary Jul 27, 2026
3 checks passed
@joelteply
joelteply deleted the fix/governor-grid-overflow-signal branch July 27, 2026 08:48
joelteply added a commit that referenced this pull request Jul 27, 2026
…Peer commands route

Completes the cross-grid dispatch seam end-to-end. The interceptor holds a
late-bind cell; this fills it. Where the daemon socket is in scope (alongside the
node-presence reader's own clone), create the `Arc<OnceCell<Arc<Airc>>>`, spawn a
task that `Airc::attach_as`es the interceptor's own handle (same daemon_socket +
continuum_root the citizens use) and sets the cell, and hand the SAME cell to
`AircInterceptor::with_airc_cell` at construction. Async attach never blocks the
boot critical path; until it lands, aircPeer commands fail loud (not silent).

With this, `Commands.execute("ai/generate", { aircPeer })` routes over airc to that
peer's continuum-core and returns the result — the grid-distribution lever live.
M5's merged grid_overflow_lanes producer (#2050) consumes it: overflow lanes →
aircPeer = select_grid_peer, so local overload transparently spills to a peer.

Validated: cargo check -p continuum-core --lib clean (0 errors).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
joelteply added a commit that referenced this pull request Jul 27, 2026
…ver airc to a peer (#2051)

* feat(runtime): wire AircInterceptor::try_route → AircLiveTransport (Commands.execute over airc)

The AircInterceptor was a deliberate stub: it discriminated params.aircPeer but
failed loud "transport not wired." This fills the transport body — the canonical
cross-grid primitive (Commands.execute(cmd, { aircPeer }) routes over airc to that
peer's continuum-core, returns the result), NOT a separately-registered adapter.
Mirrors GridInterceptor (the sibling that already does capability-based remote
routing) per the codebase's own pattern.

- Holds a LATE-BIND `Arc<OnceCell<Arc<Airc>>>`: the interceptor is built
  synchronously during executor construction while `Airc::attach_as` is async, so a
  spawned boot task fills the cell without blocking the boot critical path. Until
  filled, an aircPeer target fails loud (no silent fallthrough).
- `try_route(aircPeer)` for `ai/generate`: params → TextGenerationRequest →
  AircLiveTransport.send_request to the peer → response.text_response →
  CommandResult::json → Handled. AircLiveTransport (airc.request RPC) already exists;
  this is the "only the transport call body changes" the interceptor doc called out.
- Room-broadcast (aircRoom) + generic any-command routing are explicit fail-loud
  follow-ups (mirror grid dispatch_to_node), never silent gaps.
- `new()` keeps the empty-cell stub (tests + unwired call sites unchanged);
  `with_airc_cell(cell)` + `airc_cell()` are the production seam for the boot wire.

Validated: cargo check -p continuum-core --lib clean (0 errors). Next: ipc/mod.rs
boot wire (spawn attach_as → fill cell, swap new()→with_airc_cell at :2523) makes it
route end-to-end; then M5's governor consumes it (grid_overflow_lanes>0 → aircPeer).

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

* feat(ipc): boot wire — attach the AircInterceptor's Arc<Airc> so aircPeer commands route

Completes the cross-grid dispatch seam end-to-end. The interceptor holds a
late-bind cell; this fills it. Where the daemon socket is in scope (alongside the
node-presence reader's own clone), create the `Arc<OnceCell<Arc<Airc>>>`, spawn a
task that `Airc::attach_as`es the interceptor's own handle (same daemon_socket +
continuum_root the citizens use) and sets the cell, and hand the SAME cell to
`AircInterceptor::with_airc_cell` at construction. Async attach never blocks the
boot critical path; until it lands, aircPeer commands fail loud (not silent).

With this, `Commands.execute("ai/generate", { aircPeer })` routes over airc to that
peer's continuum-core and returns the result — the grid-distribution lever live.
M5's merged grid_overflow_lanes producer (#2050) consumes it: overflow lanes →
aircPeer = select_grid_peer, so local overload transparently spills to a peer.

Validated: cargo check -p continuum-core --lib clean (0 errors).

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

---------

Co-authored-by: Claude Opus 4.8 <[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