Skip to content

fix(#1795): route preset BILLION_CONTEXT_PROXY to attach in the omp native lane - #1845

Closed
ranxianglei wants to merge 1 commit into
masterfrom
2026-10-01_omp-attach-preset-proxy
Closed

ranxianglei wants to merge 1 commit into
masterfrom
2026-10-01_omp-attach-preset-proxy

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #1795 (omp half — pi half is #1796).

The hole

omp had the same pseudo-attach hole as pi (#1795): a preset BILLION_CONTEXT_PROXY (e.g. from an outer bili MITM launch, or a user-exported proxy) closed nativeBootstrapGate, so:

  • installNativeFetchIntercept never installed → model traffic went direct, uncompressed, the proxy never saw the session;
  • the shared plugin (pi.ts) still found the proxy through the env → tools/acp/compaction cancel pointed at it → every tool forward 404'd against a proxy that never saw the model channel;
  • ompTrafficRidesBili treated the preset as "riding bili" and widened the OMP native: preflight SSE comments do not reset 300s first-event timeout (Working → aborted) #1774 watchdog — hiding the hole while routing was dead.

The fix — port the #886/#983 posture to omp (mirrors pi #1796, opencode, dsh)

  • planNativeOmp: precedence kill-switch (BILLION_CONTEXT_PLUGIN=0/BILI_NATIVE_OMP=0) > /bili/ launch (BILI_PROVIDER_REWRITES) > attach (BILLION_CONTEXT_ATTACH ?? BILLION_CONTEXT_PROXY) > spawn. Garbage/blank presets fall back to spawn (self-managed), never dead-off.
  • armNativeOmp: attach mode arms even under NODE_TEST_CONTEXT; env written synchronously so pi.ts readers align immediately; runtime death re-probed via verifyAttachAndRecover; bug: dsh-native — attach 目标瞬时不可达 → 回退 spawn 第二实例:routed baseURL 下工具/模型通道必然脑裂(工具 404 → preflight 502 → 会话不可自愈) #1365 late routed-evidence rebind (only converges on a reachable target).
  • verifyAttachAndRecover: healthy target stays attached (a transient blip costs nothing — the session never migrates); DEAD + routed evidence → wait for the pinned origin to come back instead of spawning a second instance that would 404 tools; DEAD with no evidence past BILI_ATTACH_EVIDENCE_GRACE_MS → unfreeze the preset env and fall back to a self-spawned proxy.
  • installNativeFetchIntercept installs whenever mode !== "off" — the actual hole.
  • ompTrafficRidesBili keeps its pinned semantics (a preset proxy means a launcher owns routing, regardless of the native opt-out) — unchanged.

Tests

…ative lane

omp had the same pseudo-attach hole as pi (#1795): a preset
BILLION_CONTEXT_PROXY closed nativeBootstrapGate, so the fetch
intercept never installed — model traffic went direct and
uncompressed while tools still found the proxy through the env,
and every tool forward 404'd. ompTrafficRidesBili even treated the
preset as "riding bili" for the #1774 watchdog, hiding the hole.

Port the #886/#983 posture to the omp lane (mirrors pi PR #1796
and opencode/dsh):

- planNativeOmp: kill-switch > /bili/ rewrite launch > attach
  (BILLION_CONTEXT_ATTACH ?? BILLION_CONTEXT_PROXY) > spawn;
  garbage/blank presets fall back to spawn, never dead-off
- armNativeOmp: attach mode arms even under NODE_TEST_CONTEXT —
  env written synchronously (pi.ts readers align), runtime death
  re-probed via verifyAttachAndRecover, #1365 routed-origin rebind
- verifyAttachAndRecover: healthy target stays attached (no
  migration); DEAD + routed evidence waits for the pinned origin
  (no second instance that would 404 tools); DEAD with no evidence
  past BILI_ATTACH_EVIDENCE_GRACE_MS unfreezes the env and falls
  back to a self-spawned proxy
- installNativeFetchIntercept now installs whenever mode !== off —
  the actual hole

ompTrafficRidesBili keeps its pinned semantics (a preset proxy
means a launcher owns routing, regardless of the native opt-out).

Tests: plan semantics incl. the #1795 regression pin, dead-target
fallback spawn replacing the env origin, healthy-target stay-put
against a real manifest server.
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-01_omp-attach-preset-proxy (495cd77)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.1829-pr.1845.5025f9d

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

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

Folded into #1796 (commit 39aa737) per owner request — one PR, both lanes. CI on #1796 was re-triggered by the push; the earlier windows failures predate master's #1799 dsh-native flake fix and the branch now carries it.

@ranxianglei ranxianglei closed this Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant