Repository navigation
server: a learning ledger read answers from the loop's last publication, never queued behind the chunk it reports on - #109
Merged
Conversation
…on, never queued behind the chunk it reports on The loop publishes its half of the ledger (grants, use, committed steps, the optimizer's memory) at every task and slot-update boundary, stamped with sequence and clock_us, under one mutex with a condvar signalled per publication (the wake a ticket wait will block on). GET /learn/grants answers from that publication plus the residency mirror (its own mutex) from the HTTP thread. Mutations stay loop tasks. Card 7fc7e2ce: on the IntelMac a 2,048-token prefill chunk ran ~40 s while the core waited 4 s, so every learner stop read as unreachable.
Author
|
Review (Fable): design right. Two fixes before merge: (1) |
…hanged; the fixture asserts the read beside a running completion server_learn_ledger::revision() is bumped by every mutation; on_update_slots publishes only when it moved (task boundaries and init still publish), so no ledger JSON or memory visit runs per decode batch. The fixture waits for /slots to report the completion processing, reads, and asserts the completion is still running (Fable on fork #109).
…hen it changed Each decode step posts a SERVER_TASK_TYPE_NEXT_RESPONSE task, so publishing at every task boundary still published per token (1,025 publications for a 512-token completion). A continuation now publishes only when the ledger revision moved; real tasks (requests, ledger and adapter operations) still publish at their boundary. Measured: 1 publication for a 512-token completion.
joelteply
changed the base branch from
cormac/learn-fixture
to
codex/s4-per-mind-integration
November 11, 2026 14:31
joelteply
merged commit Nov 11, 2026
cf49932
into
codex/s4-per-mind-integration
30 of 47 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Card 7fc7e2ce (continuum), part 1 of Fable's option (a): a control read never queues behind the work it controls.
Found on the IntelMac (canary dc01d9563 and ae5ba3173, 2026-11-11): the core's learner stop and grant revoke timed out whenever the engine was prefilling. The ledger ops are main-loop tasks (
grant_route,SERVER_TASK_TYPE_LEARN_GRANTS), the core waits 4 s, and one 2,048-token prefill chunk on that CPU took ~40-45 s./healthanswered in ~1 ms whileGET /learn/grantsdid not answer within 20 s.Change
on_new_task) and slot-update boundary (on_update_slots), and once at init, stamped withsequenceandclock_us, under one mutex with a condvar signalled per publication (the wake the ticket wait in part 2 blocks on). Same pattern as the existingpublish_lora_report/GET /lora-adapters.GET /learn/grantsanswers from that publication plus the residency mirror (its own mutex) on the HTTP thread.ledger_receipt(now)is the one builder for both the publication and a mutation's reply.Tested (IntelMac, CPU build, stories fixture model)
tests/learn-ledger-off-loop.py: a read carries the stamp and both halves; the sequence advances at a boundary; a grant registered through the loop is in the next read; a read answers while a completion is in flight. 3 back-to-back reads: 0.70-0.77 ms.sequence).learn-past-example,learn-cancel-custodypass (--no-repack).