Skip to content

[PR] fix: recognize pi-web-access 0.46 shared proxy marker and keep inline traffic off real DNS - #6841

Open
sx4im wants to merge 3 commits into
ranxianglei:masterfrom
sx4im:fix-6829-pi-web-access-fetch-chain
Open

sx4im wants to merge 3 commits into
ranxianglei:masterfrom
sx4im:fix-6829-pi-web-access-fetch-chain

Conversation

@sx4im

@sx4im sx4im commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

pi-web-access 0.46 changed how it marks its proxy fetch: it only sets __piWebAccessProxyFetch when the wrapped fetch already has it, and marks its own wrapper with __piWebAccessSharedProxyFetch instead. The fetch chain only knew the old name, so the #2435 coexistence path was unreachable and every install fell into the generic re-chain. The #1662 escape then sent the rewritten inline-origin request to the oldest live anchor, which is a real DNS lookup for a host that has no DNS record, so model calls failed with ENOTFOUND. Only the first one is logged, so the rest failed silently.

This recognizes both marker names in the depth-1 branch, the install guard, and the marker the chain forwards, and never routes pseudo-origin traffic to the anchor: it goes down the chain instead, where the hop stamp lets the inline transport serve it in-process.

Verified with two new regression tests: the pi-inline composition test with a 0.46-style wrapper (model and management requests served in-process, wrapper hook still runs) and the self-heal diagnostics test (shared-marker install adopted as coexistence). Targeted suites pass 34/34 and typecheck is clean. Full-suite verdict is remote CI on this head.

Fixes #6829

… traffic off real DNS

pi-web-access 0.46 only sets __piWebAccessProxyFetch when the wrapped fetch
already has it, and marks its own wrapper with __piWebAccessSharedProxyFetch
instead. The fetch chain only knew the old name, so the ranxianglei#2435 coexistence
branch was unreachable and every install fell into the generic re-chain. The
ranxianglei#1662 escape then handed the rewritten INLINE_ORIGIN request to the oldest
live anchor, a real DNS lookup that dies ENOTFOUND, and only the first
occurrence is logged, so every later model call failed silently.

Recognize both markers in the depth-1 branch, the install guard, and the
marker the chain forwards, and never route pseudo-origin traffic to the
anchor: send it down the chain instead, where the hop stamp lets the inline
transport serve it in-process.
@ranxianglei ranxianglei changed the title fix: recognize pi-web-access 0.46 shared proxy marker and keep inline traffic off real DNS [PR] fix: recognize pi-web-access 0.46 shared proxy marker and keep inline traffic off real DNS Nov 15, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

Reviewed the diff, traced the fetch-chain mechanics, and ran the targeted suites locally.

