Skip to content

[PR] fix: name non-compressible (zero-ref) compress lanes conclusively in the failure receipt (#3596) - #3605

Closed
ranxianglei wants to merge 1 commit into
masterfrom
2026-10-18_3596-non-addressable-compress-verdict
Closed

ranxianglei wants to merge 1 commit into
masterfrom
2026-10-18_3596-non-addressable-compress-verdict

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Part of #3596 (bili-side secondary improvement ①). Complementary to #3601 (bili-side routing fix for the mis-routed main-session calls) — this PR does NOT touch routing.

What & why

A dsh sub-agent lane replays its whole parent history as ONE opaque user message, so its own compression state maps zero refs while the view is non-empty. The model cites the parent session's mNNNNN refs (rendered into the blob by the host); every one is necessarily unknown to this lane and none can ever resolve. applyRanges previously fell through to the generic per-ref "unknown" dump plus a [cause: stale-ref] label, which misleads the model into an acp_status/compress retry loop that can never succeed on a structurally incompressible lane.

Change

In the blocksCreated === 0 path of applyRanges (src/stream.ts), when the session maps zero refs, return one clean conclusive verdict naming the structural cause and forbidding the retry, instead of echoing the per-ref unknown list. Complements #3126 (empty in-memory view): here the view is non-empty but addressable-free. The operator log keeps the full kernel text; the #2432 breaker still arms via the same failure tracking.

Behavior change (old → new)

For compress calls landing on a zero-ref lane (e.g. the #3596 sub-agent blob lane), the model-visible receipt changes:

  • OLD: [Compression FAILED: <per-ref "unknown" list> [cause: stale-ref — …] <hints>] — invites acp_status/compress retries that always fail.
  • NEW: [Compression FAILED: this conversation has N message(s) but ZERO addressable per-message refs, so NO ref can resolve here … Compression is structurally impossible on this lane — do NOT retry compress or call acp_status about it; continue the task.]

Refed sessions are unaffected (a control test pins this). No change to compression behavior, wire shape, state, or routing.

Config surface

None. No new env/config/CLI field.

Tests

tests/issue3596-non-addressable-lane.test.ts: zero-ref lane gets the conclusive verdict (no per-ref spam, not mislabeled stale-ref); operator log retains the 0-ref signature; the breaker still arms over 3 consecutive failures; a refed-session control keeps the generic path. Related suites re-run green on the rebased head: issue2360, issue2146, issue2432, issue3126, compress-reject-reasons, issue847, issue1875, issue1029, compress-span-hint, fix-1124, loop-compress (80 tests). Typecheck clean. Full-suite verdict = remote CI.

Closes nothing — the root cause is dsh's single-blob replay (tracked in #3596) and the routing half in #3601; this PR ships only the bili-side messaging slice.

#3596)

A dsh sub-agent lane replays its whole parent history as ONE opaque user
message, so its own compression state carries ZERO mapped refs while the view
is non-empty. The model cites the parent session's mNNNNN refs (rendered into
the blob by the host); every one is necessarily unknown to this lane and NONE
can ever resolve. applyRanges previously fell through to the generic per-ref
"unknown" dump + a "stale-ref" cause label, which misleads the model into an
acp_status/compress retry loop that can never succeed on a structurally
incompressible lane.

In the blocksCreated===0 path, when the session maps zero refs, return one
clean conclusive verdict naming the structural cause and forbidding the retry,
instead of echoing the per-ref unknown list. Complements #3126 (empty in-memory
view): here the view is non-empty but addressable-free. Operator log keeps the
full kernel text; the #2432 breaker still arms via the same failure tracking.

Messaging-only: no change to compression behavior, wire shape, state, or the
routing decided in #3601 (complementary bili-side fix for the mis-routed
main-session calls).
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-18_3596-non-addressable-compress-verdict (8b12f10)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.4253-pr.3605.60dc55e

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr3605.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重: 不重复。关系核对:与 #3126(空 in-memory view 的拒收文案)互补而非重叠——#3126 的 noVisibleContextRefusal 在 applyRanges 里先于本 PR 的零 ref 分支执行(view 空 vs view 非空但无地址),优先级干净;与在途 #3533/#3302(sparse-ref 语义,kernel 侧)已核 diff——两处 stream.ts 改动(compressionRecovery fallback、compressFailureCause stale-ref 措辞)与本 PR 插入点无文本/语义冲突,且本 PR 控制测试用前缀匹配 /[cause: stale-ref/,#3533 合入后仍成立;与 open issue #3442(ref-less |sub: lane 每次 fold 被拒,gate:none-resolvable)同症状家族——#3442 报的是拒收现象,#3596 钉死了 blob-replay 根因,本 PR 是 #3596 的 bili 侧文案切片,三者保留、由 owner 决定是否归并。

