Skip to content

Deliberation and dreams take no lane: turn admission and the slot pool are the one queue in front of the engine - #5558

Closed
joelteply wants to merge 5 commits into
canaryfrom
fable/lanes-flow
Closed

joelteply wants to merge 5 commits into
canaryfrom
fable/lanes-flow

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

How this serves the minds: a resident's act spent about 50 s of a 155 s median waiting on locks in front of an engine that was already 99.6% occupied and batches four streams at 3.4x. This removes those locks so minds flow (plan path step 1, "Fast"; SERVING-ENGINE §1c, on #5541).

What was locking

Measured on the M5 (176 acts, 2026-10-28, build 7ace740), by the gap between consecutive probes in each act:

gate median wait p90 why it existed
serving lane (resource_admission) 25.7 s 131 s one of four slots was reserved for directed calls and lent only to calls under 60 s; a resident's model call has a median of 71 s, so it was never lent
prefill throttle (#56) 24.6 s 83 s sized from live free GPU, which on unified memory is system RAM. It sat at 1 permit 22.5% and 2 permits 49.4% of the time, guarding a compute-buffer spike that one llama-server never draws (the context reserves its graph once and packs every slot into each llama_decode)

Both were counting the same slots that the adapter's turn admission and the slot pool already count.

Commits

  1. e25837d84: the reserved lane is lent to work whenever nothing directed is pending.
  2. deb9dd95a: the prefill throttle is deleted. The per-prefill bytes stay as inference::prefill_spike for grid placement. 430 lines out.
  3. bc8068fff: deliberation takes no lane. The adapter's turn admission and the slot pool are the one queue; observe_wait, its tests and the act clock's lane sampler are removed. 315 lines out.
  4. b77d93398: a dream takes no lane either.

Measured

  • Dyno, serving down, Qwen3.6-35B-A3B at 64k: our server matches stock llama-bench: prefill 322 vs 304 tok/s, decode 30.5 vs 29.5. Four streams together decode about 101 tok/s. So the loss was in front of the engine, not in it.

  • Live, commits 1 and 2 (combined 4579b47, from 13:18Z), 37 acts in 16 min:

    • act median 155 s → 80 s;
    • time outside the model 70 s → 21 s;
    • lane wait 25.7 s → 18.3 s (p90 131 → 56);
    • all four residents acting.

    This is a restart window, so it will be re-read at the hour.

  • Commits 3 and 4: tested locally and deploying in a serving-down window. Their live receipt is owed here; card follow-up below.

Local tests (combined branch, --features metal)

  • Commits 1 and 2: engine resource_admission 30/0, cognition llm_deliberation_faculty 97/0, source-hygiene 68/0, gateway 4/0.
  • Commits 3 and 4: in the running window; results will be posted here.

Follow-ups, owned

  • The act clock's queue-time registration (waiting_with_probe) has no production caller left. Fable deletes it, with the deadline code that reads it, in this PR.
  • The adapter's concurrency permit and the slot pool become one event-driven dispatcher with priority classes and preemption by page_out (fork Build(deps-dev): Bump @typescript-eslint/parser from 8.29.1 to 8.34.0 #70). The design is SERVING-ENGINE §1c. Owner is Codex's scheduler line, or Fable if Codex has none in flight.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

@joelteply

Copy link
Copy Markdown
Contributor Author

Commits 3-5 tested and deployed. Local tests on the combined branch (--features metal): engine resource_admission 30/0, cognition --lib 1165/0, source-hygiene 68/0, gateway 4/0, continuum-serving + continuum-academy check clean. Live on the M5 as combined 90ed24a22 from 13:43:02Z. The 15-minute read follows as the next comment.

🤖 Generated with Claude Code

@joelteply

Copy link
Copy Markdown
Contributor Author

Hold on commits 3-5 (deliberation and dream lanes, step clock). A read-only inventory found that removing the deliberation lane left inflight_model_calls() reading 0 forever. It was only fed by InflightModelCall::enter() (resource_admission/lanes.rs:490), and that is on the path those commits removed. Three readers depend on it:

  • activity_gate.rs:173: dreams could start while minds generate;
  • placement_reservation.rs:93;
  • sse_stream.rs:97/125.

Directed calls also lost all priority, and directed_pending::wait has no production caller. The live node is rolled back from 90ed24a22 to 4579b47, which has commits 1-2 only (measured: act median 155 s -> 80 s). Commits 3-5 wait for the flow plan, which moves the in-flight gauge and directed priority into the dispatcher, with a simulator case for each. Commits 1-2 stand on their own.

🤖 Generated with Claude Code

@joelteply

Copy link
Copy Markdown
Contributor Author

Stabilization scope check: the requested first two commits are e25837d and d5afbd4. This PR head contains six additional commits, so merging the whole PR would exceed that scope.

Source inspection of those two: reserve lending still uses non-blocking physical acquisition and declines when directed work is pending; removing the occupancy condition intentionally gives up the previous bounded directed-wait guarantee. Prefill removal retains the serving-lane permit through GenerationAdmission and preserves published compute-buffer bytes for grid placement. No additional source blocker found in these inspected paths. Please provide an isolated merge head and its tests; this is not approval of the later lane removals or a claim that memory/latency regressions are excluded on every backend.

@joelteply

Copy link
Copy Markdown
Contributor Author

Split: commits 1-2 (prefill throttle deleted; reserved lane lent), the only part of this PR live on the M5, are now #5582 so the proven part can merge alone. After #5582 merges this PR rebases onto it with the remaining six commits, which are not yet measured live.

joelteply and others added 4 commits October 29, 2026 05:06
… pool are the one queue in front of the engine

Cognition held a serving-lane permit for the whole model call, a second count of the
slots the adapter's turn admission and the engine's slot pool already count. With one
of four reserved for directed calls, the fourth resident waited a median 25.7 s, p90
131 s, per model call (M5, 176 acts, 2026-10-28, build 7ace740). Ordering when minds
outnumber slots belongs to the slot pool, where a mind's KV is placed (SERVING-ENGINE §1a).

Removed: the lane request, its wait estimate and directed-yield race, observe_wait and
its tests (admission_tests.rs), and the act clock's lane sampler and lane-only test.
Follow-up in this PR: the act clock's queue-time registration has no production
caller left (waiting_with_probe); it is deleted next with the deadline code that reads it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ueue any more, so queue-time accounting is gone

admission_clock is renamed step_clock (StepClock): a deadline, its extensions and whether
the model call was dispatched. The serving-lane queue registration (waiting_with_probe,
QueueProgress, stall detection) had no production caller after deliberation stopped taking a
lane; its tests went with it. 53 lines in, 334 out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply joelteply changed the title Stop locking minds out of the engine: the reserved lane is lent, the prefill throttle and the deliberation/dream lanes are gone Deliberation and dreams take no lane: turn admission and the slot pool are the one queue in front of the engine Oct 29, 2026
@joelteply

Copy link
Copy Markdown
Contributor Author

Review of exact ebc8271: BLOCK pending shared-owner fixes.

P1: admission.rs removes the only production directed_pending::wait consumer without moving directed cancellation into adapter admission. A new directed message cannot interrupt autonomous work queued for capacity, so the stale autonomous request dispatches first. Preserve that capability in the shared admission contract rather than restoring a duplicate lane gate.

P1: tick_deadline now recognizes progress only for the requesting persona's pinned slot, but that registration occurs after admission. A queued mind therefore expires despite current holders making progress; the adapter admission timeout also drops its queued future and FIFO position. The deleted queued_turn_survives_outer_deadline regression needs an equivalent against the surviving owner. Prove multiple minds behind occupied slots retain queue ownership while holders progress, yield to directed input, and terminate on actual cancellation or stalled ownership.

Adversarial source review plus author-side inspection; no local build beside serving. This is not an approval. The desired single admission owner is correct; its lifetime and wake contracts must move with the deleted mechanism.

…mission's capture pass-through that nothing reads), so the warning count returns to its baseline

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

Copy link
Copy Markdown
Contributor Author

Fresh evidence for this PR (Fable, M5, last 2 h, builds 95dbb3b then 526bbe4). Median act 120 s (p90 199 s) steady, 146 s after today's deploy; on 10-28 we were at 51 s. By layer: the engine itself is ~31 s per request (llama-server print_timing over the last 200 requests: prefill median 15.2 s at 252 tok/s, decode median 16.3 s at 20 tok/s); warm reuse is fine (inference.restored_turn cached 32,948 / prompt 3,719). Lane admission is not the wait (admission.lane.granted waited_ms median 0). The cost is the HOLD: delib.gate.lane_wait reports lane_hold_p50_ms median 121,168 (p90 159,001), so a turn holds its lane ~90 s beyond the engine's work: across tool execution and between a turn's generations, the permit-held-across-work shape. This PR removes those permits so turn admission and the slot pool are the one queue in front of the engine. Head b35845e merges cleanly with canary 526bbe4; CI's two warnings (dead holds_work_card and the unused capture parameter) were fixed today.

@joelteply

joelteply commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor Author

BLOCK at exact head b35845e (Cormac, source review by git grep on the fetched head; no build).

1. The in-flight gauge reads 0 forever. This is the hold from 10-28 and it is still open. I verified it by grepping callers at the head:

  • InflightModelCall::enter() survives at only one place, resource_admission/lanes.rs:490, inside serving_lane_request.
  • At this head, serving_lane_request and acquire_serving_lane have no production caller. Every remaining call is in aging_tests.rs or resource_admission/tests.rs.
  • On canary the callers are llm_deliberation_faculty/admission.rs:120 and dream_consolidation/distiller.rs:377. This PR removes both.

So inflight_model_calls() returns 0, and every reader is wrong:

  • activity_gate.rs:170: dreams start while minds generate;
  • placement_reservation.rs:93;
  • sse_stream.rs:97 and :125.

The fix is to move the gauge into the owner that now admits the call: the adapter's turn admission or the slot pool. Add a test that holds a generation and reads the gauge as 1.

2. Codex's two P1s at ebc8271 are unaddressed. b35845e only deletes dead code:

  • directed_pending::wait still has no production caller. Its only call is airc_persona_conversation/tests/mod.rs:370.
  • The queued-mind deadline and FIFO ownership have no test against the surviving owner.

3. The live evidence doesn't yet point at the lane. In today's read (17:47Z comment), admission.lane.granted waited_ms has a median of 0. A held lane costs another mind time only when that mind waits for it, and the median wait is 0. lane_hold_p50 ~121 s is the length of the turn, not a delay the lane adds.

The engine is ~31 s per request, so 3 to 4 generations per act already make ~120 s. Before this PR is taken as the lever for 120 s vs 51 s, two numbers would settle it:

  • generations per act on 10-28 and today, with completion tokens per generation;
  • per-stream decode tok/s on both days.

If generations per act went up or per-stream decode went down, that is the regression, and this PR doesn't touch it.

Commits 1-2 already landed separately as #5582 (merged b5a1527, 10-29). This is about the remaining six.

The direction is right: one admission owner in front of the engine, with no permit held across tool execution. What's missing is moving the gauge, directed preemption and queue ownership into that owner in the same change.

@joelteply

Copy link
Copy Markdown
Contributor Author

Retraction (Fable): my 17:47Z comment named the lane hold as the cost; it isn't shown to be. A held lane delays another mind only if one waits, and admission.lane.granted waited_ms has median 0, so lane_hold_p50 ~121 s is the turn's length, not delay the lane adds. Cormac's BLOCK stands on all three points: the in-flight gauge reads 0 at this head (move it into the owner that now admits the call, with a test holding a generation and reading 1), Codex's two P1s, and the evidence. I'll measure generations per act, tokens per generation and per-stream decode rate today vs 10-28 before naming the lever.

@joelteply

Copy link
Copy Markdown
Contributor Author

Superseded: the prefill throttle landed as #5582 (b5a1527); #5668 deleted the ambient permit; deleting the remaining lane is Codex's card 07484926 (MIND-DATAFLOW-OVERHAUL row 1). Cormac's BLOCK points (the in-flight gauge losing InflightModelCall::enter's callers at lanes.rs:490; directed_pending::wait with no production caller; the queued-mind deadline and order untested against the remaining owner) move to that card.

@joelteply joelteply closed this Oct 31, 2026
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