What I verified

  • The fix is correct. At depth 1, the new INLINE_ORIGIN check routes pseudo-origin traffic down the chain via send() — which stamps the hop, so the inline-transport link recognizes the descent ([PR] pi inline mode: add Codex WebSocket channel — local loopback WS bridge + relaxed toggle value constraints | pi inline 模式补上 codex WebSocket 通道:本地回环 WS 桥 + 开关取值放宽 #4527) and serves it in-process — instead of terminating at the oldest live anchor (the real native fetch → a genuine DNS lookup for billion-context.inline, which has no DNS record → ENOTFOUND). The check only fires for bili's own pseudo-origin URLs (a foreign plugin never produces them), so it cannot mis-route third-party traffic.
  • The marker broadening is safe. isPiWebAccessFetch now recognizes both __piWebAccessProxyFetch and __piWebAccessSharedProxyFetch in the depth-1 branch, the install guard, and the forwarded chain marker. The shared marker is pi-web-access-specific (low false-positive risk), and even a mis-recognition degrades to "retain at depth 1" — a safe default.
  • The INLINE_ORIGIN duplication is justified. It's owned by src/inline-engine.ts:27 and duplicated in src/agent/fetch-chain/index.ts because inline-engine.ts imports ./server.js + ./server/handle.js, which would cycle back through the agent lanes; the chain module must stay server-graph-free. The new test pins the value indirectly (a drift would ENOTFOUND and fail the assertion).
  • Both new regression tests have teeth. The pi-inline composition test (0.46-style wrapper: model + mgmt served in-process, wrapper hook still runs, real upstream untouched) and the self-heal diagnostics test (shared-marker install adopted as quiet coexistence, exactly one info line, no warn).

八问(结构化审核)

  1. 是什么问题:pi-web-access 0.46+ 改了代理 fetch 的标记方式——只在上层 fetch 已带旧标记时才透传 __piWebAccessProxyFetch,自己的 wrapper 改打 __piWebAccessSharedProxyFetch。bili 的 fetch 链只认旧名,fix: preserve pi-web-access proxy fetch coexistence #2435 的静默共存路径走不到,inline 流量被 DSH0.1.7-rc.2中billion-context与dsh-codex-subscription的冲突? #1662 的锚点终止甩到最老活锚(真实原生 fetch),对没有 DNS 记录的 billion-context.inline 发起真实 DNS 查询 → ENOTFOUND,且只记第一条、其余静默失败。
  2. 什么原因导致的:根因是标记名漂移——0.46+ 的 wrapper 只带 shared 标记,而 bili 的 depth-1 分支、安装守卫、链转发三处都只认旧标记名,导致共存握手识别失败 + 伪源流量被错误路由到真实 DNS。
  3. 影响范围与严重程度:装了 pi-web-access 0.46+ 且走 inline(pi lane)的用户——模型调用全部 ENOTFOUND,该 lane 完全不可用。严重度 p1(可用性缺陷:该组合下模型调用彻底失败)。
  4. 怎么修复的:三处都认两个标记名(depth-1 分支 / 安装守卫 / 链转发),并在 depth-1 分支加一道伪源保护:URL 以 INLINE_ORIGIN 开头就走 send() 沿链下行(盖 hop 戳,inline transport 按 [PR] pi inline mode: add Codex WebSocket channel — local loopback WS bridge + relaxed toggle value constraints | pi inline 模式补上 codex WebSocket 通道:本地回环 WS 桥 + 开关取值放宽 #4527 识别下行、进程内服务),绝不交给最老活锚做真实 DNS。
  5. 是否有回归问题:无。INLINE_ORIGIN 检查只对 bili 自产的伪源 URL 生效(第三方插件不会产这种 URL);非 inline 模式下模型 URL 被改写到真实代理源,该检查是 no-op。标记放宽是 pi-web-access 专属(误判风险低,且误判也只是"depth-1 保留"这一安全默认)。标记转发纯增量。既有的 DSH0.1.7-rc.2中billion-context与dsh-codex-subscription的冲突? #1662 锚点终止、[PR] pi inline mode: add Codex WebSocket channel — local loopback WS bridge + relaxed toggle value constraints | pi inline 模式补上 codex WebSocket 通道:本地回环 WS 桥 + 开关取值放宽 #4527 hop 下行、fix: preserve pi-web-access proxy fetch coexistence #2435 共存握手、方式一安装的dsh 原生插件:llm-pi-ai 传输(OpenAI SDK + options.fetch 注入)绕过 globalThis.fetch 拦截,模型请求不进代理、压缩完全不生效 #1158 自愈重装等行为逐项核对,无破坏。
  6. 是否破坏缓存:不涉及。未触碰任何缓存 / 重试 / 去重 / 增量游标逻辑。
  7. 是否改了设计方向:不涉及。修复完全在既有 fetch-chain 架构内,只是扩展标记识别 + 加一道伪源路由保护,没有转向。
  8. 是否引入了新的配置:不涉及。无新 env / config / CLI flag。

本地验证:定向套件 34/34 通过(含两条 #6829 回归测试),typecheck 干净。

CI 状态(实时):仍在跑——30 项中 0 失败 / 13 pending(test 分片排队/进行中,e2e 车道按门跳过,static-gates 进行中)。已绿:mysql-contract、architecture-docs、lock-sync、lifecycle-ledger-guard、test-import-graph。

判定:代码方向正确、修复到位、测试有牙、本地定向全绿。等 CI 全绿后给最终合入判定——CI 落地后我会补一条确认。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

CI 落地了,补最终判定。

CI 结果(实时):30 项全部完成。11 个 test 分片(ubuntu/windows × node 22/24)全绿;static-gates ubuntu 24 绿;mysql-contract / architecture-docs / lock-sync / lifecycle-ledger-guard / test-import-graph 全绿。唯一红:static-gates (windows-latest, 22)。

红的根因(与本 PR 无关):失败的是 kernel 性能测试 kernel/tests/issue5337-shared-screening.test.ts 的子测试 "real recommend chain at n=20000 stays linear-ish"——一条计时断言(cap 3000ms,实测 best-of-3 = 9135ms,同机 pre-fix 基线 9028ms)。本 PR 只动 3 个文件(src/agent/fetch-chain/index.ts + 两个 bili 测试),完全不碰 kernel/,kernel 代码与 master 逐字节一致;同一条 kernel 测试在 ubuntu static-gates 上是绿的。所以这是 Windows runner 偏慢导致的计时抖动,不是本 PR 引入的回归。

处置:建议对 static-gates (windows-latest, 22) 点一次 re-run(大概率转绿)。若 Windows 上该计时 cap 反复飘,那是既有的测试标定问题(3000ms 的 cap 对 Windows 偏紧),与本 PR 无关,可另行在 CI 总控 #4599 跟踪——按规不为 CI 抖动单开 issue。

最终判定:代码方向正确、修复到位、测试有牙、本地定向 34/34 + typecheck 干净、test 分片全绿;唯一红是无关的 kernel 计时抖动。可合——代码无问题,等 re-run 转绿即可,或 owner 直接合(红的不是本 PR 的锅)。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

CI fixed — static-gates (windows-latest, 22) is green; the full run is now completed success (attempt 2).

What I did this run:

  1. Re-verified live check state first: on head 8895a2ca7a exactly one check was red — static-gates (windows-latest, 22); all test lanes, the other three static-gates lanes, and the contract lane were green/skipped (28 jobs total, 1 failure).
  2. Fetched the failing job log: the only failure is kernel/tests/issue5337-shared-screening.test.ts:285 — the timing scale test "real recommend chain at n=20000 stays linear-ish" (cap 3000ms, best-of-3) measured 9135ms.
  3. Diagnosed it as a noisy-runner timing flake, not a code problem:
    • This PR's diff touches only src/agent/fetch-chain/index.ts + two bili test files — zero kernel changes; the failing code is byte-identical to the PR base.
    • Master's run on the SAME base sha (2e3cfc973b, run 43732097311) passed the same job an hour later: the same test recorded 1426ms (cap 3000ms).
    • The failing PR runner was 4× slower even on the linear n=2000 record (85.3ms vs 21.5ms on identical code) — a slow/loaded runner, and the super-linear n=20000 stage blew through the cap (9135ms).
  4. Triggered rerun-failed-jobs on run 43725225063 → attempt 2: static-gates (windows-latest, 22) succeeded with the test at 1541ms (consistent with master's 1426ms); the whole run is completed success.
  5. No code changes, no push — the PR stays at head 8895a2ca7a. The new flake signature is logged in CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599 for evidence accumulation; if the same signature recurs on a clean runner it escalates to master-level test hardening (converging on ci-fixes) per the established precedent.

八问:

  1. 是什么问题: PR 唯一红 check static-gates (windows-latest, 22) 挂在 kernel 计时测试(issue5337,n=20000,cap 3000ms,实测 9135ms)——是噪声/慢 runner 上的计时 flake,不是代码缺陷。
  2. 什么原因导致的: PR diff 完全不碰 kernel/(仅 src/agent/fetch-chain/index.ts + 2 个测试文件),失败代码与 base 逐字节相同;失败 runner 连线性 n=2000 记录都比同 sha 的 master run 慢 4×(85.3ms vs 21.5ms),属慢/负载 runner,把超线性的 n=20000 阶段推过 cap。
  3. 影响范围与严重程度: 仅本 PR 检查矩阵(信号级),无用户侧影响;代码本身无恙(同 sha 的 master run 与重跑后均绿)。
  4. 怎么修复的: 无代码改动——rerun-failed-jobs 重跑(attempt 2 全绿,1541ms,与 master 1426ms 一致);flake 签名已记入 CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599,同签名在干净 runner 再现则按先例升档 master 级测试硬化(收敛 ci-fixes)。
  5. 是否有回归问题: 无——零代码改动、无语义漂移;重跑计时(19.2ms/1541ms)与 master run(21.5ms/1426ms)一致,确认行为未变。
  6. 是否破坏缓存: 不涉及。
  7. 是否改了设计方向: 没有。
  8. 是否引入了新的配置: 没有。

判定: PR #6841 CI 全绿(head 8895a2ca7a,attempt 2),可进入 review/merge。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

…s proxy scope on (ranxianglei#6829)

With a pi-web-access proxy scope active, the wrapper sitting above the
inline link curls INLINE_ORIGIN URLs itself, so the ranxianglei#1662 depth-1 fix
never runs on that path and 0/2 inline-origin requests reach the engine
(scope OFF: 2/2). A second leak exists for requests inheriting a stale
dispatchDepth (ranxianglei#5614 shape), which skip dispatchBody entirely.

Fix (routing-only, no default/budget change):
- fetch-chain: exact-origin classifier isInlineOriginUrl (URL-parse;
  http only, exact hostname, default port, no credentials) and a
  classify-first check in patched — INLINE_ORIGIN requests run the
  link's own dispatch at a fresh depth 1 instead of being handed down
  the chain. The old depth-1 prefix route-down is removed.
- pi-inline: the serve logic is extracted as exported serveInlineOrigin
  (undefined when not installed or not an inline-origin URL); the link
  dispatch delegates to it.
- native-intercept: the dispatch's send is wrapped so every INLINE_ORIGIN
  send is served in-process via serveInlineOrigin; all other sends pass
  through untouched. Unconditional: bili cannot observe the wrapper's
  scope state from outside, so there is no signal to divert on.

Tests: three new regression tests in tests/pi-inline.test.ts (proxy-scope
ON/OFF, stale dispatchDepth, exact-origin classification) plus an updated
ranxianglei#6829 expectation (the wrapper never sees pseudo-origin traffic now);
11/11 pi-inline, 29/29 self-heal + ranxianglei#5614 neighbours.

Fixes ranxianglei#6829

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

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

2 participants