Skip to content

server: GET /engine/steps on the shipping line (#119 ported); the loop copies typed fields into a preallocated ring, no JSON on the loop - #132

Open
joelteply wants to merge 1 commit into
codex/s4-per-mind-integrationfrom
fable/engine-steps-s4
Open

joelteply wants to merge 1 commit into
codex/s4-per-mind-integrationfrom
fable/engine-steps-s4

Conversation

@joelteply

Copy link
Copy Markdown

#119 ported onto codex/s4-per-mind-integration. It is the producer half of continuum ggml-org#6055, whose core reader is ggml-org#6059, and the per-step measurement the live read of every speed change needs.

Fixed while porting

#119 built nlohmann::json trees and a std::map on the task loop every step a subscriber was attached. Now:

  • No JSON on the loop: the ring is typed records, allocated once at subscribe with room for every slot. A step copies fields into the next record, with no allocation.
  • No per-step map: counts are a vector indexed by slot id, and the buffers are reused.
  • Formatting at the edge: SSE text is built on the HTTP reader's thread. The frames are unchanged, so feat: add jina v2 support ggml-org/llama.cpp#6059 needs no change.

Receipt (qwen35-0.8b, M5, 2026-11-16)

  • A 24-token completion: opened, then 24 began and 24 ended, 0 missed. All 49 frames parse.
  • A second subscriber is refused, and capacity 0 is refused.
  • 0 warnings.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…k loop copies typed fields into a preallocated ring, no JSON on the loop

#119 (fable/engine-steps, against the old pin branch) carried onto codex/s4-per-mind-integration (one
include conflict: both kept). While porting, its capture built nlohmann::json trees and a std::map on
the task loop every step a subscriber was attached; Joel's rule is no serde on a hot path. Now:
- server-engine-steps.h is a fixed ring of typed records (began: chosen task ids; ended: each slot's
  work), allocated once when the subscriber opens it, with inline room for every slot; a step copies
  fields into the next free record (no allocation, no JSON); a full ring counts its loss and publishes it
  in position as one `missed` record, as before;
- the per-slot token counts are a vector indexed by slot id, the step's buffers live on the context and
  are reused (no per-step map or array allocation);
- the SSE text is formatted at the edge, on the HTTP reader's thread (next_frame); the frames are the
  same as before (kind, at_us, step, chosen / work with task, depth, prefilled, decoded, accepted_draft,
  seq), so the core reader (continuum ggml-org#6059) is unchanged.

Receipt (qwen35-0.8b, M5, 2026-11-16): a 24-token completion with a subscriber: "opened", then 24 began
and 24 ended records, 0 missed, all 49 frames parse as JSON; a second subscriber is refused ("another
subscriber holds the engine-step stream"); capacity 0 is refused. 0 warnings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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