Repository navigation
fix(#2709): guard the unattributed passthrough lane against dsh native compaction - #2722
Merged
Merged
Conversation
…e compaction The #1117 passthrough lane relays byte-untouched with 'no session, no injection, no guard' — which made it the one lane dsh's agentless background compaction could still LAND through: the takeover gate refuses attribution for agentless callers while the settings overlay has already routed the URL to /bili/, so the native patch stamps x-bili-passthrough and the call relays verbatim BELOW the #1835 pipeline guard (field report: 49 compaction starts, 45 refused through the pipeline, 4 landed through this lane, each landing later tripping #1001 as an 'unannounced' rewrite). Same refusal applied at this lane too: marker-decisive detection (#2193 — message count never gates), raw-ASCII sniff prefilter so ordinary background traffic (title-gen, plugin calls) pays no JSON.parse, bounded decode for content-encoded bodies (the relay still forwards the ORIGINAL bytes), honors allowDshCompaction (#2028), fail-open on undecodable bodies (the #1835 failure direction), and a process-level refusal count since the lane has no session for the #2490 ledger.
Owner
Author
Contributor
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2953-pr.2722.f8b546aThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2722.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Contributor
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.250-master.445ee4d # this exact build
npm install -g billion-context@master # always the newest merged build
|
This was referenced Oct 11, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes the interception hole behind the 4 landed compaction calls in #2709 (the P2/P3-relevant leak, complementary to ework's attribution-only #2715).
Mechanism (code-level)
Field report (anthropic lane, dsh desktop rc.2): 49 compaction starts, 45 refused through the pipeline, 4 landed through this lane — each landing durably shadowed the raw history, destroyed the compression substrate, and later tripped #1001 as an "unannounced rewrite".
Fix
Run the same marker-decisive detection on the passthrough lane before the verbatim relay:
Buffer.includesof the first 48 bytes ofDSH_COMPACTION_INSTRUCTION_PREFIX— ordinary background passthrough traffic (title-gen, plugin calls) pays no JSON.parse; a sniff hit still goes through the full marker-decisive check (isDshCompactionCall, [dsh] 原生压缩拦截门的 SHAPE 信号(≤4 条消息)在 dsh-compaction-basic 0.2.0-rc.2 上恒假 → 压缩静默落地 → 1510 条 fold 锚点永久失配,连刷 166 条 no-anchor-match 且面板仍报 netSaved 355.9M #2193 — the final user message must START with the prefix), so a conversation that merely mentions the instruction string does not false-positive.decodeRequestBody+MAX_DECODED_REQUEST_BYTES+ admission accounting, the 压缩图片历史在减量前被 100 MiB 解压上限拒绝:分离有界接收与转发字节预算 #2606/fix: 让压缩图片历史先减量,再检查发送字节预算 #2613 budget machinery) and sniff/parse the copy. The relay still forwards the ORIGINAL bytes with content-encoding intact — nothing reassignsbodyBufferor drops the header.dshCompactionRefusalbody, honoringallowDshCompaction(在bili网页配置界面支持关闭和开启dsh的自动压缩功能 #2028, same opt-out).dshPassthroughGuardStats.refusalscounter — this lane has no session, so the dsh压缩与bili压缩冲突 #2490 ledger cannot record it; the log line is the record (surfaced for tests now, stats wiring later if wanted).Behavior changes (old → new)
allowDshCompaction:truedeployments): byte-identical to before.Tests
tests/issue2709-passthrough-compaction-guard.test.ts(6): marker-shaped POST → 403 + upstream zero-received + counter bump; marker mentioned mid-text → byte-identical relay (no false positive); gzip-encoded marker body → still refused;allowDshCompaction:true→ relays; unparseable body → fail-open relay; GET → untouched.Regression:
fix-1117-passthrough,dsh-compaction-guard,issue2193,issue2028,issue2432,issue2451,issue2658,anthropic-pck-verbatim,native-intercept— 104/104 pass, typecheck clean.Out of scope (unchanged)
Refs #2709 #1117 #1835 #2193 #2360 #2490 #2028