Repository navigation
fix(cognition): preserve workspace scope in retained result projection - #5108
Merged
Merged
Conversation
joelteply
marked this pull request as ready for review
October 16, 2026 13:18
joelteply
added a commit
that referenced
this pull request
Oct 19, 2026
… to the CPU, places its draft, and one mind's results ring stops flipping its prefix - Metal lanes set GGML_METAL_TENSOR_ENABLE (our engine build makes the tensor API opt-in), decided in the Metal arm of the backend verdict. Measured M5 Pro 10-19, same binary and 5,490-token prompt, interleaved: prefill 1,163/1,153 -> 2,185/1,478 tok/s, identical output. Fusion / graph-optimize: no gain, left off. - A hung --list-devices probe REFUSES a GPU lane instead of appending --n-gpu-layers 0 (a 27B lane served on the CPU at ~130 tok/s prefill, 5.7 decode). constrain_to_cpu and BackendVerdict::ProbeHung are deleted. - --spec-draft-ngl is told, never left to the engine's auto fit. - Results ring: every result is perceived from every workspace, labelled with its own (one workspace_label owner for body, pointer and evicted pointer); the in-flight action is excluded by sequence, not root. Restored KV pages read cold (cached 0 of 24,670 / 29,999) because the ring appeared and vanished with the root (#5108). evicted_pointer_scopes deleted (write-only after this change). - file_size baseline 158,255 -> 158,240. Cards 9b9f3b59, 3c9fda87. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
that referenced
this pull request
Oct 20, 2026
…laces its draft, and one mind's results ring stops flipping its prefix (#5209) * fix(serving): a lane's need is the budgeter's floor, never the post-fit size the window let it grow to The M5, 2026-10-18 22:15-22:42Z: four residents on ONE slot (13% reuse, 600 s lane waits, 12-25 min acts) while the plan wanted two lanes: Allocator { served: 1, window: 48,661, lane_cap: 2 }. The need was the median post-fit size of held turns; the flexbox grows every prompt into the window it is given, so on a 102k lane the need read ~48.6k and a second lane at ~46k was refused. The need tracked the window, and the window the need. window_allocator::turn_need sums the turn's budget claims' FLOORS (framing + tools, required input, grounding floor, her last move and its outcome, the reply floor): what she cannot do without. The allocator still grows each lane toward the wish; it now serves two lanes when memory holds two windows above that floor (Joel: two residents per lane, never smaller windows to seat more). The faculty calls it once and nets -1 line. Tests: window_allocator, llm_deliberation_faculty and working_set suites: 158 passed, 0 failed (M5, background QoS). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(serving): the need carries the reply's UNCLIPPED floor (Cormac on #5177) The reply floor is clamped to what this window leaves after framing and required input; summing the clamped value under-reports her reply exactly when the lane is too small, so the allocator would believe the small window suffices (IntelMac's 32k lanes). The need now adds the pre-clamp floor. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(cognition): a ring result collapsed to its pointer stays collapsed, and collapse goes all at once Measured on the M5 (prompt captures, 104 consecutive act pairs, six residents, 2026-10-18): in 46% of the re-prefilled characters the first changed byte was a ring result rewritten to its pointer, or back. fit_messages collapsed oldest-first until the history fit this act's budget, which swings with the newest result's size: a result collapsed on one act came back whole on the next, and the frontier crept through the middle of the ring, re-prefilling all behind it. Now a collapsed result stays collapsed while it is in the ring (per-resident set, pruned to the pointers offered), and a forced collapse takes every collapsible result in one rewrite, so the acts after it append. Bodies stay reachable by handle. The test that pinned re-expansion as a 'projection' now pins the sticky rule, then clears the set to keep its refit check intact. Tests: llm_deliberation_faculty + working_memory 142 passed, 0 failed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * refactor(cognition): sticky ring collapse gets its own owner, cognition/ring_collapse.rs (Cormac on #5175) StickyCollapse::apply holds the rule and its receipt; fit_messages keeps one call. The faculty file nets -1 line (the ratchet). Unit test in ring_collapse.rs pins all-at-once, sticky across a roomy act, a new result riding whole at the frontier, and the set pruned to what the ring offers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * test(ring_collapse): compute the budget before the mutable borrow (E0503) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(serving): the M5 lane uses the GPU matrix units, never falls back to the CPU, places its draft, and one mind's results ring stops flipping its prefix - Metal lanes set GGML_METAL_TENSOR_ENABLE (our engine build makes the tensor API opt-in), decided in the Metal arm of the backend verdict. Measured M5 Pro 10-19, same binary and 5,490-token prompt, interleaved: prefill 1,163/1,153 -> 2,185/1,478 tok/s, identical output. Fusion / graph-optimize: no gain, left off. - A hung --list-devices probe REFUSES a GPU lane instead of appending --n-gpu-layers 0 (a 27B lane served on the CPU at ~130 tok/s prefill, 5.7 decode). constrain_to_cpu and BackendVerdict::ProbeHung are deleted. - --spec-draft-ngl is told, never left to the engine's auto fit. - Results ring: every result is perceived from every workspace, labelled with its own (one workspace_label owner for body, pointer and evicted pointer); the in-flight action is excluded by sequence, not root. Restored KV pages read cold (cached 0 of 24,670 / 29,999) because the ring appeared and vanished with the root (#5108). evicted_pointer_scopes deleted (write-only after this change). - file_size baseline 158,255 -> 158,240. Cards 9b9f3b59, 3c9fda87. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * chore(hygiene): file_size baseline 157,412 -> 157,397 measured at the rebased head Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Switching a persona from workspace A to B hid A's receipt entries, but still injected A's retained result bodies and expansion pointers into B's prompt. The active full-result accessor also ignored workspace scope, allowing native results to fall back to foreign-workspace prose.
Record workspace attribution alongside existing result custody and apply the existing entry-scope visibility rule to both historical and active results. Hidden results and spill handles remain retained and reappear on return. Additive checkpoint fields preserve old tuple formats; absent legacy attribution remains unknown rather than inferred from room or current workspace.
Existing regressions now cover A/B/return visibility after bounded-entry eviction, pointer collapse, checkpoint round trip, legacy snapshots, and restoration of the exact native call/result pair. Rustfmt parser and diff checks pass; hosted compilation/tests pending. No live persona state or native learning files changed. This does not guarantee reduced prompt size for legacy unattributed history, nor establish the sole cause of investigation loops.
AIRC card: c4761617-9bae-4acc-b3ef-fd2033be7336.