Repository navigation
[PR] fix: auto-mode classifier gate ignores marker strings quoted in history (#3908) - #3920
ranxianglei wants to merge 2 commits into
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4685-pr.3920.591de01This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3920.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复——本 PR 是 #3908 唯一在途的修复项(正文 Closes #3908);扫描全部 open PR,没有其他触碰 auto-mode/classifier 检测的工作在途(#3746 threads-lane reforge、#3610 transient-4xx classifier 均为不同机制)。 标签: bug / claude-code / dsh / scope/wiring / p1(缺陷类;CC 与 DSH 两侧均受影响;压缩主路径被静默关停、计费照涨,按 owner 修订规则定 p1)。 审核进行中,先报第一轮结论: 方向关 ✅:根因分析独立复核成立。旧 回归清点:两个调用点(
根因已定位:这 4 个 e2e fixture 用的是几十字符的占位 transcript(如 处置:直接在 PR 分支推 additive commit,把这 4 处 e2e fixture 升级为 KB 级 transcript(与单测同等待遇),本地定向验证后 push 看 CI。完成后补完整八问结论。 |
…ans (#3908) The #3908 span floor correctly rejects sub-512-char placeholder transcripts, but four e2e fixtures in tests/e2e-anthropic.test.ts still used them, so the new gate forwarded them upstream and the zero-egress assertions failed on all CI shards. They now share one KB-scale CLASSIFIER_TRANSCRIPT constant — the same treatment the unit suite's BIG_TRANSCRIPT already got. A genuine CC one-shot carries the entire flattened session in the wrapper; sub-KB fixtures were never realistic shapes of this lane. Targeted local runs green: tests/auto-mode-forge.test.ts + tests/e2e-anthropic.test.ts (33/33); full-suite verdict via CI.
(ai: vllm-qwen/qwen3.8-27b) CI 已转绿:在 PR 分支推了一个 additive commit( 审核发现的处置(上一轮报的 CI 红):根因不在门本身,在 e2e fixture——4 个 #2740 e2e fixture 用的是几十字符的占位 transcript,低于新的 512 字符 span floor,被新门正确地拒绝、转发上游,「zero upstream egress」断言失败。真实 CC one-shot 请求的 wrapper 里装的是整个压平会话(KB 级);单测套件升级成了 KB 级 fixture,e2e 套件漏了。修法 = 4 处共用一个 KB 级 结构化八问:
收工判定:可合并——方向正确(修决策点而非过滤载荷)、回归清点干净、全量 CI 绿。合并是 human-only:#3920 |
What
Fixes the #3908 silent kill: once a session's resent history contained BOTH the
<transcript>marker and an auto-mode policy phrase (the reporter's case: a tool result carryingsrc/auto-mode-forge.tsitself),isAutoModeClassifier()matched on every subsequent request — 54/58 requests became byte-identical passthrough, processTurn/nudge/tag-rendering silently off, ACP state frozen at 0 blocks while billed input grew toward the window.Root cause
The detector scanned UNBOUNDED history — system + all message text INCLUDING tool_result payloads + tools JSON — for the conjunction "transcript marker AND policy wording". The module's design assumption ("the conjunction cannot reasonably be faked by a coding session") was falsified by bili's own source file, which contains both families in one place (
<transcript>literal + paired comment span + "Err on the side of blocking"). Once quoted into history via any tool result (or pasted into chat text), the match became permanent for that session.Fix (decision point, not symptom)
Narrowed the gate to where the classifier actually places its signals. Single predicate (
src/auto-mode-forge.ts); both call sites (src/server/handle.tsforge path,src/server/prepare-anthropic.tspassthrough path) share it.<transcript>…</transcript>pair in USER TEXT enclosing >= 512 chars (MIN_TRANSCRIPT_SPAN). A genuine wrapper carries the ENTIRE flattened session (KB..MB scale from the first classified-tool exchange); quoted artifacts (source literals, doc examples, comment spans) enclose at most ~100 chars.Behavior change (old -> new)
Residual risk accepted: a genuine classifier whose flattened transcript were < 512 chars degrades to raw forwarding — assessed implausible (CC's jsonl envelope makes even the first-exchange transcript KB-scale), and the degradation direction is safe.
No config surface change. No kernel/ change. No wire-shape change.
Tests
tests/auto-mode-forge.test.ts(22 pass; full-suite verdict via CI):<transcript>appears in the history, compression for the entire session is | isAutoModeClassifier() 误判:历史中出现 <transcript> 后,整个会话的压缩被静默跳过 #3908 regressions: poisoned multi-turn session (incident shape), chat-paste sub-floor span, magic stops + sub-floor span.Closes #3908