feat(memory): plan-vs-actual — reconstruct a run's memory from the event stream and fail on drift (SKEEP-003 P2, S1.9) - #1074
Merged
Conversation
…ent stream and fail on drift (SKEEP-003 P2) Milestone M1 (#1002), PRD M1-F8 / M1-A8. A plan that drifts from reality is worse than no plan, so the comparison is a CI assertion rather than a report nobody reads. - ActualMemory.from(events | RecordingTraceSink): replays the allocation stream and tracks peak live bytes per scope, total churn, allocation counts per scope (a decode loop should add none in FORWARD after warm-up) and adapter bytes by kind (the #782 class, now countable). - PlanVsActual(plan, actual, tolerance = 10 %): compares the plan's resident sections with the peaks a run reached, renders the table (planned / actual / drift, marking violations), and check() throws with that table in the message when any line drifts beyond the tolerance — so a CI failure explains itself without a rerun. - PlanVsActualTest: a run that matches the plan passes; a run that allocates twice the plan fails with "+100 %" and a marked table; actuals are reconstructed correctly from the event stream (the forward slab is one allocation, its per-step views are slices, not allocations); adapter bytes are accounted and rendered; the tolerance is configurable. 13/13 plan tests. Closes #1030 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
|
Local gate Targeted: |
|
📖 Documentation Preview The documentation has been built successfully for this PR. Generated Files:
Artifacts:
This comment will be updated automatically when the PR is updated. |
This was referenced Aug 23, 2026
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.
Summary
SKEEP-003 slice S1.9 (milestone M1 #1002, PRD M1-F8 / M1-A8): the memory plan is compared with what a run actually allocated, and a drift beyond the tolerance fails — a plan that quietly diverges from reality is worse than no plan, so this is a CI assertion rather than a report nobody reads.
ActualMemory.from(events | RecordingTraceSink)replays the allocation stream and reconstructs: peak live bytes per scope, total churn, allocation counts per scope (a decode loop should add none inFORWARDafter warm-up — the M1-A3 signature), and adapter bytes by kind, so the GGUF DEQUANTIZE_TO_FP32 over-allocates: 1.1B Q4_K_M needs >12 GB heap transiently (~4.4 GB legit) #782 class is countable rather than anecdotal.PlanVsActual(plan, actual, tolerance = 10 %)compares the plan's resident sections with the peaks a run reached, renders a planned/actual/drift table marking violations, andcheck()throws with that table in the message — a CI failure explains itself without a rerun.Evidence (
PlanVsActualTest, 13/13 plan tests):check()is silent;+100 %and a marked table;adapters: 96 MB — dequantize 96 MB);This is the machinery M1-A8 needs; pointing it at the decode sample (once #1032 settles where that lives) closes M0-A1's Llama-1B number.
Test plan
Full local gate (
scripts/pr-gate.sh, JDK 25) — all legs passed; results in the first comment.Closes #1030
🤖 Generated with Claude Code