Repository navigation
Replies: 2 comments
|
补充一个同类问题的实测案例:压力压缩无法取得收益时,不仅会在 pre-step 反复调用摘要模型,还会通过模型切换门禁阻塞旧会话切换。 环境为 macOS 桌面端、基于 实际观察:
脱敏后的错误示例(仅替换提供方/模型名称): 触发过程可归纳为:在标准模式会话中累积较大的工具定义和历史指令,再从较宽松的压力 policy 切换到使用上述默认 policy 的目标模型。尾部历史需要保留,剩余可选旧前缀非常短;继续切换仍然尝试对这个前缀生成结构化摘要。这里是从真实失败会话归纳的触发条件,并非已经验证过的独立最小复现脚本。 结合日志和相同源码计算: 该请求的工具定义 JSON 约 153771 字符(按 chars/4 约 38.4k tokens),仅这一项就超过压力阈值;这是估算值,不是上游 tokenizer 的精确计数。消息 surface 约 18k tokens。尾部保留算法最终只留下最早的一句用户消息作为压缩选区:42 个字符,按当前估算及 framing 为 19 tokens。因此生成带结构与前导的数百-token 摘要后,非收缩检查必然拒绝。19 指的是被替换的片段,不是整个会话或模型窗口。 相关官方源码位置: 建议修复及回归测试也覆盖 model-switch 入口:摘要前判断固定开销、保留尾部和最小摘要成本下是否可能取得收益;无法达到目标压力阈值时,直接给出可操作的诊断,避免重试时再次付出同样的摘要调用。需要继续保留模型切换的容量保护与失败时旧请求头的语义,不能仅通过吞掉异常让不安全的目标请求继续。 本条只补充压缩/模型切换问题,不包含另一个独立的上游 HTTP 400 问题。未附原始会话正文、凭据、内部服务地址或未脱敏截图。 |
补充:Windows 桌面端实测,844 次压缩 / 288 次同类失败;另有 ZCode 的对照实现#12071 的分析在本机独立复现,规模更明确。我的场景与前面评论不同:不是模型切换门禁,而是普通每步压力压缩;不是摘要请求超限,而是摘要通过之后被非收缩检查拒绝。 实测数据(2026-11-19 00:00-08:30,Windows 10.0.26300 桌面端)从
固定开销一次 为什么每步重试停不下来(源码位置,与 #12071 一致)
对照:ZCode 的压缩实现说明这确实是可避免的同一台机器上的 ZCode(
期望行为不是"吞掉异常放行",而是:识别这种无收益跨度,要么在重试里扩大选区/降低 retain,要么在连续失败后熔断并给用户可操作提示。#12071 里建议的"摘要前判断可约压力是否可能达到阈值,不可达就 warn 一次并 decline"在这里同样适用——本例的不可约对象就是上一次压缩刚写入的 checkpoint 自身。 附带环境事实顺带一提,本机的 Happy to test a patch on this Windows setup. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
With
auto: true, a request whose non-compactable overhead (tool schemas plus thesystem/messageat surface node 0) already fills the routed model's pressure threshold triggers a summarization call on every step, although no summary can bring it below the threshold.Reproduction
Route a session to a model with a small context window and mount a large tool surface, so tool schemas plus the system prompt reach the threshold; then send a few turns.
Current behavior
Each
agent/pre-stepruns a full summarization call, spending tokens and latency, and pressure stays above the threshold afterwards.Expected behavior
compaction-basic declines pressure it provably cannot clear, with one warning per session and routed target, and leaves overflow recovery to
agent/request-error.Environment
DeepSeek Harness
dsh-v0.2.2-alpha.3, macOS arm64, Node v26.0.0.Suggested fix
Tests
These fail on
dsh-v0.2.2-alpha.3without the fix and pass with it (packages/compaction/compaction-basic/tests/compaction-basic.spec.ts):All reactions