Repository navigation
[PR] fix(#3013,#3022): refusal is terminal — bili_final marker + storm-visible logging (A1+A3) - #3045
ranxianglei wants to merge 8 commits into
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g [email protected]This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3045.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…ible logging (A1+A3) Field report #3013: one session burned 5069 refused dsh compaction calls (5038 retries, median 328ms, 0 outbound) while the user watched a stuck '生成中'. Two halves: A1 — the refusal body now carries bili_final:true (top level on both protocol shapes; inside error on the openai envelope where retryable lives). retryable:false did not stop the loop: dsh's retry pressure comes from its own raw ledger (#2490), which nothing on bili's side can shrink, so the same call fails identically forever. bili_final is the stable machine-readable contract for dsh upstream to latch (consumption is a cross-project follow-up). REFUSAL_MESSAGE now states the terminal semantics and the levers (bili compress / #2474 recipe / #2028 opt-in; dropped the stale web-UI mention deleted by #3042). A3 — logging. Pipeline lane: after the once-warn, every 100th refusal logs an info with the running count, the #2490 mechanism, and the levers (previously: 5051 silent refusals, zero log lines, user blind). Passthrough lane: was warn-per-refusal (the spam direction) — now warns on the process's first refusal, then the same 1-per-100 cadence. Tests: tests/issue3013-refusal-terminal.test.ts (A1 body shapes on both protocols incl. error.bili_final; A3 storm cadence on both lanes via setLogCapture with log:true rigs — request-scoped log is gated on opts.log, log:false rigs made guard lines no-ops). Red-green proven. Family regressions green (dsh guard/2028/2709/2658/2432/2451, claude guard #2612, codex 2451, archives): 97 tests.
aa9779f to
34b6c7e
Compare
[bot] 🏷 PR #3045 审查结论(分支 按 [PR] issue 规范:不重做,拉分支逐行核对代码 + 确认 CI。结构化八问如下。 ① 是什么问题 ② 什么原因导致的 ③ 影响范围与严重程度 ④ 怎么修复的 ⑤ 是否有回归问题 —— 审过的既有行为逐项:
⑥ 是否破坏缓存 —— 不涉及。拒绝发生在压缩/缓存之前,不改 prefix-cache、增量游标、去重键。 ⑦ 是否改了设计方向 —— 不涉及架构转向。是把"拒绝"从"瞬时错误"重新定性为"终态决策"并固定为稳定契约(bili_final),与 owner 在 #3016 的裁决一致(任何破坏顺序的都该被拒绝,拒绝成本全在 dsh 侧、可见、可恢复)。消费端(dsh 上游锁存 bili_final)是跨项目跟进,bili 侧契约在此固定。 ⑧ 是否引入了新的配置 —— 无新 env/config/CLI flag。 CI / 合并判定
小问题处理:审查未发现需顺手修的小缺陷(diff 干净、注释与代码事实一致)。 |
[bot] 🏷 CI 全绿,收工确认。 head 最终判定:可合。代码逐行核对与 PR 描述完全一致(A1 三种 body shape 的 |
# Conflicts: # src/server/dsh-compaction-guard.ts
…sationOrder adapter The fa7dc4e merge kept #2731's direct personaNamespace(...) call for the google lane but dropped its import — master had already swapped the direct calls for the session-resolve.ts personaConversationOrder wiring adapter (content-blind, keyed by order+id, (systemText, log) params gone). Translate the call faithfully and add the empty-system non-anchoring guard the other lanes already have, so typecheck (tsconfig.json, not CI-run) is green again. Verified: typecheck 0; dsh-persona-fingerprint + side-request-isolation + issue2709 + dsh-compaction-guard 58/58.
…the side-lane suite The persona-gate conjunct sits on the sideRequestLike line in handle.ts, so lane-guard (#2170) demands the suite edit. Pins: a dsh MAIN google request with NO systemInstruction rides the verbatim key and never enters personaConversationOrder (whose cold-shallow branch would fork |sub:aux). 25/25 in side-request-isolation.
# Conflicts: # tests/conflict-remediation.test.ts
… + golden pins Master-red picked up in this branch (fails on pure origin/master too): - ca93ef4 (#3058) moved the kernel default without touching the two #1387 tail tests (which ride the default and rely on m00003–m00007 being inside the protected zone) or the storage-render goldens (persisted metadata section digest is the only drift; state/blockContents/stats unchanged). - #1387 tests now pin preserveRecentMessages: 5 explicitly — they exercise the stop-signal contract, not the preserveRecent default. - goldens regenerated via scripts/update-storage-render-goldens.ts. Verified: compress-success-tail 8/8, golden-storage-render 5/5 (was 2/6).
|
(ai: zhipuai-lb/glm-5.3) 已并入 #4590。关单收尾;误判请 reopen。 |
Closes #3013 (logging half + wire contract), refs #3022, #3016, #2490, #3004.
什么问题
#3013现场:一个会话烧了 5069 次被拒的 dsh 原生压缩调用(首拒后 5038 次重试,中位间隔 328ms,上游 0 次到达),用户全程只看到一个卡住的"生成中"。两半问题:retryable:false。dsh 的重试压力来自它自己的 raw ledger(dsh压缩与bili压缩冲突 #2490),bili 侧任何东西都缩不小它 → 同一个调用永远以同样方式失败,客户端却没有可锁存的机读终态标记。修复(A1 + A3,owner 在 #3016 讨论中定的两件)
A1 — 拒绝即终态
bili_final: true:两种协议 shape 的顶层都有;openai 错误信封(retryable所在处)error.bili_final也有。这是给 dsh 上游锁存的稳定契约(消费端是跨项目跟进,bili 侧契约在此固定)。A3 — 日志
DSH_REFUSAL_STORM_LOG_EVERY = 100次拒绝记一条 info:累计计数 + raw-ledger 高水位 + dsh压缩与bili压缩冲突 #2490 机制(dsh 自己的 raw 压力永不缩小)+ 全部出路 + "如果 bili 自己的压缩也躺着不动 → nudge 通道可能死了,报告它(dsh上下文700K不触发压缩 #3004/After the folded ledger was unanchored, rejections no longer take effect: all 5069 compaction/start attempts failed and no longer produce outbound (billion-context 0.1.187 → 0.1.195) | 折叠账本脱锚后拒绝不再生效:compaction/start 5069 次全部失败且不再产生 outbound(billion-conte… #3013)"。为什么不是让拒绝可重试
owner 裁决(#3016):"最新的bili就是100%以顺位为主的…任何破坏顺序的都应该被拒绝"。放行 dsh 原生压缩 = 破坏顺序(落地的 checkpoint 永久遮蔽原始历史,不可逆);拒绝的成本全部在 dsh 侧、可见、可恢复。终态化 + 讲清楚出路才是与裁决一致的方向。
测试
tests/issue3013-refusal-terminal.test.ts(3 tests):bili_final;openai 顶层 +error.bili_final;message 断言 /terminal for the session/、/stop retrying/、/fix(dsh): profile 层 patch 其实可以关掉 web profile 的原生自动压缩(#1772 结论修正)+ 一个会静默清空整个 preset 的写法坑 #2474/、/allowDshCompaction/。bili_final、上游 0 到达、恰好 1 条 once-warn + 恰好 1 条 fix(server): resolve backpressure wait on client disconnect so streams can't hang the session lock #100 info(含 /never shrinks (dsh压缩与bili压缩冲突 #2490)/、/fix(dsh): profile 层 patch 其实可以关掉 web profile 的原生自动压缩(#1772 结论修正)+ 一个会静默清空整个 preset 的写法坑 #2474/、/After the folded ledger was unanchored, rejections no longer take effect: all 5069 compaction/start attempts failed and no longer produce outbound (billion-context 0.1.187 → 0.1.195) | 折叠账本脱锚后拒绝不再生效:compaction/start 5069 次全部失败且不再产生 outbound(billion-conte… #3013/)。log受opts.log门控(logMsg,server.ts:3271),rig 必须log:true否则 guard 日志是 no-op。Red-green 证明:stash 两个 src 文件 → 新测试全红;恢复 → 绿。
回归(97 tests 绿):dsh-compaction-guard、issue2028 toggle、issue2709 两条、issue2658、issue2432、issue2451、issue2612 claude guard、issue2612 draft-tail、codex-local-compaction、compaction-archive、compaction-trigger-finality。tsc clean。
影响面
error.code/status 识别,不受影响)。