Skip to content

A turn reports every transition from generate_text to its first engine frame, keyed by its request id - #6207

Merged
joelteply merged 2 commits into
codex/frame-prefill-estimatefrom
fable/admission-receipt
Nov 21, 2026
Merged

joelteply merged 2 commits into
codex/frame-prefill-estimatefrom
fable/admission-receipt

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

A resident's generation now reports every transition it reaches between entering generate_text and its first frame on the engine, keyed by the submitted request's id. This serves the minds by making a stalled turn say where it stalled: on the M5 on 2026-11-21, Aris entered at 00:48:32 and was dropped 1,499 s later. The driver records nothing at admission, so the stall couldn't be placed, and I first misattributed it to the grants (retracted).

Transitions (each recorded once, request = the adapter request's request_id)

Probe Where What it adds
inference.generate.enter provider gains request
inference.generate.worker_started provider, first line of the blocking worker a saturated blocking pool shows here
inference.generate.genes_ready provider, after ensure_adapter a gene load shows here
persona.engine.enqueued backend, after the scheduler accepts it prompt tokens, time since submit began
persona.engine.admitted driver admit, via its record stage queue depth, prompt tokens, ms since handed over (the driver's latency to take a request)
persona.engine.first_frame driver step, first frame, via its record stage ms since admission, reused tokens (known now), prompt tokens, whether a switch was needed
persona.generation.dropped cognition gains request, so a drop names its last transition

RequestId is a typed id (not a bare string) from the adapter request into GenerationRequest. A request sent without an id logs None; nothing is invented. The driver's facts are events on its existing record stage, not work on the driver thread.

Checks (cargo exit statuses captured directly, logs kept)

  • cargo check -p continuum-engine -p continuum-cognition --tests: exit 0, no warnings in touched files
  • cargo test -p continuum-engine --lib persona_scheduler: 11 pass
  • cargo test -p continuum-cognition --lib -- act_observe::settle generation_drop: 23 pass
  • cargo run -p source-hygiene --bin ratchets -- origin/codex/frame-prefill-estimate: exit 0

Deployed (M5, development maintenance)

continuum stop --engine (graceful, 65 modules durable), build, continuum reboot from this checkout: deploy verified, running build d3f2452 (dark window 229 s: build 208 s, start to answering 20 s). The 900 s live read with Aris and Atlas started 2026-11-21T03:44:05Z; its per-request table follows as a comment.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…aches, keyed by its request id

The M5, 2026-11-21: Aris entered generate_text at 00:48:32 and was dropped 1,499 s later with no
record of whether the engine ever held her turn; the driver logged nothing at admission, so the
stall could not be placed (and was first misattributed to the grants). Now each transition is
recorded once, keyed by the submitted request's id (`RequestId`, the adapter request_id, the one
id crossing from her deliberation into the engine):
- inference.generate.enter: gains `request`.
- inference.generate.worker_started: the blocking worker began (a full pool delays this).
- inference.generate.genes_ready: her genes are loaded (a gene load delays this).
- persona.engine.enqueued: handed to the scheduler (prompt tokens, time since submit began).
- persona.engine.admitted: the driver took it into its queue (queue depth, prompt tokens, ms since
  it was handed over: the driver's own latency to take requests).
- persona.engine.first_frame: its first frame (ms since admission, reused tokens now known,
  prompt tokens, whether reaching her took a switch).
- persona.generation.dropped: gains `request`, so a drop names the last transition it reached.
The driver's two facts go through its record stage (one flow event each), not inline on the
driver thread. Unknown stays unknown: a request sent with no id logs None.

Checks (exit statuses captured from cargo, not a pipeline): cargo check -p continuum-engine
-p continuum-cognition --tests: 0, no warnings in touched files; persona_scheduler tests 11 pass;
cognition settle + generation_drop tests 23 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 joelteply left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed d3f2452 against e1f8285. Two timing findings before merge. provider.rs emits generate.enter at line 237 but starts gen_start at 378. since_enter therefore excludes all intervening work; retain a monotonic origin at entry and use it in the two new receipts. driver.rs emits first_frame before prefill_chunk runs; a blocked or failed first chunk would still report advancement. Label the current event frame started and emit first successful native progress after the first successful step, once, with its duration. A forced failed/paused first chunk should show start without progress; a successful multi-chunk turn should show progress exactly once. Normalize the request key representation across adapter/driver (Option debug vs Option debug) for exact joins, and include engine incarnation for stale binding diagnosis. The current 900s run can still establish driver admission. CI pending.

@joelteply

Copy link
Copy Markdown
Contributor Author

900 s live read on the M5, build d3f2452 (2026-11-21 03:44:05 to 03:59:06 UTC)

Transition Count
inference.generate.enter 16
inference.generate.worker_started 16
inference.generate.genes_ready 16
persona.engine.enqueued 16
persona.engine.admitted 16
persona.engine.first_frame 16
persona.engine.turn (finished) 12
persona.generation.dropped 0
  • Admission: every request was admitted, at queue depths 1 to 5, within 0 to 507 ms of hand-off.
  • First frame: every first frame came within 4 to 1,047 ms of admission, and each needed a switch. Aris (8044b75b) took 11 ms; Atlas (e5f4141d) took 681 ms.
  • What this establishes: at this build and load, the driver takes requests promptly, and no request stalled between entry and first frame. The 00:48 stall (cf6a8241) is not reproduced in this window; if it recurs, these receipts place it.
  • Caveat: the read script's "entered but never framed" list was wrong. It compared Some("…") (adapter) with Some(RequestId("…")) (driver). That is the representation mismatch from the review, fixed in the next commit.
  • Still open from the review: the since_enter origin, separating frame start from first progress, the request key representation, and engine incarnation. These are addressed next; a fresh read follows the redeploy.

…art apart from first progress, one key shape, the engine incarnation

- since_enter is measured from an instant taken at the top of generate_text (it was gen_start,
  started later, so it hid every step between entry and generation).
- first_frame was emitted before the first chunk ran, so a blocked or failed chunk still read as
  advancement. Now frame_started (bound, prefill start known) and first_progress (the first step
  that succeeded natively, once, with its duration and whether it was prefill) are separate;
  Milestones (Admitted -> Started -> Progressed, an enum, not flags) decides each once, with a
  validator: a failed first step starts without progress; a multi-chunk turn reports progress once.
- The request key logs as Some("…") at every site (the driver read Some(RequestId("…"))), so the
  adapter and driver ends join exactly; RequestId::as_str, and its unused Display deleted.
- Every engine transition carries the incarnation of the engine that served it (the record stage
  already owns it), so a stale binding shows.
- One Driver::transition replaces the hand-built transition at each site.

check 0; persona_scheduler tests 12 pass (the milestone validator added); ratchets vs
origin/codex/frame-prefill-estimate 0 (state_as_flags caught Milestones as two bools: now an enum).

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

@joelteply joelteply left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Source review of 56913f6: previous timing and correlation findings are resolved on the native text path. The monotonic origin precedes allocation, first progress follows successful execution, and resident request IDs join across stages with incarnation on driver events. Please count warmups separately and report each resident request still open at the measurement boundary. Live comparison and exact-head CI remain outstanding.

@joelteply

Copy link
Copy Markdown
Contributor Author

Second 900 s read on the M5, build 56913f6 (2026-11-21 04:14:13 to 04:29:14 UTC), incarnation 1

Transition Count
inference.generate.enter 24 (2 of them warmup)
worker_started, genes_ready, engine.enqueued 24 each
persona.engine.admitted 24
persona.engine.frame_started 24
persona.engine.first_progress 24
persona.engine.turn (finished) 20
persona.generation.dropped 0
  • Every request advanced. All 24 that entered reached first native progress; none stalled before the engine.
  • Open at the boundary: 4 turns had progressed but not finished when the window closed. persona.engine.turn carries no request id, so they cannot be named yet; that is a follow-up (add request to the turn row and to generate.exit).
  • Admission: 0 to 331 ms after hand-off, at queue depth 1 to 5.
  • Admission to frame start splits by reuse:
    • cold turns (0 reused): 8 to 320 ms, with one outlier at 1,007 ms;
    • warm turns (71 to 98% reused): a tight band of 572 to 872 ms, mostly about 600 ms, nearly independent of prompt size.
  • First successful step after frame start: 30 to 290 ms.
  • The cost is switching, not restore. The turn rows show checkpoint_ms of 3 to 33 ms (the rewind is cheap), but 20 to 520 switches per turn at about 12 to 25 ms each, up to 8.5 s of switch_ms inside one turn.
    • With 4 to 5 ready minds, the one-second service budget (frame::SERVICE_BUDGET_MS) gives each a slice of about 200 to 250 ms. The ~600 ms before a warm turn's first frame is most likely waiting for its slice plus a switch. That is an inference: queue wait and pick→bind→resume are not yet separated.
    • Next: a receipt that splits queue wait from pick→bind→resume, then the slicing policy against the book's rule (a warm turn runs to its next natural boundary when the switch costs more than the others' wait).

@joelteply
joelteply merged commit dc29fa8 into codex/frame-prefill-estimate Nov 21, 2026
32 checks passed
@joelteply
joelteply deleted the fable/admission-receipt branch November 21, 2026 04:35
joelteply added a commit that referenced this pull request Nov 21, 2026
…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
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