Repository navigation
fix(reasoning-drop): auto-disable compress reasoning drop on strict-echo upstreams (#361) - #363
Conversation
📦 Built Extension ArtifactBranch: Option A — Install from npm PR tag (recommended)pi install npm:billion-context-pi@pr-363Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pi-pr363.tgz
pi install ./packageThis comment is automatically updated on each push. |
…cho upstreams (#361) The default drop:true dropCompressReasoning pass strips the reasoning run preceding a closed compress round. On strict-echo thinking upstreams (DeepSeek thinking mode: tools in play require reasoning_content to be passed back) that independently reproduces the HTTP 400 on the next request — the same failure class fixed proxy-side in billion-context#690 and kernel-side (fold atomicity) in acp-kernel#245. #348 left a manual per-provider drop:false escape hatch but no auto gate. Port the sibling isStrictReasoningEcho() detector, adapted to pi's signal sources: static DeepSeek check from ctx.model.baseUrl/provider name (case-insensitive substring). The in-process adapter does not own the HTTP layer, so there is no learn-on-400 self-heal here — GLM-thinking / QwQ / self-hosted mirrors keep the documented manual override. Gate forces drop:false regardless of config (safety wins), cost-free for non-thinking models on those hosts, logs once per session. Fixes #361
Drives the real production path (createRuntime -> reloadConfig -> reasoningDropFor) to cover what the pure-function tests cannot: ctx.model.baseUrl reaching the gate when the provider name does not contain 'deepseek', an explicit drop:true losing to the safety override, threshold survival, and the info log firing exactly once per session.
A literal backslash-n glued the ```json opener to the prose line, so the fence never opened mid-line and the next physical fence line started a stray code block that swallowed the following sections in rendered output. Split onto its own line (matches CONFIGURATION.zh-CN.md).
b5d09e5 to
5c70710
Compare
Review complete — approved, ready to merge. Triage (bug class — verified before touching anything):
Verification (run locally on the branch): typecheck clean · 702 tests, 0 fail / 3 skipped · build success. Two small issues I fixed directly on the branch (head is now
The json-example re-indent in your diff is fine — it aligns the fence with the surrounding block's 3-space convention. Full closure pairs with acp-kernel 0.0.63 turn-integrity (#245) in the next release PR as you noted — nothing further needed here. 中文一句话:审核确认 strict-echo 自动禁用 reasoning drop 的修复定位正确(pi 侧 DROP pass 缺严格回传门控,属独立丢失路径,与内核/代理修复互补),已直接补齐 e2e 接线测试并修复 CONFIGURATION.md 一处既有代码围栏渲染 bug,rebase 至最新 master 后 typecheck/702 测试/构建全绿,可以合并。 |
…-echo-reasoning-gate fix(reasoning-drop): auto-disable compress reasoning drop on strict-echo upstreams (ranxianglei#361)
What
Auto-disable the
compress.reasoning.droppass on strict-echo thinking upstreams so a DeepSeek thinking-mode session can't be broken by the defaultdrop:true.Why
dropCompressReasoning()(defaultdrop:true) strips the reasoning run preceding a closed compress round. On strict-echo thinking upstreams (DeepSeek thinking mode:reasoning_content must be passed backwhen tools are in play) that independently reproduces the HTTP 400 on the next request — the same failure class fixed proxy-side in billion-context#690 and kernel-side (fold atomicity) in acp-kernel#245.Verified against the original report in billion-context#684, which states the closed-compress DROP is a loss path distinct from the fold split and reproduces the identical
invalid_request_error("Thereasoning_contentin the thinking mode must be passed back to the API") even after a single closed compress round.#348 tightened closed-round detection and kept a manual per-provider
drop:falseescape hatch, but the drop pass itself had no provider strictness gate — this PR adds the auto gate.How
Ported the sibling
isStrictReasoningEcho()detector, adapted to pi's signal sources:isStrictReasoningEcho(provider?, baseUrl?)— static DeepSeek check fromctx.model.baseUrl/ provider name (case-insensitive substring).applyStrictReasoningGate(cfg, provider?, baseUrl?)— forcesdrop:falseon a strict-echo upstream, preservingthreshold; no-op (same reference) otherwise.runtime.reasoningDropFor(ctx); logscompress-reasoning-auto-disabledonce per session.The gate overrides an explicit
drop:true(safety wins). Cost-free for non-thinking models on those hosts (they emit nothinkingparts). GLM-thinking / QwQ / self-hosted mirrors are deliberately not auto-detected (avoids disabling the pass for their non-thinking models) — they keep the documented manual override.No learn-on-400 self-heal here: the in-process adapter does not own the HTTP layer (Pi makes the LLM call; no extension hook observes the upstream 400), unlike the proxy.
Scope
src/reasoning-drop.ts,src/runtime.ts,tests/reasoning-drop.test.ts,CHANGELOG.md,CONFIGURATION.md,CONFIGURATION.zh-CN.md.acp-kernelpin (stays at master's 0.0.62). Full closure pairs with acp-kernel 0.0.63 turn-integrity (压缩失败或者终止 #245), which lands in the next release PR.中文摘要:为 DeepSeek 思考模式等严格回传上游自动禁用 compress reasoning drop(默认 drop:true 会丢 reasoning 触发 HTTP 400),移植代理侧 #690 的静态 deepseek 检测并接入 runtime,GLM/QwQ/自托管镜像仍走手动 drop:false;已验证 typecheck/测试/构建全绿。
Fixes #361