Skip to content

fix: side requests under public-fork children ride the #388 passthrough (#2157 follow-up) - #2164

Merged
ranxianglei merged 1 commit into
masterfrom
2026-10-05_fork-side-lane-veto
Oct 5, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-10-05_fork-side-lane-veto

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What

Follow-up to #2157 (fix for #2156/#2160). #2157 keyed side requests verbatim (sideRequestLike) but left the #388 lane's !publicForkPrefix veto in place — those two gates moved apart, opening a regression window:

A full-history-replaying side request under an ALREADY-ANCHORED public-fork child now runs the FULL pipeline on the child's main session.

Why that fires in the real world

dsh title-gen is exactly that shape: the host resends the entire current history plus the title instruction, on the anthropic wire (top-level system, messages replay the raw conversation) — so publicForkInputMatches always matches and the receipt branch accepts the request. Then:

  • lane vetoed (!publicForkPrefix fails) → processTurn / usage capture / snapshot growth run;
  • sideRequestLike=true → verbatim child key (no |sub:<fp> isolation anymore).

Per side call under a forked dsh conversation: junk turns recorded into the snapshot, usage baseline polluted (#1916 class — the title's full-history token count becomes the session baseline), stats.requests inflated. Pre-#2157 the same request forked onto an isolated |sub:<fp(side)> junk session — ugly but clean.

Fix

Drop the !publicForkPrefix veto for intent-certain side identification in the #388 lane (src/server.ts): the receipt's first-request 409 discipline has already accepted the request (matched prefix, or live child traffic), and a side request reads none of the kernel state fork adoption maintains — the veto had nothing to defend.

demotedSide keeps its own !publicForkPrefix veto deliberately: the all-bili-tools leak shape is heuristic, and a fork child's early mainline turns (raw inherited prefix, no artifacts yet, no agent header) can false-positive it. Only a declared side agent (title) or a tool-less tiny budget diverts under a receipt.

Test

tests/fork-side-request-lane.test.ts (new): fork parent→child, one child main turn (anchors), then an agent=title full-replay request. Asserts:

  • the title request still reaches the upstream and carries the title instruction;
  • stats.requests, snapshot revision, /__bili/plugin/status usage/context estimate all unchanged;
  • the title instruction never lands in the child's kernel pluginSnapshot;
  • the child's NEXT main turn still runs the full pipeline (no over-diversion).

Evidence (local repro, master 8b62bd7)

Pre-flight

  • npm run typecheck ✅
  • new regression test ✅ (1/1)
  • side-request-isolation 22/22 · dsh-persona-fingerprint · plugin-fork 43/43 · fork-adoption · fork-ccr-adoption · fork-nudge-trigger · truncation-fork · preflight-fork-estimate · fix-1075-side-request — 99/99 together ✅
  • Full matrix (ubuntu/windows × node 22/24, e2e lanes, build) delegated to CI on this PR.

Release coordination

Merge this before #2161 (v0.1.185 release PR) so the release carries the fix — the release branch merge will pick up master. The v0.1.185 release-notes entry (critical tier, #2156 headline) is unaffected.

…gh (#2157 follow-up)

#2157 keyed side requests verbatim (sideRequestLike) but kept the lane's
!publicForkPrefix veto, so a full-history-replaying side call (dsh title-gen
under a forked conversation: the host resends the ENTIRE current history plus
the title instruction, so the inherited-prefix receipt always matches) ran
the FULL pipeline on the fork child's MAIN session — junk turns into the
snapshot, usage-baseline pollution (#1916 class), stats inflation. Pre-#2157
the same request forked onto an isolated |sub:<fp> junk session (ugly but
clean). The receipt's first-request 409 discipline has already accepted the
request, and side requests read none of the kernel state fork adoption
maintains, so the veto had nothing to defend — drop it for intent-certain
side identification. demotedSide keeps its own veto (leak-shape heuristic can
false-positive a fork child's early mainline turns).
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-05_fork-side-lane-veto (891711d)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.2213-pr.2164.bfe0ef8

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

Install instructions are refreshed on each push.

@ranxianglei
ranxianglei merged commit 6f0cdfc into master Oct 5, 2026
21 checks passed
@ranxianglei ranxianglei mentioned this pull request Oct 5, 2026
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.40-master.6f0cdfc (rolling master tag).

npm install -g billion-context@0.0.40-master.6f0cdfc  # 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.

yingzhongshuoqi pushed a commit to yingzhongshuoqi/billion-context that referenced this pull request Oct 5, 2026
… runtime canaries, CI lane guard (ranxianglei#2170)

Measures 1/2/4/5 from ranxianglei#2170 (measure 3's recorded golden fixture stays a
follow-up; the e2e lane itself ships here):
- demoteGate()/resolveSideLane() extracted into src/server/side-request.ts
  as pure functions; server.ts wires them with the detect/strip effects
  still lazily short-circuited. resolveSideLane takes no fork input (the
  ranxianglei#2164 structural guarantee); demoteGate keeps the !publicForkPrefix veto.
- tests/side-lane-truth-table.test.ts: exhaustive tables pinning both gates
  and the reason strings.
- tests/side-lane-invariants.test.ts: observation-transparency, seeded
  ordering-fuzz vs main-only baseline, splitSessionWarnings unit.
- Runtime canaries: post-lane SIDE-EFFECT LEAK counter on the session +
  /__bili/status splitSessions warnings (the ranxianglei#2165 shape).
- ci.yml lane-guard job; new ci-e2e-dsh.yml dedicated dsh plugin lane.
@ranxianglei
ranxianglei deleted the 2026-10-05_fork-side-lane-veto branch October 15, 2026 05:32
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