Review 进行中:已通读 diff 与 applyRanges 全路径上下文(breaker/repeat-guard 语义、gate:non-addressable reason 仅落 log 不进模型可见 receipt),本地定向测试 + typecheck 跑完出八问结论。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Review 完成(独立审 diff,未复用 #3596 线程结论)。本地在 head 8b12f10f5 上:typecheck 干净、build 干净、定向套件 91/91 绿(issue3596 新文件 + issue2360/2146/2432/3126/compress-reject-reasons/issue847/1875/1029/compress-span-hint/fix-1124/loop-compress)。CI:除 test (windows-latest, 22, 1) 外全绿(28 success / 13 skipped);该红是 #3602 跟踪的已知 Windows lane-decisions-matrix teardown 挂起(cancelledByParent + "Promise resolution is still pending but the event loop has already resolved",与本 diff 无关——master 近一小时同族连红 8 次,非本 PR 引入)。

结构化八问

  1. 是什么问题:dsh 子代理 lane 把父会话整段历史重放成一条不透明 blob,该 lane 自身状态映射 0 个 ref,模型引用父会话的 mNNNNN 必然全部无法解析;旧文案把这种结构性死局报成逐条 "unknown" + [cause: stale-ref],诱使模型无限重试 acp_status/compress。
  2. 什么原因导致的:根因在 dsh 单 blob 重放([dsh] Critical issue in sub-agent implementation: the entire parent session is crammed into a single giant message; bili | [dsh] 子agent实现重大问题: 父会话整体塞进单条巨型消息, bili无法压缩(refs 0-mapped, 无界增长) #3596 钉死);bili 侧的缺陷是失败回执对「view 非空但零地址」这一结构性情形没有专属判定,落进通用 stale-ref 文案。
  3. 影响范围与严重程度:仅零 ref lane(当前即 [dsh] Critical issue in sub-agent implementation: the entire parent session is crammed into a single giant message; bili | [dsh] 子agent实现重大问题: 父会话整体塞进单条巨型消息, bili无法压缩(refs 0-mapped, 无界增长) #3596 的 |sub: blob lane)上的 compress 调用回执措辞;完全不影响压缩行为本身,属误导性文案+无效重试循环的体验/成本问题。有 ref 的会话不受影响(控制测试钉住)。
  4. 怎么修复的:在 applyRanges 的 blocksCreated===0 路径(kernel 报错后、通用 hint 簇之前)加一个短路分支:session 映射 ref 数为 0 时返回一条结论性判定,点名结构性原因、禁止重试与 acp_status;operator log 保留完整 kernel 文本;repeat-guard 与 [bug] DSH 桌面端 0.1.188:宿主原生压缩落地摧毁折叠基底 → 同一区间永久不可锚定、compress 连片失败并熔断(compaction-basic auto:false 仍无效) #2432 breaker 按相邻分支同一模式照常喂入(breaker 仍会在 3 连败后 arm,测试钉住)。
  5. 是否有回归问题:逐项过既有行为——parse 失败路径、反转归一化、[bug] 大会话 compress 持续失败:ctx has 0 message(s) 时所有 ref 被判悬空(cannot-anchor),报错归因误导 #3126 noView 拒收(代码级核实其谓词对 mappedRefs===0 显式放行,优先级无冲突)、[严重]t2压缩被截断为200字 #2749 stub 拒收、手动 compress 仍接受零/负净收益折叠,先改写缓存再提示上下文增长 #2748 net-benefit gate、通用失败回执(refed 会话)、成功路径的计数清零、acp_status 的 breaker/lastFailureCause 读取面:全部保持。唯一语义变化:零 ref + 空 view 的组合此前落入通用 kernel 错误路径,现在也拿到非地址化判定(同一机制的子情形,方向一致)。高危模式(阈值/时序/输出格式漂移、fail-fast 变吞错):无。
  6. 是否破坏缓存:不涉及——refused 调用原本就不提交任何状态,本次未改 wire/state/持久化。
  7. 是否改了设计方向:不涉及——纯 bili 侧消息切片,明确不动路由(路由半区在 [dsh][bili] #2601 live-fork决议把主会话压缩系统性误路由到无ref的子agent车道, 压缩全部失败(33/33) #3601),不碰 kernel。
  8. 是否引入了新的配置:无。

行为变更披露(旧→新):① 模型可见回执:逐条 unknown dump + [cause: stale-ref] → 单条结论性 "ZERO addressable per-message refs … structurally impossible … do NOT retry";② [plugin] 执行行的机器可读 reason(仅日志不进模型可见面):此类失败从 gate:none-resolved 变为更精确的 gate:non-addressable,利于日志关联。两者均为本 PR 目的所在。

测试有效性:三个断言都有牙——负向断言钉住「不再逐条 spam、不再误标 stale-ref」、breaker 三连败跨不同 spec 仍 arm(防后续重构绕过跟踪)、refed 控制会话保持旧路径(防误伤);控制测试用前缀匹配 /[cause: stale-ref/,与在途 #3533 的措辞变更兼容(已核 diff,两处 stream.ts 改动与本插入点无冲突)。

判定:可合入。唯一红 lane 为已知预存 flake(#3602),如想要全绿记录可在合并前重跑该 job;另注 PR 正文按设计不 close 任何 issue(根因在 dsh,#3596 继续作跟踪项),与仓库惯例的 Fixes #N 略有出入但理由成立,由 owner 定夺。

@ranxianglei ranxianglei changed the title fix: name non-compressible (zero-ref) compress lanes conclusively in the failure receipt (#3596) [PR] fix: name non-compressible (zero-ref) compress lanes conclusively in the failure receipt (#3596) Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant