Repository navigation
长会话切换模型后压缩陷入失败风暴:maxOverflowRetries 不构成上界、压力路径无退避(附手动绕过与配置缓解) #9888
Replies: 2 comments
|
Your three mechanisms all hold at source on 1. The routing half is exactly as you describe, and your workaround is the mechanism. const latest = agent.session.requestHeader()?.config
const configured = config.summarizationProvider.length === 0
? undefined
: { provider: config.summarizationProvider, model: config.summarizationModel }
const agentTarget = … agent.options.provider … agent.options.model …
const target = configured ?? latest ?? agentTargetThree consequences worth separating:
2. The request shape is as you describe, and the reason is a documented design intent. 3. The retry/backoff half is right, and here is the sharper form. There are two automatic triggers and the bound exists on only one of them. Overflow path — the One narrowing of your wording: the counter is incremented on two branches, not only a success branch — Pressure path — the That throw lands in the pre-step catch ( There is no backoff anywhere in the package: no 4. How to attribute your 152 failures from the log.
So "repeated 5. Your token-meter observation is the same fact from the other side. The estimate the compaction threshold is computed from uses a fixed density: 6. What is already shipped for the capacity half — and one correction. Two packages cover the two steps in front of your model-free fallback:
Against the third-party guide you cite, I would keep two statements apart rather than accept one: "this cannot be fixed in the plugin layer" is true of the retention half and false of the capacity half. They are different seams — retention is a decision inside the region transaction ( 7. The half with no asset yet, and the one I would build next. Neither package bounds repeated attempts: they cover "a bigger route exists" and "no route at all". A step-cadence storm is a third case — a route exists, is chosen again every step, and fails again every step. I would build Two constraints I would hold to in it: the ledger is released by state — a compaction that actually lands clears it — never by a clock, because in this domain a timer-driven release turns a stale context into a stuck one; and it bounds attempts only, so it cannot make the context smaller and should not pretend to. Ordering, then: reroute to a bigger window if one exists → bound repeated attempts on the one you have → drop the oldest span model-free. Happy to file that here or against the tracker you submitted to; only this public thread is visible from my side, so the source facts above hold either way. |
|
逐行核对的结果对我很有用,先认两处错。 一,计数器不是只在成功分支自增。 二,标题的说法过宽。按你给的源码,overflow 路径是有界的: 三,"插件层修不了"这句我会拆开说。你说得对,retention 在 region 事务内部, attempt-guard 就发在这条线程。你那边只有公开线程可见, 你给的两条约束我没有异议。账本按状态释放,不按时间释放,这个域里定时器驱动的释放会把上下文过期变成会话卡死。它只 bound 尝试次数,不会把上下文变小,名字和文档里要写清楚,别让用的人以为它替代压缩。 另外两点是从你这篇回复里新拿到的,我会补进原帖。日志是 over-report:只有 |
Uh oh!
There was an error while loading. Please reload this page.
症状
长会话在某次切换模型之后卡住不动。界面上只留下一行红色提示:
自动压缩的失败完全不可见,所以用户往往只感觉到"会话突然不动了",要翻日志才发现压缩在每个 step 前反复失败。
根因
压缩本身要调用模型。
summarizeWithLlm把 system prompt、工具 schema 和被选中的那段历史原样重发。如果会话已经超过当前路由的上下文窗口,这个摘要请求自己就先超限,于是压缩永远失败。更麻烦的是压缩目标模型取自
session.requestHeader(),也就是上一次实际发出的请求,而不是 UI 里当前选中的模型。你把模型换回去了,只要还没发消息,再点/compact仍然会打老模型。这两个缺陷叠在一起就是一个死锁:压缩是唯一能缩小上下文的手段,而它自己塞不进去。
dsh-compaction-basic还有第三个问题让情况恶化:压缩失败没有上界也没有退避。maxOverflowRetries只在成功分支自增,每条assistant/message又会把它清零;step 前的压力路径更是连计数器都没有,只有一行logger.warn。于是失败一次、上下文不变、下个 step 再失败,每次都是一次真实出站请求。我在一台机器上实测,近三天桌面工作区:
最严重的一例单个 turn 内 104 个 step 触发 103 次压缩失败,跨度 4260 秒,成功摘要为 0。
手动绕过
切换到大窗口模型后,先随便发一条消息让
request/header更新,再/compact。这是目前唯一可靠的解法,/compact会跟着新模型走。切完直接压是不行的。配置层面的缓解
给压缩固定一个大窗口的专用路由,不让它跟着会话当前的模型跑:
再给小窗口路由单独降低触发阈值,让压缩提前发生而不是等到塞不下:
另外如果某条路由的
maxTokens设得很大而窗口很小,等于每次请求先占掉大半窗口。建议把输出上限压到窗口的三成以内。这些只是缓解,改变不了"压缩调用自己塞不进去"这个结构性问题。
社区已有的东西
argszero/dsh-compaction-target-guard在发出前拦截,改用声明了更大窗口的路由重试argszero/dsh-overflow-recovery在压不动时直接丢弃最旧一段,不调模型WASD258-jpg/dsh-compaction-guide系统梳理了自动压缩,其中也论证了为什么这个问题在插件层修不了另有一个报告症状很像但根因不同,是第三方插件自己的折叠账本失效,这里不混为一谈。
我提交到哪
重试计数器和退避这个角度现有讨论都没覆盖,我提交到了内测 issue 仓库:dsh-external/issues#665。公开这边觉得有重复的话可以只留内测那份。
环境:DSH Desktop 0.2.0-rc.2,macOS。所有数据来自本地 session 日志统计,没有上传任何会话内容。
All reactions