Repository navigation
The Core runs a turn to its end: no slicing; prefill at full batch; the slicing machinery deleted - #6208
Conversation
…on't cut it up, run single lane; context switching is faster") The frame policy gave every ready turn a slice of a one-second service budget, so a turn in progress was cut into frames shared with every other ready mind. Measured on the M5 (56913f6, 2026-11-21 04:14-04:29 UTC): 20 to 520 switches per turn at 12 to 25 ms each, up to 8.5 s of switch_ms inside one turn, and warm turns waiting ~600 ms for a slice before their first frame. Now the bound mind's started turn (prefilling or decoding) keeps the Core until it ends. When none is in progress, the next is the least remaining work discounted by wait (a long wait still comes forward; no mind starves), a tie keeping the bound mind. Each prefill chunk is the engine's full batch, bounded only by her checkpoint boundary. Deleted: SERVICE_BUDGET_MS and share_ms; the bound-time input to pick; Driver::bound_since; Driver::prefill_sample and its two updates; the `ready` count threaded through pick, step and prefill_chunk; Candidate::decoding (now `started`). driver.rs 941 -> 928 lines. The 2026-11-18 reason for slicing (short tails waiting 300-360 s behind cold prefills) is named in frame.rs; the 11-21 read shows 71-98% reuse on most turns. Whether a cold prompt still needs its own handling is measured on deploy, not assumed. check 0; persona_scheduler tests 12 pass (pick test rewritten for the new rule); ratchets vs origin/codex/frame-prefill-estimate 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ir transitions by identity (Codex on #6207: terminal rows lacked it) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Run to end vs slicing, M5, two 900 s windows
Per resident under run to end (no starvation; each is served regularly):
Open at the boundary: three requests entered in the window's last 20 s and were admitted (one had first progress). None was a long-queued wait. Reading:
|
joelteply
left a comment
There was a problem hiding this comment.
P1 at frame::pick: the no-starvation claim fails across completed turns. Example at each boundary: an old unbound 84000-token candidate and a new bound 1-token tail that waited 1 ms. Integer cost for the short tail is zero; even when the old candidate eventually reaches zero the active tie-break still selects the short tail. A backlog of short turns from the bound resident can repeat indefinitely. Protect aged demand at turn boundaries with the existing queue age/order, preserving run-to-end within a turn. Add a repeated-arrivals regression covering this tie. The 900s trial showed all four served, but cannot prove starvation freedom; 36s median and 193s max admission-to-progress remain material for interactive use. Also avoid recomputing all candidates on every decode when an active started turn already determines the pick.
…literals #6207 missed compile - persona.engine.refused: a turn that ends without an answer (refused, failed, or a caller that hung up) now writes a terminal transition with its typed reason and time since admission; it wrote only a warning before, so it vanished from the receipts (independent review of #6179, finding 6). Every admitted turn ends in exactly one of this or persona.engine.turn. - core/continuum-core/tests/{qwen35_chat_pipeline_full,llamacpp_metal_throughput}.rs: four TurnPrompt literals lacked #6207's `request` field, so those (ignored) test targets did not compile; CI's lib-test jobs never built them, and I had checked only the engine and cognition crates (finding 1, my miss). cargo check -p continuum-engine -p continuum-core --tests: 0; persona_scheduler tests 12 pass; ratchets vs origin/codex/frame-prefill-estimate: 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
left a comment
There was a problem hiding this comment.
At ce8a894 the new refusal receipt covers driver.step errors, but suspend still drains every admitted turn and sends only Emit::End(Error). A graceful stop with one active and one queued request therefore leaves both missing from terminal accounting. The holding branch also returns on a closed submission channel while turns can still exist. Centralize admitted-turn termination across those paths, drain the record stage before shutdown acknowledgement, and replay stop with two admitted request IDs. Verify each ID joins exactly one terminal result, including the retained-state reason.
…osed, each with exactly one terminal record; a stop is acknowledged after its records are written Codex on ce8a894: a graceful stop drained admitted turns with only an Emit error, and the closed-submission path returned with turns still admitted: both left no terminal record. - driver/ending.rs (new): `Ending` (Answered, Refused(TurnError), Stopping, Closed) and `Driver::end`, the one place an admitted turn leaves the engine: it writes the turn row (answered) or persona.engine.refused with the reason, releases a one-off, and tells the caller. The loop's answer and error arms, the stop's drain and the closed channel all go through it. - A stop is handed back from `take` (`Stop`) and acknowledged by the loop only after `settle_records`: both outboxes drained, then a record-stage `Barrier` answered (FIFO), so its last records are written before the acknowledgement. The closed path settles them too. - `Advanced::Done` carries exactly an answer (`tokens_generated`, `elapsed_ms`) instead of any TokenEvent; the turn row moved from `step` into `end`. - driver.rs: 1008 -> 942 lines after the split (the 1,000-line gate). check -p continuum-engine --tests 0; check -p continuum-core --tests 0; persona_scheduler tests 12 pass; ratchets vs origin/codex/frame-prefill-estimate 0. Live stop replay follows on the PR. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
left a comment
There was a problem hiding this comment.
8e597e1 now routes drained turns through Driver::end. Stop acknowledgement still returns the successful native suspend result when the record barrier sender has disappeared: settle_records logs records_unsettled and returns (), then acknowledge calls report(stop.reply, stop.suspended). Preserve the successful native snapshot while separately reporting the unconfirmed terminal records to the lifecycle caller. Test closing the record stage before barrier ACK; the caller must distinguish it from confirmed completion. Also test a stalled Emit sink with queued output: settle_records joins emit.drain with record.drain before observing the record ACK. Verify stop can finish independently of that caller. Prior boundary fairness finding remains open.
…en; a stalled caller never holds it Codex on 8e597e1: (1) a record stage that ended before answering the barrier still yielded a fully settled acknowledgement; (2) settle_records joined Emit's drain, so a caller that stopped reading her answer held the whole stop. - `settle` (driver/ending.rs), a function of the two outboxes: Emit is flushed but never awaited; the record outbox is drained, then the barrier awaited; a record stage that ended reads `Records::Unconfirmed` (probe persona.engine.records_unconfirmed). - `Suspended` carries `records: Records`. The suspend now returns `Suspension` (what it did natively); the acknowledgement assembles `Suspended` with the records outcome, so no placeholder is written and overwritten. The stop's custody report keeps its state (records are telemetry, never custody) and appends "the records of the turns it ended were not confirmed written" when so. - Tests (driver/ending_tests.rs, real flow stages): records read Written only when the record stage confirms them, Unconfirmed when it ended first; a stalled Emit sink with queued output never holds the settle, and its output is left for its caller. Mutation-checked: forcing Written fails the first. check -p continuum-engine -p continuum-core --tests 0; persona_scheduler tests 14 pass; ratchets 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Live stop replay, M5, build 67abfaa (2026-11-21 05:49:01 to the stop at 05:53:02 UTC)Residents ran for 4 minutes. I recorded which admitted request ids had no terminal record yet, then ran a graceful
|
joelteply
left a comment
There was a problem hiding this comment.
Reviewed 67abfaa: settle drains the record queue and waits for its FIFO barrier; an unread answer cannot hold the stop. Closed record stage yields Unconfirmed independently of native custody. The two focused tests and M5 replay resolve my shutdown findings. Fairness at turn boundaries and interactive head-of-line latency remain open, so this is acceptance of shutdown behavior only.
…ically as her live turn (Joel, 2026-11-21: "Replay should be as realistic as regular mode") cognition/replay-request gave every replay a fresh persona id, so the engine served it as a stranger with nothing cached: every replayed turn was a cold prefill, unlike live turns that reuse 71-98% of their prompt (the M5 windows of 2026-11-21). - `identity`: `isolated` (the default, unchanged: a fresh mind, cold) or `resident` (the source persona's own mind, so her parked blocks are reused exactly as her next live turn would reuse them). - The engine's identity and the capture's owner are now separate: the capture is always owned by a fresh replay identity, so a replay never enters her prompt history or her learning, whichever mind served it. - The result names the identity it was served as. - A resident replay interleaving with her live loop is safe (one serial queue per mind; reuse is checked against the actual prompt) but spoils a measurement, so a measuring run holds and despawns her first. No cross-layer hosting check (cognition must not import mind). The validator (request_replay tests) extends the isolation test: a resident replay is served as her own mind and its capture is still owned by a separate replay identity. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ckpoint a stop saves from it), never her memory, history or learning (Codex on 6505cb4) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…efaulted field, not an Option - persona.engine.decode_refused (continuum-persona-llama unified_tier): when llama_decode refuses a step, the probe records the step (from, tokens), the context geometry (n_ctx, n_ctx_seq, n_seq_max, n_batch, n_ubatch) and every execution stream's occupant and highest position. The M5, 2026-11-21: cold 26-36k resident replays were refused "no KV slot" (llama_decode returned 1) about 31 s into prefill, and the source alone cannot tell other streams' cells, full-batch chunks or fragmentation apart (Codex's request: measure before inferring a cause). Its first dependency on continuum-base (the floor) and tracing. - ReplayRequestParams::identity is `ReplayIdentity` with a serde default (absent = isolated) instead of `Option` + unwrap_or_default at two sites (the unwrap ratchet). check -p continuum-persona-llama -p continuum-engine -p continuum-cognition --tests 0; request_replay tests pass; persona-llama builds with metal; ratchets vs origin/fable/run-to-end 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…e numbers The M5, 2026-11-21 (persona.engine.decode_refused, e61b5cf): a 26,633-token resident replay was admitted to a 24,576-token stream (n_ctx 49,152 / n_seq_max 2), prefilled for ~31 s, and refused by the engine at the chunk that crossed the end (from 22,623 + 2,048 tokens). The engine spent the work and then failed; the object model's Core answers Infeasible when a need exceeds its cap. - admission.rs (new): `StreamCapacity` (the applied geometry's n_ctx_seq) admits a prompt only with room for one generated token, else `Infeasible { prompt_tokens, capacity }` (typed, with Display). - The driver holds its `StreamCapacity` from the geometry it applied, checks every turn at `admit`, tells the caller with the numbers, and records persona.engine.infeasible keyed by the request id. A refused turn was never admitted, so it has no other transition. - Live deliberation already fits prompts to the published n_ctx_seq (delib.turn.demand context_window=24576 tonight); this guards every caller that does not fit its own: replays, and external drivers. persona_scheduler tests 15 pass (the admission validator added); check engine + core tests 0; ratchets vs origin/fable/run-to-end 0; driver.rs 953 lines. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Replay as realistic as live (identity=resident); refused decodes say what the engine held; the Core refuses an oversized prompt at the door
…, no "written" the log never confirmed Codex's full review at 162fbe5, each finding with a validator that fails on the old code: - P1 frame.rs: the cost was integer division, so an aged and a fresh one-token tail both cost zero and affinity won every tie; a bound mind that kept arriving starved an older one. Costs now compare exactly (cross-multiplied); an equal cost goes to the longer wait; only a full tie keeps the bound mind. Validator: repeated arrivals of the bound mind, the older mind served on its first round. - P2 driver.rs + ending.rs: when every submission handle dropped, the loop flushed Emit once and dropped what a full Emit still held with the driver, answer ends included. `Driver::close` ends every turn, settles records, and hands Emit to a drain owner on the stage runtime (`hand_off`), in order; the engine thread never waits on Emit and the stop acknowledgement stays independent. Validator: a saturated Emit stage, its outbox handed off, all eight outputs in order. - P2 record.rs / probe_file_sink.rs: `Records::Written` confirmed only that the tracing callbacks returned, and the sink dropped write/flush errors. The probe floor now owns one count of failed probe-log writes (continuum-base `probe_writes`), the sink counts each line it cannot write, and a settle reads `Records::Processed { write_failures }` since the previous settle; durability is never claimed. Validator: a sink on a disk that refuses writes counts the failure; a settle reports a failure counted in its window, once. Touched files leave clean: the probe sink's unbounded single-file `new` had no production caller (boot rolls) and is deleted, its 12 tests move to the rolling constructor; its serialization names its disk boundary; `DEFAULT_MAX_LOG_FILES` is now the appender's `KEEP` (8, what the broker's rotation pool budgets), not a second count of 7. engine persona_scheduler 18 pass, kernel probe_file_sink 16, base probe_writes 1; mutation of the tie order and of the hand-off each fails its validator; check engine/kernel/core tests 0; ratchets vs origin/codex/frame-prefill-estimate 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ded off reach their callers Codex on 8f386fb: `Driver::close` hands a full Emit outbox to its drain owner, then the driver thread called `StageWorker::stop()` on both stages before that task necessarily ran, so the ends it had not yet pushed came back `Stopped` and were dropped. A stage already ends by itself once its last producer is gone and it has handled what it took, and after `run` returns the only producers left are the driver's (dropped) and the drain owner's (dropped when drained), so the thread now waits on `driver::finish`, which joins both stages and never stops them. Startup failures and early returns drop their inputs too, so the join always returns. Validator: a full Emit handed off, then `finish` exactly as the thread runs it: all eight ends reach the caller in order. Mutating `finish` to stop before joining fails it. persona_scheduler 19 pass; check engine + core tests 0; ratchets vs origin/codex/frame-prefill-estimate 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
The Core runs a resident's turn to its end instead of cutting it into slices shared with every ready mind. Joel, 2026-11-21: "you don't cut it up, run single lane; context switching is faster." This serves the minds by giving each turn the whole engine for its duration and cutting the switches that were adding up to 8.5 s inside one turn.
Why (measured on the M5, build 56913f6, 2026-11-21 04:14-04:29 UTC, via #6207's receipts)
Restoring a mind is cheap (
checkpoint_ms3 to 33 ms). The cost was the one-second service budget slicing each turn among 4 to 5 ready minds.What changes
frame::pick: the bound mind's started turn (prefilling or decoding) keeps the Core until it ends. With none in progress, the next is the least remaining work discounted by wait, so a long wait still comes forward; a tie keeps the bound mind.persona.engine.turncarriesrequest, so completions join their transitions by identity (Codex's note on A turn reports every transition from generate_text to its first engine frame, keyed by its request id #6207).Deleted
SERVICE_BUDGET_MS,share_ms, the bound-time input topick,Driver::bound_since,Driver::prefill_sampleand its two updates, thereadycount threaded throughpick,stepandprefill_chunk, andCandidate::decoding(nowstarted).driver.rsgoes from 941 to 928 lines.Risk, named
Slicing was added after the M5 on 2026-11-18, when short tails waited 300 to 360 s behind cold prefills. The 11-21 read shows 71 to 98% reuse on most turns. Whether a cold prompt still needs its own handling is measured on the deploy below, not assumed.
Checks (cargo exit statuses captured directly)
cargo check -p continuum-engine --tests: exit 0cargo test -p continuum-engine --lib persona_scheduler: 12 pass (the pick test rewritten for the new rule)origin/codex/frame-prefill-estimate: exit 0Deployed
M5, deploy verified, running ad41267 (dark window 197 s). The comparison read for 04:44:45 to 04:59:45 UTC follows as a comment.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo