Repository navigation
compaction-basic: a session fed periodic user prompts grows its checkpoint every fold until the summary hits maxTokens (no length budget in COMPACTION_INSTRUCTION) #10059
Replies: 1 comment 2 replies
|
Your source reading is right on every point I checked against Confirmed: no length budget exists, and two rules push the other way
And the prior checkpoint is not special-cased anywhere in the next span — it is an ordinary message, exactly as you traced. So the growth is not a model quirk on this session; it is what the instruction asks for. Two sessions on the same model diverge only because one of them has something that repeats. Your observation 1 — the repeat is structural, and it is the second report of this gapYou are right that a
The consequence is what you measured: the retry does not spin inside one step, it relocates to the next step, and nothing counts it there. The only attempt accounting in the module is This is the second independent report of that same absence: #9888 covered the case where a compaction succeeds but does not fit, so the loop ran inside one step; your report covers the case where the summary fails at the cap, so it runs across steps. A cross-step attempt bound on the pressure path would address both, and it is the piece that is missing rather than the recovery hook. Your suggestion 4 has one hard constraint worth naming"A default recovery for Your suggestion 3 is cheap and I would put it firstAgreed, and the event is the natural place: the carried checkpoint's size is computable exactly where the input is built, so it can ride on On the workaroundThe Identifying the carried checkpoint by If you do add the real-session numbers, the ratio worth reporting alongside them is the one you already implied: what fraction of the freed tokens each fold spends carrying the previous checkpoint. That is the number that says whether a budget is the fix or whether the carry itself needs to shrink. |
Uh oh!
There was an error while loading. Please reload this page.
Version:
@deepseek-ai/dsh-compaction-basic0.2.0-rc.2. The same instruction is on master at 687f282 (packages/compaction/compaction-basic/src/summarizer.ts:32-67).Model:
deepseek/deepseek-v4.1-flashvia OpenRouter. Window 262144, policymaxTokens40960.What happens
One long-running session receives a short automated user prompt every few minutes, a reminder listing due items, on top of its normal work. Each compaction's checkpoint ends up larger than the last, until the summary call hits
maxTokens. From then on, a large share of compactions fail closed (finishError→MAX_TOKENS). The session keeps its full context and the pre-step tries again on the next step.Measured over that session's 378 successful folds (outputTokens of
compaction/summary):## Primary Request and Intentis 56,009 of 117,031 chars (48 %), up 29x in 12 days, against 6x for the whole checkpoint.Critical Contextgrew 9.6x andPending Jobs7.7x. The technical sections stayed roughly flat; the model does condense those.Why (from the source)
COMPACTION_INSTRUCTION(rc.2lib/index.js:243-278) has no length budget. Two of its rules pull against condensation for this kind of session:<compacted-summary>must not be copied verbatim, but tells the model to "preserve still-true facts". A standing reminder is always still true, so every one of them is kept, fold after fold.The prior checkpoint is an ordinary message in the next span (
buildSummarizationInput,:695-704), so whatever the last summary kept is input to the next one, and there is no upper bound on it. The instruction is a module constant, so a deployment cannot add a budget through config.maxTokensonly moves the point where the call fails. Raising it lets the checkpoint keep growing, and each fold then spends more of what it frees on carrying the previous checkpoint: here, about a quarter of the 83-126k tokens freed per fold.Two smaller observations from the same failures:
compaction/summary-errorwaterfall returns false (:1013-1022), so the same range is summarised again on the next step, with the same input and the same outcome. The README documents the recovery hook, but with nothing mounted there, the failure repeats until the turn ends.compaction/summaryevent recordsusage, but not the size of the prior checkpoint that went in. Spotting this growth meant decompressing session stores and diffing successive summaries.Suggestions
maxTokens, plus a rule that each section is bounded, not only "condensed".compaction/summaryevent.MAX_TOKENS, such as retrying over a smaller span or with a tighter budget, rather than repeating the identical request.Workaround that works on rc.2
An
llm/streamlistener that acts only whenoptions.purpose === "compaction". It mutatesoptions.messagesin place, since the waterfall'snext()takes no arguments andadapterStreamreadsoptionsat dispatch time. It:The checkpoint is identified by
frameSummary's framing, not by the tag text, because a user can paste the tag. On a stub-backed home, a carried 25,466-char checkpoint went out at 1,632 chars, and every summary call carried the budget. It is not yet measured on the real session; I will add those numbers here.Found and verified against the installed 0.2.0-rc.2 source and master 687f282 with the help of an AI coding agent.
All reactions