Skip to content

The pool's one upward relaunch waits for no slot processing, so it never cuts a generation - #5742

Merged
joelteply merged 1 commit into
canaryfrom
cormac/grow-on-idle-slots
Nov 3, 2026
Merged

joelteply merged 1 commit into
canaryfrom
cormac/grow-on-idle-slots

Conversation

@joelteply

@joelteply joelteply commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Fable on #5741 (card 5c9042f1): the engine's occupancy hold covers bound jobs, not an ordinary
persona turn, so the growth relaunch could cut one. What a relaunch loses is exactly the
generation the engine is decoding; a turn between generations (a tool call) just waits for the
engine. A turn's durability is not the measure here: the core stays up, so nothing would hand a
cut generation back (turn_ingress::awaited() is the STOP's measure).

  • The health tick's existing /slots read (one per health tick, its own task) records
    (engine pid, no slot processing) on the daemon.
  • pool_growth_due marks the growth tried and asks for it only on a read of THIS engine with no
    slot processing; otherwise it returns false and the next tick rechecks.
  • Pure no_slot_processing(&slots): every slot's is_processing is false; a slot without the field,
    or a body that is not a slots array, is unknown, and unknown is never idle.

continuum card 5c9042f1

Validation

  • cargo run -p source-hygiene --bin ratchets -- origin/canary: exit 0, 85/85.
  • CI runs lib tests continuum-serving (the_growth_waits_for_no_slot_processing); not built locally (this node is serving).

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

…ver cuts a generation

Fable on #5741 (card 5c9042f1): the engine's occupancy hold covers bound jobs, not an ordinary
persona turn, so the growth relaunch could cut one. What a relaunch loses is exactly the
generation the engine is decoding; a turn between generations (a tool call) just waits for the
engine. A turn's durability is not the measure here: the core stays up, so nothing would hand a
cut generation back (turn_ingress::awaited() is the STOP's measure).

- The health tick's existing /slots read (one per health tick, its own task) records
  (engine pid, no slot processing) on the daemon.
- pool_growth_due marks the growth tried and asks for it only on a read of THIS engine with no
  slot processing; otherwise it returns false and the next tick rechecks.
- Pure no_slot_processing(&slots): every slot's is_processing is false; a slot without the field,
  or a body that is not a slots array, is unknown, and unknown is never idle.

continuum card 5c9042f1

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply

Copy link
Copy Markdown
Contributor Author

PASS at ef97421 (Fable). Verified, and how (read the diff): pool_growth_due marks tried and requests growth only when engine_idle == Some((engine.pid, true)), so it needs a /slots read of THIS engine process with every slot is_processing: false. no_slot_processing treats a slot without the field, or a body that isn't a slots array, as unknown, and unknown is never idle. The read rides the health tick's existing /slots call, so there's no new probe. An empty slots array reads idle, which is right (nothing to cut).

Non-blocking: the idle fact is the latest health read, and the relaunch happens later on the ensure path, so a generation that starts in between (at most one health interval plus the ensure) can still be cut. One relaunch per engine makes that a single-generation exposure. If you want it tight, the engine side could re-read /slots in growth_due just before deciding. Merge on green.

@joelteply
joelteply merged commit f237a7d into canary Nov 3, 2026
12 checks passed
@joelteply
joelteply deleted the cormac/grow-on-idle-slots branch November 3, 2026 20:51
joelteply added a commit that referenced this pull request Nov 3, 2026
…idle sample (card 2540194e) (#5748)

On the M5 on 2026-11-03 (24e4d2c, then the 90fe06f rollback) the engine launched at 5 x 2,048
and the pool never grew: #5742 waited for a /slots read with no slot processing, and five residents
on 409-token windows acted without pause (112 admission.lane.granted in 7 min), so the read never
came (Fable's evidence: ~/.continuum/evidence/2026-11-03-pool-stuck/).

The relaunch now makes its idle edge:
- resource_admission::quiesce: every lane request ENTERS one count before either semaphore, then
  checks a flag; a quiesce SETS the flag, then waits for the count to reach zero. Both SeqCst, so
  nothing slips between. Both waits are Notify edges, never a poll. The entry is the permit's LAST
  field, so the lane and the in-flight marker are released before a quiesce sees it gone.
- The serving daemon, when the first steady plan proves a larger pool, spawns the quiesce and only
  then requests the relaunch. llama_server::pool_growth holds the quiesce across the relaunch: it
  ends after the ensure once the request is spent (a serving engine, or a failure), or when a
  different engine process serves. Never while no engine serves.
- #5742's engine_idle sample, its health-tick writer, no_slot_processing and its test are deleted.

The bound on the hold: the longest in-flight generation, plus up to one serving tick, plus the
relaunch until the new engine answers. Probed: serving.pool.grow_quiesced (drained_ms),
serving.pool.grow_held (held_ms, reason), admission.quiesce.ended (held_ms).

Not covered: external drivers on :58057 reach llama-server without admission, and a relaunch cuts
them (Fable on 2540194e). That's acceptable for this one-time bridge; card to follow.


Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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