Skip to content

[PR] fix: keep INLINE_ORIGIN model traffic in-process past the #1662 cutoff (pi-web-access 0.46+) - #6847

Open
ranxianglei wants to merge 1 commit into
masterfrom
2026-11-15_fix-6829-pi-web-access-046
Open

ranxianglei wants to merge 1 commit into
masterfrom
2026-11-15_fix-6829-pi-web-access-046

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #6829

What

Every model call fails in 10-120 ms with getaddrinfo ENOTFOUND billion-context.inline until the host process is restarted, after a single web tool call that uses a proxy (e.g. fetch_content { proxy: "http://127.0.0.1:7890" }).

Root cause

pi-web-access >= 0.46 renamed its install marker from __piWebAccessProxyFetch to __piWebAccessSharedProxyFetch (its install guard now keys on the new name). bili never reads the new name, so the #2435 coexistence branch became unreachable and every install fell into the generic #1158 re-chain. The re-armed top then hit the #1662 depth-1 cutoff, which hands the pending request to the oldest live anchor (the host's native fetch) without checking the URL origin. For bili's own http://billion-context.inline/bili/... model URLs that is a real DNS lookup for a pseudo-origin — a guaranteed ENOTFOUND, on every model call, until restart. (The #1662 warn is once-only, so the rest fail silently.)

Two defects, one repro:

  1. ROUTING (critical) — the DSH0.1.7-rc.2中billion-context与dsh-codex-subscription的冲突? #1662 cutoff must not truncate INLINE_ORIGIN URLs to the host anchor. They are served in-process by the inline transport link, reached via the [PR] pi inline mode: add Codex WebSocket channel — local loopback WS bridge + relaxed toggle value constraints | pi inline 模式补上 codex WebSocket 通道:本地回环 WS 桥 + 开关取值放宽 #4527 chainHop legitimate descent.
  2. STABILITY — the chain must propagate the NEW shared-flag marker so pi-web-access's own install guard sees "a wrapper is already in the chain" and does not re-wrap on every proxied web tool call (unbounded (wrapper, bili-link) growth — the DSH0.1.7-rc.2中billion-context与dsh-codex-subscription的冲突? #1662 churn shape).

Fix

Behavior change (old → new)

  • Old: after a proxied web tool call, every subsequent model call → ENOTFOUND billion-context.inline until host restart.
  • New: model calls are served in-process by the inline transport; the pi-web-access wrapper stays a single stable link (no per-call re-wrap growth).
  • No change to non-inline lanes, to proxy-mode (non-native) traffic, or to the model-routing rewrite itself.

Tests

  • New regression test in tests/native-intercept-selfheal.test.ts: a 0.46.0-shape wrapper (shared-flag guard + marker) + INLINE_ORIGIN origin → asserts the model URL is served in-process by the inline transport (NOT a real DNS lookup at the host anchor) and that a second proxied web call does not re-wrap (one wrapper).
  • Full native-intercept-selfheal suite: 26/26 pass. Related suites (native-intercept, pi-inline, launcher-pi-inline, issue1086/1542/1683-chain-*, pi-native, opencode-native, plugin-native-binding): all green. tsc --noEmit clean for the touched files.

…cutoff; recognize pi-web-access 0.46+ shared marker

