Repository navigation
Replies: 6 comments
Independent reproduction on 0.2.0-rc.2, and the measurement this report was missingI reproduced this on
1. The span does not collapse because compaction starts at the first non-system node — it collapses because the retain walk stops earlyThe span is for (let index = pricedNodes.length - 1; index >= 0; index -= 1) {
accumulated += pricedNodes[index]!.tokens
keepFromIdx = index
if (accumulated >= retainTokens) break
}The walk stops at the first node that pushes the retained tail over
The practical consequence is broader than "the checkpoint sits at the head": the degeneration reproduces whenever any single node inside the newest 2. Why a checkpoint fold cannot converge: the summarizer's output floor is ~its inputStep 4 of your report says "the summarizer rewrites that checkpoint into another checkpoint of the same size". That is measurable, and it is the reason no retry policy can help. Using the shipped A transcript of tool output and user text compresses well; a checkpoint does not, because the directive pins an eight-section structure that preserves exact paths, commands, error strings, signatures and verbatim quotes. The output has a floor, so replacing a checkpoint with a checkpoint removes ~2% and re-triggers immediately. This is also why the existing regression cannot catch it: 3. Net effect, and two things that hid itOver the 250 accepted folds: 2,919,790 shadowed tokens in, 3,038,786 out — the envelope grew by ~119,000 tokens, costing 2.98 M summarization prompt tokens and 3.04 M output tokens. In the 14:00–15:21 window alone: 557,032 in → 681,119 out, 44 folds, ~82 minutes.
4. What fixed it hereNot "never compact a checkpoint" — that strands the session the next time a genuine fold is needed — but three guards, since the checkpoint-only span is the extreme of a general rule (do not pay for a fold that cannot shrink; do not repeat one that did not):
With those, the same session shape stops spending after the first fruitless attempt, and compaction resumes by itself once new content makes the span worth folding. ~40 lines against the 5. Config detail relevant to #8079 / #8494 / #8733With the default |
|
Independent reproduction on DSH desktop 0.2.2-rc.3, same root cause as this thread, with a larger retry storm in one affected session:
Full sanitized report with environment, 0.2.2-rc.3 code references, suggested fixes and a minimal reproduction: Related: #12071 covers the non-compactable-overhead variant; this report is specifically the checkpoint re-summarization loop. The key ask: checkpoint-aware selection (skip or merge a single compact-checkpoint), failure no-op/cooldown instead of per-step retry, and a summary budget proportional to the shadowed span. |
补充:Windows 桌面端 + magpie 路由组的又一复现,以及本问题族的索引(2026-11-21 实测,独立复现;数据统计时点 2026-11-21,来自 5 个活跃会话) 我在本机(Windows 10.0.26300,DSH 桌面端 0.2.2 系,路由
失败绝大多数是 结论:与 #7212 主帖、omnisurge 11-14 评论、#11035、#4776 是同一根因—— 本问题族索引(同一根因:checkpoint 重摘要 + 无退避重试)为便于维护者与后来人,把散落在不同 discussion 的同一根因复现串起来。这些不是 8 个独立 bug,是同一个机制的不同环境复现:
共性问题(跨全部报告):
修复建议(omnisurge 已详述,此处不重复):checkpoint-aware selection + 失败 no-op/cooldown + 摘要预算按 span 比例 + per-model headroom + 回归测试。 给维护者的提问:这条机制自 2026-08-27(#4776)报告至今近 3 个月、跨 8 个独立复现(macOS/Windows/web/桌面、OpenRouter/本地/网关路由、96k–400k 窗口),#4776 的参考修复分支尚未合入上游。能否确认修复计划/排期? |
Additional data: heuristic pricing bias, and an oversized tool-call argument as the retain-walk stopSame mechanism on
One 28.5-min window: 14 completed compaction calls, 1,140 s (67% of wall clock), mean 81.4 s, 118,181 output tokens of summaries; per call 6,931-8,922 output tokens. Representative rejects: The same-step sequence shows the fold creating its own un-foldable candidate: seq 127-130 accepted, seq 131-134 accepted (second attempt of the same step), then from the next step on every attempt rejects Three things I did not see in this thread: 1.
|
| checkpoint text | estimateMessage() (text only) |
provider outputTokens |
ratio |
|---|---|---|---|
| 19,063 chars | 4,765 | 6,931 | 1.45x |
| 22,165 chars | 5,541 | 8,283 | 1.49x |
The framed count for the second one is 5,648 (frame adds ~107). This does not change the shrink verdict when both sides use the same ruler, but it does mean the absolute numbers in these reports understate real usage: a 62,464-token pressure reading is closer to ~93 K provider tokens for this content, and retainTokens / maxTokens are compared against a ruler that is ~1.5x low. Worth pinning down before tuning defaults for non-English sessions.
2. The node that stops the retain walk can be an assistant tool-call argument, not a tool result
In session A one write call carried 98,957 chars of file content in its arguments (~24.7 K heuristic tokens) - larger than retainTokens (20,480). The backward walk in selectCompactableRange stops there, so the retained tail is that unit plus recent steps and the only foldable head is the checkpoint. The tool-result pruner cannot help: it rewrites tool/result only, never assistant tool-call arguments. For coding agents that write large files inline, this is an ordinary and reproducible upstream of the degeneration, distinct from the injected-instructions block noted in the first comment and from pruner-able tool output.
3. Not fixed in the published newer builds
I diffed the published tarballs: 0.2.2-rc.5 and 0.2.3-alpha.3 still contain the same selectCompactableRange and the same for (attempt ... compactionRetries) loop, with unchanged defaults (65,536 / 0.16 / 1). Upgrading does not change this behavior.
Suggested scope addition: treat an oversized assistant tool-call argument as trimmable (offload written content to a file reference in the replayed surface), and add a regression case whose summarizer output scales with its input - a constant-size stub cannot catch this loop.
|
Thanks — points 2 and 3 both check out. One correction on point 1, because it would send tuning in a direction that cannot work. Point 3, confirmed beyond "unchanged". I diffed the published tarballs rather than reading the thread. In Worth adding: alpha.3 did change this package meaningfully — an Point 2, confirmed, and it is the most useful thing in this thread. The pruner only collects Point 1 — I believe the conclusion is inverted, and it matters. The two sides of the comparison are not the same ruler by design: surfaceTokens += node.heuristicTokens
return { seq: node.seq, tokens: node.heuristicTokens, heuristicTokens: node.heuristicTokens }For a CJK text session both sides are therefore uniformly 4 chars/token, which is exactly why What it does mean is that absolute readings are optimistic: a 62,464-token pressure reading is closer to ~93K provider tokens for that content, so non-English sessions reach the threshold sooner than the number suggests and the headroom you believe you have is not there. That is worth its own note, but as an absolute-pressure issue, not as the cause of the shrink verdict. (For calibration: ~1.5x is what mixed CJK/Latin gives against this ruler; pure CJK runs closer to 4x.) On the regression case: agreed, and it is the sharpest part of the suggestion. A constant-size summarizer stub cannot catch this loop — the failure only appears when the summarizer output scales with its input, because both quantities in the guard derive from the shadowed span. One note from my side, so nobody reads this thread as "the fix exists": I run a host-side guard (capture plus per-session cooldown, wrapping |


Uh oh!
There was an error while loading. Please reload this page.
Summary
Automatic compaction can select the checkpoint written by the previous compaction as its entire shadowed span. Re-summarizing a summary produces a same-size summary, the shrink guard rejects it, and the
agent/pre-steplistener simply tries again on the next step. One session produced 59 rejected attempts in 44.6 minutes of summarization (48 of them inside a single turn), 5 failed manual/compactruns, and a session that never got below its threshold.Environment
0.1.6-alpha.2, commitddefc45fbc7f8e46dd73185e68295696d1297887,--profile webopenrouter/deepseek/deepseek-v4.1-flashthresholdRatio 0.8,retainRatio 0.16,compactionRetries 1,maxOverflowRetries 1session-2496881f-8d36-4ce6-93d9-1954a31930c7— 1,423 events, 5.28 h, exported log attachedReproduction
shadowedRange 9–246, 38,883 tokens).[system head, checkpoint, …retained tail].agent/pre-steppressure or by overflow recovery.selectCompactableRangealways starts at the first non-system surface node, so the only eligible span is the checkpoint itself, andshadowedRangecomes back as a one-node span ({start: 709, end: 709}).summarizeCompactionrejects it,compactIfNeededthrows, theagent/pre-steplistener logsstep compaction failed: …; continuing the turn, and the next step starts the cycle again.Current behavior
Every rejected attempt is this guard, from
packages/compaction/compaction-basic/src/region.ts:compaction/startcompaction/end(witherror)/compactcommands19 of the 20 successful compactions are single-node spans on the previous checkpoint — the last one shadows 2,238 tokens and produces a 2,237-token framed checkpoint, which is exactly the equality the guard then rejects:
Expected behavior
A compaction candidate that cannot shrink should not be retried in a loop. Concretely:
user/messagewhosedata.source.plugin == "compact") as a summary span, or treat such a span as non-compactable when it is the only candidate.agent/pre-step.Relation to existing reports
Evidence bundle
https://gist.github.com/gorban/4725c87390cb391047a2f14b56b98d28EVIDENCE.md— how to recompute every number above from the logsession-2496881f-sanitized.jsonl— full session log (credential-redacted)session-2496881f-checkpoint-chain.tsv— the span tablesession-2496881f-stats.json— counts, wall time, failure messagesRecompute the chain directly:
All reactions