Repository navigation
[PR] fix: drop stale host proxy hops from intercepted dispatches (#4566 part 1) - #4878
Conversation
…rt 1) A host process memoizes its proxy hop (Bun init.proxy from PI_PROXY_ANTHROPIC / env HTTP(S)_PROXY) for its whole life. When a lane port moves under live hosts (ladder drift, #4566), that stale hop rides every dispatch: - loopback-rewritten /bili/ targets get dialed through the dead port -> connection refused on every model turn; - direct fallbacks keep the hop even when it points at a bili-owned lane port -> TLS terminates on whichever bili answers there and hosts without the bili CA fail SELF_SIGNED_CERT_IN_CHAIN. src/agent/native-intercept.ts: - hoplessForLoopback: every dispatch whose final target is loopback (rewrite, self pass-through, post-respawn reroute/retry, dsh-compaction divert) now strips init.proxy — a loopback origin never needs a hop. - sanitizeFallbackHop in directSendOrRefuse: evidence-gated cleanup for direct fallbacks — drops an init.proxy whose normalized value matches a bili-owned origin (PI_PROXY*/BILLION_CONTEXT_PROXY env values, state.origin, state.routedOrigin, replaced origins), and arms a per-host NO_PROXY hold (refcounted, base restored exactly at zero, held until the send settles) when the scheme-specific env hop is bili-owned. User-chosen non-bili hops are never touched (KDD-9 permitlist discipline). Behavior change (disclosure): intercepted dispatches no longer carry the host's init.proxy to loopback targets (healthy-lane case was a harmless self-proxy round trip before); fallback dispatches drop bili-owned hops and scope a temporary NO_PROXY entry. Unattributed third-party traffic keeps its posture untouched. Node-host NO_PROXY writes are inert (undici caches env at dispatcher creation); Bun — the affected runtime — honors them per request. Tests: 8 new positive+negative cases in tests/native-intercept.test.ts (#3617 gate discipline), incl. concurrent-hold refcounting and exact NO_PROXY base restoration. All 74 file-local + 150 cross-suite targeted tests green; full-suite verdict deferred to CI. Part 2 of #4566 (the lane itself moving under serving hosts) awaits the owner decision requested in the issue thread.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.8796-pr.4878.49902a1This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4878.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…+ divert-site strip (#3617) #3617 requires both directions per gate; the loopback strip gate shipped without its keep direction (hop must RIDE when the final target is NOT loopback, e.g. a remote bili instance), and the dsh-compaction divert site claimed in the PR description had no dedicated row. Added both: - negative: non-loopback origin keeps the host's own init.proxy intact; - positive: diverted dsh-compaction dispatch carries no stale hop.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 进度汇报(进程被看门狗重启前的状态) 上一条审核回复之后的进展:
审核结论不变:代码与行为独立复核通过、无回归、#3617 双向已补齐;唯一待办就是这个 head 的全量 CI 绿。合并权在 owner。 |
(ai: vllm-qwen/qwen3.8-27b) 全量套件结论落地:CI 全绿,PR 接本线程前面的完整审核与进度报告。补充说明触发过程:我 17:14Z 推送补测提交后,synchronize webhook 没有送达(该 push 没有任何 workflow run 产生);随后镜像标签同步的 labeled 事件按 ci.yml(#3295)设计都是 scope=skip(非 ci:full 的 labeled 事件不跑矩阵)。于是用两条正规路径补齐了全量:
结构化八问
判定:可合并(合并权在你,我不代合)。Part 2 待 A1/A2 决策后单独出 PR。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) |
…-stale-proxy-hop Conflict resolution (src/agent/native-intercept.ts) — both intents preserved: - directSendOrRefuse: current master's #5405/#5408 silent-direct byte-ceiling refusal runs first (a refusal arms no NO_PROXY hold), then #4566's sanitizeFallbackHop wraps the as-is/restored sends in try/finally. - routed / self / rewrite / retry sites: #4566's hoplessForLoopback(target, init) is combined with master's allExtra / branchExtra pf-watermark headers (#5403/#5418) and its self-branch stamp+learn.
|
I prepared an additive merge candidate for this PR against current master. Candidate commit: Maziar123@4d4cde1 It resolves the conflicts in I cannot push directly to this PR's branch, so the candidate is on my fork: https://github.com/Maziar123/billion-context/tree/local-repair/pr-4878-20261109. Please cherry-pick or use it as a reference. |
[bot] 🏷 Merge conflict resolved & pushed (attempt 1/3, CI engineer) I resolved the dirty merge state on What was wrong: the branch was cut off an old master ( How I resolved it: adopted Maziar123's additive merge candidate Verification I ran this run (targeted, per local-testing discipline):
Push + live CI (verified against the mirror cache this run, not from memory): confirmed remote head was still 七问(中文结构化结论)
判定:冲突已解决并推送,本地定向验证全绿,CI 新 head 目前 0 失败(慢速 e2e/guard 车道仍在跑)。收工;最终全绿以 CI 为准。 |
[bot] 🏷 Already green — no fix needed (re-verified live this run) Re-checked against live sources before touching anything:
So the earlier wake already cleared what this event reports — nothing left to fix. Stopping without further code work. 七问(中文结构化结论)
判定:当前 head CI 全绿,冲突与红 CI 均已解决,收工,无进一步工作。 |
[ework] CI fix verified green ✓ |
Part 1 of #4566 — the host's cached proxy hop surviving lane re-targeting. Part 2 (the lane itself moving under serving hosts) awaits the decision requested in the issue thread (A1 vs A2) and will land as its own PR.
What was wrong
A plugin host memoizes its proxy hop for its whole process life (Bun
init.proxystamped fromPI_PROXY_ANTHROPIC, plus the launcher-exportedHTTP(S)_PROXY). When a lane port moves under live hosts (ladder drift), that stale hop rides every dispatch the intercept performs:/bili/targets dialed through the dead port →connection refusedon every model turn;SELF_SIGNED_CERT_IN_CHAIN.Fix (src/agent/native-intercept.ts only)
hoplessForLoopback): rewrite, self pass-through, post-respawn reroute/retry, and dsh-compaction divert all stripinit.proxywhen the final target is loopback — a loopback origin never needs a hop.sanitizeFallbackHopindirectSendOrRefuse, the single choke point): evidence-gated per KDD-9 permitlist discipline —init.proxywhose normalized value matches a bili-owned origin (PI_PROXY*/BILLION_CONTEXT_PROXYenv values,state.origin,state.routedOrigin, replaced origins);NO_PROXYhold (refcounted, base restored exactly at zero, held until the awaited send settles) while the scheme-specific env hop points at a bili origin.Behavior change (disclosure)
init.proxyrode along (healthy case = self-proxy round trip; broken case = dead port)init.proxy+ env hop always honoredNO_PROXY; user-owned values untouchedUnattributed third-party traffic (non-model URLs, passthrough) keeps its posture untouched. Node-host
NO_PROXYwrites are inert (undici caches env at dispatcher creation; Node fetch does not consume these vars) — Bun, the affected runtime, honors them per request.Rebase note
Rebased onto master
23158db38; semantic conflict indirectSendOrRefuseresolved as union of intent with #4516's new fallback guards (degradeLogparam, local oversize refusal) — hop hygiene sits after both local-refusal paths so no hold is armed for refusals.Tests
8 new positive+negative cases in
tests/native-intercept.test.ts(#3617 gate discipline): loopback strip across the four loopback sites, fallback owned-hop drop, negative user-hop keep, env-hop NO_PROXY arming + exact base restore, concurrent-hold refcounting, retry strip. Local targeted: this file 74/74 + all nine other suites importing the module 151/151 + typecheck clean; full-suite verdict deferred to CI.Refs #4566 (part 1 of 2).