pi-web-access >= 0.46 renamed its install marker from
__piWebAccessProxyFetch to __piWebAccessSharedProxyFetch, so bili's #2435
coexistence branch became unreachable and every install fell into the
generic #1158 re-chain. The re-armed top then hit the #1662 depth-1
cutoff, which handed bili's own http://billion-context.inline model URLs
to the oldest live anchor (the host's native fetch) — a real DNS lookup
for the pseudo-origin, i.e. getaddrinfo ENOTFOUND on every model call
until the host restarted.

Two defects, one repro:
  (1) ROUTING — the #1662 cutoff must not truncate INLINE_ORIGIN URLs to
      the host anchor. They are served IN-PROCESS by the inline transport
      link, reached via the #4527 chainHop legitimate descent. installFetchChain
      now takes an optional inlineOrigin; when the URL starts with it, the
      depth-1 branch continues the descent instead of truncating.
  (2) STABILITY — the chain must propagate the NEW shared-flag marker so
      pi-web-access's own install guard sees a wrapper already in the chain
      and does not re-wrap on every proxied web tool call (unbounded
      (wrapper, bili-link) growth). Each link now exposes a
      __piWebAccessSharedProxyFetch getter (reflects ds), the guard setter
      and the depth-1 retention recognize BOTH marker names.

pi-inline.ts and native-intercept.ts pass INLINE_ORIGIN. On non-inline
lanes (dsh, real loopback origin) the check is a no-op.

Regression test: tests/native-intercept-selfheal.test.ts (a 0.46.0-shape
wrapper + INLINE_ORIGIN origin — model traffic served in-process, wrapper
stays one).
@ranxianglei ranxianglei added bug Something isn't working p1 pi scope:wiring labels Nov 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-15_fix-6829-pi-web-access-046 (4c78a25)

Latest build — install this exact version

npm install -g billion-context@0.0.10213-pr.6847.808941b

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
4c78a25 billion-context@0.0.10213-pr.6847.808941b build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr6847.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix: keep INLINE_ORIGIN model traffic in-process past the #1662 cutoff (pi-web-access 0.46+) [PR] fix: keep INLINE_ORIGIN model traffic in-process past the #1662 cutoff (pi-web-access 0.46+) Nov 15, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷

查重: 重复 #6841 — 两个 open PR 都修 #6829(pi-web-access 0.46 共享代理标记 / INLINE_ORIGIN 流量走真 DNS)。#6841(sx4im,2026-11-15 14:35 UTC)先开,本 PR #6847(ranxianglei,15:05 UTC)后开。同一 bug、同一修法,违反「一个 issue 一个修复 PR」。

结构化八问

  1. 是什么问题: pi-web-access ≥ 0.46 把代理 fetch 的标记名从 __piWebAccessProxyFetch 改成 __piWebAccessSharedProxyFetch,bili 只认旧名 → fix: preserve pi-web-access proxy fetch coexistence #2435 共存分支不可达,每次代理 web 工具调用后,后续所有模型调用都 ENOTFOUND billion-context.inline(伪域名走真 DNS),直到宿主重启。

  2. 什么原因导致的: 两个缺陷——(a) DSH0.1.7-rc.2中billion-context与dsh-codex-subscription的冲突? #1662 depth-1 截断把 INLINE_ORIGIN 的模型 URL 交给宿主原生 fetch(真 DNS 查询伪域名);(b) 链没传播新的 shared-flag 标记,pi-web-access 的守卫看不到「链里已有 wrapper」,每次代理调用都重新包裹(wrapper 无限增长)。

  3. 影响范围与严重程度: 使用 pi-web-access ≥ 0.46 + 代理的 pi 内联车道用户;一次代理 web 调用后,所有模型调用失败(完全不能用),直到宿主重启。严重(核心功能失灵,可用性问题)。

  4. 怎么修复的: (a) DSH0.1.7-rc.2中billion-context与dsh-codex-subscription的冲突? #1662 截断前,INLINE_ORIGIN 的 URL 继续下探(return send(input, init))而不是交给宿主锚点,经 [PR] pi inline mode: add Codex WebSocket channel — local loopback WS bridge + relaxed toggle value constraints | pi inline 模式补上 codex WebSocket 通道:本地回环 WS 桥 + 开关取值放宽 #4527 合法下探由内联引擎进程内服务;(b) 每个链链接暴露 __piWebAccessSharedProxyFetch getter(反射 ds),pi-web-access 看到「链里已有 wrapper」不再重包;(c) 守卫识别两个标记名(兼容 < 0.46 与 ≥ 0.46)。

  5. 是否有回归问题: 修复逻辑本身无回归(本地 tests/native-intercept-selfheal.test.ts 26/26 通过,含新增 pi-web-access 0.46+ breaks the #2435 coexistence path, then the #1662 fallback sends inline-origin traffic to real DNS #6829 回归测试)。但本 PR 的实现方式有 bundle 膨胀回归: src/agent/native-intercept.ts 新增 import { INLINE_ORIGIN } from "../inline-engine.js",把 inline-engine 的传递依赖(server 图、web UI、liveness、DNS、registry)拉进每个非内联车道的 bundle。A/B 构建实测(base 2e3cfc973b → 6847 4c78a25b43):

    车道 base 6847 Δ
    dsh-native 2511616 3352281 +840665(+33.5%)
    omp-native 2954668 3795417 +840749(+28.5%)
    opencode 2506013 3270449 +764436(+30.5%)
    pi 2446351 3661144 +1214793(+49.6%)
    opencode-native 5959220 5959797 +577(≈0)
    pi-native 6451000 6451580 +580(≈0)

    即 dsh/omp/opencode/pi 四个非内联车道各多 ~0.76–1.21 MB 死代码(内联引擎在这些车道从不执行)。移除该 import 改用硬编码字符串后,dsh-native = 2512179 ≈ base,证明膨胀完全由 import 引起。[PR] fix: recognize pi-web-access 0.46 shared proxy marker and keep inline traffic off real DNS #6841 的硬编码方式完全没有此问题。

  6. 是否破坏缓存: 不涉及(纯 fetch 路由/标记修复,不碰缓存/重试/游标)。

  7. 是否改了设计方向: 本 PR 把 inline-engine 的依赖引入 shared native-intercept.ts,改变模块依赖方向——所有车道现在传递依赖 inline-engine 的图。[PR] fix: recognize pi-web-access 0.46 shared proxy marker and keep inline traffic off real DNS #6841 保持 fetch-chain 与 server 图解耦(其注释明确「chain module must stay free of the server graph」)。

  8. 是否引入新配置: 不涉及(无新 env/config)。

结论与建议

🔶 需要决策 — 两个 PR 修同一个 #6829,留哪个?

我不关闭任何 PR(关闭权在 owner),也不改源 issue。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pi-web-access 0.46+ breaks the #2435 coexistence path, then the #1662 fallback sends inline-origin traffic to real DNS

1 participant