Skip to content

fix(#2709): guard the unattributed passthrough lane against dsh native compaction - #2722

Merged
ranxianglei merged 1 commit into
masterfrom
2026-10-11_passthrough-compaction-guard
Oct 11, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-10-11_passthrough-compaction-guard

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

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)

dsh background compaction summarize call (agentless — no active initiator attribution)
→ takeover gate refuses attribution (dsh-native.ts:1094, "no active initiator attribution")
→ but the settings overlay already routed the URL to /bili/… — client-side refusal impossible
→ native-intercept.ts:562 stamps x-bili-passthrough and sends anyway
→ handle.ts passthrough branch relays byte-untouched — the comment literally says
  "no session, no injection, no guard" (#1117)
→ the #1835 guard sits in the ACP pipeline (handle.ts, AFTER identity resolution),
  which this lane early-returns before — the call forwards verbatim and LANDS

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:

Behavior changes (old → new)

  1. A passthrough POST whose final user message starts with the dsh compaction instruction: forwarded verbatim (landing) → 403 refused, upstream receives nothing.
  2. Everything else on the passthrough lane (ordinary POSTs, unparseable bodies, GETs, allowDshCompaction:true deployments): 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

…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.
@ranxianglei

Copy link
Copy Markdown
Owner Author

Relates #2709 — this closes the interception hole behind the 4 landed calls; ework's #2715 covers the attribution side (both should land).

@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-11_passthrough-compaction-guard (f5b633a)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.2953-pr.2722.f8b546a

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-pr2722.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei
ranxianglei merged commit 445ee4d into master Oct 11, 2026
28 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.250-master.445ee4d (rolling master tag).

npm install -g billion-context@0.0.250-master.445ee4d  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

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