Skip to content

[PR] fix(#2645): probe-and-remember prompt_cache_key — stamp by default, self-heal strict upstreams - #3736

Merged
ranxianglei merged 9 commits into
masterfrom
2026-10-18_pck-probe-remember
Oct 19, 2026
Merged

ranxianglei merged 9 commits into
masterfrom
2026-10-18_pck-probe-remember

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Fixes #2645 · Supersedes #2649 · Absorbs #3556(attribution table below)

What breaks today, and why a static gate can't fix it

On master the plugin lane stamps prompt_cache_key = session.id into every OpenAI chat body sent to ANY destination(legacy shouldStampRelayAffinityPck in src/session-id.ts: the routeRewrittenUrl !== undefined leg is a dead short-circuit because billingUpstream is virtually always defined — see src/server.ts billingUpstream = route?.rewrittenUrl ?? …, and the remaining leg only matches localhost/127.*/::1). The stamp exists because account-pool / relay operators read this field as prefix-cache routing affinity(#2218). But some strict OpenAI-compatible endpoints reject unknown body parameters outright — #2645: on the SAME origin integrate.api.nvidia.com, super-120b answers 200 with the key while ultra-550b answers 400(Validation: Unsupported parameter(s): \prompt_cache_key``) → dsh plugin-lane turns die with sub-second 400s.

No static destination gate separates the affected populations:

This change: stamp by default, verify by A/B, remember in memory

  1. Stamp everywhere by default. Restores master behavior for every destination; a client-provided prompt_cache_key passes through untouched by default. Zero regression for pools regardless of where they sit.
  2. A/B probe at the egress seam(src/server/relay.ts, same shape as the existing billion-context: 400 Bad Request when codex sends role: "developer" messages — request a request-body compat transform hook #552 role-rewrite ladder). When a plugin-lane request gets a 400 back, the error body is drained, and the identical request is resent ONCE with only prompt_cache_key removed from bili's wire copy(headers re-signed for the new body):
    • resend accepted ⇒ attribution proven: the (origin, model) pair is remembered in process memory(src/pck-probe.ts) and stopped being stamped there for the rest of this process life;
    • resend rejected ⇒ it is NOT this field: the ORIGINAL 400 is forwarded, nothing is learned, the next turn probes again. Misattribution is impossible because the retry IS the verdict. One probe attempt per request, no loops.
  3. Client-supplied keys get the same protection after ablation: dropped pre-egress for an ablated origin+model (otherwise the client re-forces the field onto the wire every turn).
  4. Memory-only state, deliberately(per the issue thread): nothing persists; a restart re-probes at most once per destination. No config surface added.
  5. Users are told wherever they look: WARN log line on first confirmation(naming origin/model/session + the account-pool caveat); an acp_status section listing ablated origins(+model, confirmations, affected sessions) with explicit wording that relay/account-pool affinity may degrade; a web-panel banner(zh/en) naming the affected sessions; and a machine-readable pckSuppressions array on GET /__bili/status.
  6. Model granularity: the remembered key is origin+model, matching the observed rejection shape (two models, one origin, opposite strictness); healthy siblings on a strict endpoint keep their key.

Config surface

None. No new config-field, env var, or CLI flag. This is deliberate: the approved design replaces a static destination decision with an empirical A/B verdict, and the learned state is owner-directed to stay in-memory only. Default path is byte-identical to master; deviations occur only where an upstream proved, live, that it rejects the field.

Both compression modes

  • plugin mode(internal x-bili-plugin-conversation identity): the lane that receives stamps. The decision moves to resolveRelayAffinityPck(identity, clientKey, egressUrl, origin, model) returning "stamp" | "keep-client" | "drop"; stamp on every destination unless ablated. Relay operators who prefer header-based routing are unaffected either way: bili independently forwards x-session-id for internal conversations (src/server.ts).
  • proxy mode(plain client, no identity header): no new stamping ever happens — pure passthrough both directions, byte-for-byte, except the A/B-ablative drop of a CLIENT'S OWN key once that destination has proven it rejects the field.

Absorbed work from #3556(contributor askl56) — attribution

#3556 commit fate here
ddc4d0ab pi-lane stamp-withhold hoist above the routed-through-proxy check + loopback-HTTPS_PROXY predicate + omp-native-identity tests cherry-picked -x → 54f1b964(partial: its session-id rewrite and prepare-openai static client-key strip were superseded by the probe design)
925e6e65 launcher PI_PROXY_ANTHROPIC fill + live proof that Cowork node:https ignores env proxies entirely(Anthropic req_011Cg7cujfgv4xLjuRvLMqvg) — i.e. HTTPS_PROXY presence is NOT routing evidence cherry-picked -x → a8c4c606
eb6f4174 dead-param refactor + "remote destinations never stamped" regression matrix skipped wholesale — its param-refactor is subsumed by the resolveRelayAffinityPck rewrite, and its remote-no-stamp assertions contradict the approved stamp-by-default design
0d185808 launcher truthiness guard(empty/whitespace proxy vars treated as unset) cherry-picked -x → dd401a68
36e073ec docs sync(README/CONFIGURATION en+zh rows, TECHNICAL-NOTES caveat) cherry-picked -x → b0980718

Original authorship kept via -x trailers. Thanks @askl56 — your live Cowork verification became load-bearing for the pi-lane half.

Test evidence(on the pushed head)

  • NEW tests/issue2645-pck-probe.test.ts(7 cases): strict upstream self-heals(client sees 200; upstream saw key-stamped then keyless bodies; ablation entry carries origin/model/session; /__bili/status pckSuppressions populated; turn 2 is a single keyless hit); lenient pool keeps the key every turn with zero ablations; poisoned always-400 upstream forwards the 400 and re-probes every turn without learning anything; model-granularity(strict model ablates, healthy sibling on the same origin keeps the key); client-owned key — turn 1 fixed transparently, turn 2 dropped pre-egress; memory-reset unit semantics.
  • tests/issue2218-relay-affinity-signal.test.ts: unit matrix rewritten to probe semantics(stamp-on-by-default incl. remote destinations; client key passthrough / post-ablation drop; non-plugin identities never trigger stamping); original 5 e2e cases untouched and green.
  • Local on the rebased head:npm run typecheck clean;npm run build clean including the dist-external-zod gate;core pck lanes 42/42;broad batch(11 files: openai/anthropic pck identity+verbatim, e2e-session-identity, acp-status, advisory-panel, wire-contract, e2e-relay-5xx-selfheal, launcher, etc.)417/417. One environment-sensitive pi-native assertion failed once locally and passed on re-run; it also fails on detached origin/master under this same shell(pre-existing env dependence, not caused by this branch).
  • Full-suite verdict: the CI test lanes on the pushed head.

ranxianglei and others added 6 commits October 18, 2026 23:31
Stamps the dsh plugin lane's relay affinity key on EVERY destination by
default (loopback pools, docker/LAN/VPS pools, plain remote relays alike
keep their prefix-cache affinity — the old loopback/rewritten-route gate
silently dropped it for the two biggest pool populations), and protects
strict direct APIs with a controlled A/B instead of a destination-shape
guess:

- prepare-openai/relay seam: the first 400 from an upstream on a body that
  carried prompt_cache_key re-sends the identical request once without the
  key. Retry accepted = causation confirmed: adopt the response, remember
  the origin+model pair process-locally (in-memory only, restart re-probes).
  Retry also failed = NOT this field's fault: discard the retry, forward
  the original 400 verbatim, learn nothing. No persistence, no config.
- Client-owned keys pass through verbatim until their pair is ablated;
  after confirmation they are withheld too so later turns don't re-pay a
  400 round trip per turn.
- Visible everywhere (owner requirement): one WARN log naming origin/model
  + session + the account-pool caveat; an acp_status section; the web panel
  banner (zh+en); GET /__bili/status field pckSuppressions for scripts.

The egress re-send follows the same discipline as the existing #552
compat-role ladder: buffered error body reused verbatim on passthrough,
resign hook re-applied to the rewritten bytes, wireBody tracks the last
accepted payload (#1900), one attempt per request, no loops.

Both modes reasoned: plugin mode carries the stamped key (internal
conversation header) and gets the A/B protection at egress; proxy mode is
pure passthrough for client bodies and is only touched when the client
itself sent the key to a strict API — same self-heal, key-withheld after
confirmation.

Fixes #2645
…onsumable transports

Adopted from #3556 (ddc4d0a) — the pi.ts + omp test half. The commit's
session-id/prepare-openai/issue2218 changes are NOT adopted: this branch's
first commit replaces that destination-shape gate with A/B-verified
probe-and-remember instead of static stripping (#2649's loopback-only gate
was vetoed — it cost the two biggest relay/account-pool populations their
prefix-cache affinity).

- pi (stampPromptCacheKey): hoist the #2583 Cowork withhold above the
  routed-check so it gates ALL stamp paths. Pre-hoist, the launcher
  cert-MITM lane (BILI_MITM_HOSTS) made destinationRoutedThroughProxy()
  true and skipped the withhold entirely — stamped bodies reached
  Anthropic's strict schema verbatim (#1403 400s).
- pi (ompCoworkTransportBypassesFetch): a LOOPBACK HTTPS_PROXY is bili
  itself and Cowork's node:https honors it — treat as routing evidence
  (stamp); a foreign/non-loopback HTTPS_PROXY is a bypass (withhold).

Tests: 4 new cases in omp-native-identity (MITM withhold, loopback
HTTPS_PROXY stamp, foreign HTTPS_PROXY withhold, predicate matrix).

(cherry picked from commit ddc4d0a)
…PROXY_ANTHROPIC)

The #2583 withhold (hoisted earlier in this branch) correctly stops the
identity stamp from leaking, but Cowork traffic still left the host
direct — uncompressed and invisible to the proxy — because omp's Cowork
transport sends node:https and ignores HTTPS_PROXY entirely (proven live,
Anthropic req_011Cg7cujfgv4xLjuRvLMqvg).

PI_PROXY_ANTHROPIC pushes Cowork onto Bun's own fetch, where the
interceptor's /bili/ rewrite carries it through the proxy as plain
loopback HTTP (no MITM CA involved). Verified live: forward POST →
api.anthropic.com/v1/messages, session-visible, 200, pck scrubbed.

Also reverts the loopback-HTTPS_PROXY clause in
ompCoworkTransportBypassesFetch (same live proof: not routing evidence
for this transport) and flips its tests to the proven posture.

(cherry picked from commit 925e6e6)
… guard

Review nit on #3556: OMP's getProxyForProvider treats an empty-string PI_PROXY_ANTHROPIC and a whitespace-only PI_PROXY as unset, but the === undefined guard counted them as user-set, leaving Cowork on node:https direct (the stamped-body 400 class this PR exists to kill). The guard now mirrors the src/agent/pi.ts predicate exactly.

(cherry picked from commit 0d18580)
README en/zh caveat paragraph, TECHNICAL-NOTES en/zh paragraph (heading omp native -> omp; launcher completion sentence; cert-MITM hoist), CONFIGURATION en/zh (client-table omp row + env appendix PI_PROXY_ANTHROPIC row): the default bili omp launcher lane now routes Cowork through the proxy via PI_PROXY_ANTHROPIC; direct-and-anonymous remains only for native mode and user-pinned proxy postures.

(cherry picked from commit 36e073e)
@ranxianglei ranxianglei changed the title fix(#2645): probe-and-remember prompt_cache_key — stamp by default, self-heal strict upstreams [PR] fix(#2645): probe-and-remember prompt_cache_key — stamp by default, self-heal strict upstreams Oct 18, 2026
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-18_pck-probe-remember (09ad864)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.4420-pr.3736.77e9b34

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

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重:不重复 —— #3736 是 #2645 的收敛性修复 PR,正文明确 Supersedes #2649、Absorbs #3556。三者同属一个机制家族(openai wire 上 prompt_cache_key 无条件 stamp,打挂严格 schema 上游):

⚠️ 协调项:#2649、#3556 目前仍 open。若 #3736 合并,这两个应作为 superseded/absorbed 关闭(关闭/合并动作归人执行,我在最终结论里再点名一次)。

标签:bug / dsh / pi / scope/wiring / p2(缺陷类;正文实证 dsh + pi 两条 plugin-lane;机制落在 relay egress 协议接线层;严格上游下 dsh 插件车道整轮 sub-second 400,但仅限特定 origin+model 且 master 上有配置绕行 → p2;受影响切片内是硬失败、接近 p1,owner 可上调)。

下面按 PR Review 规范审:先拉分支核对代码与 CI 状态,再走结构化八问。

awork added 2 commits October 19, 2026 01:00
…alizeUpstreamOrigin

A provider route's mitm:// config-lookup scheme normalized to the opaque "null"
origin (new URL("mitm://…").origin === "null"). The egress path strips mitm:// to
https:// (forwardUpstreamUrl) before recording the pck ablation, but the prepare-side
lookup fed billingUpstream (which keeps mitm://) into pckKeyAbated — so for mitm-routed
strict destinations the ablation was keyed under https://host yet looked up under "null",
the self-heal never engaged, and the key stayed stamped (re-probing every turn). Strip
mitm://→https:// inside normalizeUpstreamOrigin (its comparable-route-key contract,
#1933); the same latent mismatch also affected the server.ts baseline-origin compare.
Strict no-op for all non-mitm inputs. Test pins the collapse.
…orts gate

The unused-exports gate (which ci.yml makes every test/build lane depend on)
flagged PckAblationEntry (src/pck-probe.ts) and RelayAffinityPckDecision
(src/session-id.ts) as INTERNAL_ONLY — each is referenced only inside its own
file (consumers use the values / string literals, never the type name). Neither
is entry-file API surface, so dropping the redundant `export` changes no public
d.ts and no behavior; it just lets the gate pass so the full suite actually runs.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

PR #3736 审核结论(pck probe-and-remember)。查重:不重复(#3736 是 #2645 的收敛性修复,supersedes #2649、absorbs #3556,同一机制家族)。核心机制我逐行读过(relay egress 的 A/B seam、session-id 决策函数、prepare-openai 落点、pck-probe 记忆体),方向正确。审中发现并已在 PR 分支上修掉两处(见第 4、5 问)。

八问:

  1. 是什么问题:openai chat wire 无条件给每个请求 body 打 prompt_cache_key(前缀缓存亲和键),但部分严格 schema 的上游(如 integrate.api.nvidia.com 的 ultra-550b,同源的 super-120b 却接受)直接 400 拒收这个字段,dsh 插件通道打到这类目的地时每轮秒挂。本 PR 把「无脑打」改成「默认打 + egress 处 A/B 探测记住拒绝者」。

  2. 什么原因导致的:根因是打键决策是静态的——只看「是不是内部插件通道」,不看「这个目的地到底吃不吃这个字段」。严格上游的校验发生在 body 层,代理无法事先知道,只能事后用「带键 400 / 不带键 200」的同参对照(A/B)证明因果,再按 (origin, model) 记进进程内存。

  3. 影响范围与严重程度:只影响插件通道打到严格 schema 目的地的那一片(典型:dsh + 该类端点);其余目的地行为不变。master 上这片是每轮硬 400(完全不可用)、有配置绕行(换端点/绕路);本 PR 后变为可用但前缀缓存亲和可能降级到重启。核心压缩不受影响。p2(条件触发、有绕行);受影响切片本身≈p1,owner 可视情况上调。

  4. 怎么修复的:决策函数 resolveRelayAffinityPck 返回 stamp/keep-client/drop 三态;egress relay 在「插件通道 + 400 + body 带键」时重发一次去掉键的请求(重签 header、只试一次),被接受才记录(learn 方向不可能误归因),被拒则原样转发原 400、不学习、下轮再探。一旦某 (origin,model) 被 ablate,prepare 侧出网前就把键删掉,探针自然不再触发,自愈闭环。我在审核中另修了两处:① normalizeUpstreamOrigin(src/util.ts)对 mitm:// 路由归一成其 https 出网键——否则 provider 走 mitm 路线时,ablation 记在 https 键下、查询却落在 "null" 键上,自愈永不生效(commit c066388,附回归断言);② 去掉两个 INTERNAL_ONLY 导出(PckAblationEntry、RelayAffinityPckDecision)——unused-exports 门禁把它们判红,而 ci.yml 让所有测试/构建 lane 依赖该门禁,这正是之前所有 test lane 显示 skipped 的原因(commit 3d77753)。

  5. 是否有回归问题:两种模式都过了一遍。proxy 模式从不打键(纯透传,唯一例外是目的地被证明敌意时 A/B 摘掉客户端自带的键);plugin 模式拿 stamp。wire fidelity 保持:探测只删 prompt_cache_key 一个字段、重签 header、单次不循环;thinking/signature 通道未碰;无 kernel 改动;无持久化。既有 normalizeUpstreamOrigin 测试(http/https/空白/空串/garbage)对非 mitm 输入全部不变(我的改动对其是 no-op)。有意行为变更(已披露):pi 通道 Cowork 保留门从「未路由 fallback」上提到所有打键路径([Bug] Anthropic requests leak prompt_cache_key when Cowork transport bypasses native fetch interception #2583,cert-MITM 通道此前会漏);launcher 在无代理 env 时给 omp Cowork anthropic 通道填 PI_PROXY_ANTHROPIC(此前直连不压缩)。两者都是本 PR 目的内的修复,非顺带漂移。

  6. 是否破坏缓存:这正是本特性要权衡的点。对被 ablate 的目的地,进程存活期间不再发键 → 这些会话的前缀缓存亲和可能降级(日志/acp_status/面板都已明示,重启重置);未被 ablate 的目的地零变化。误归因风险(一个无关的瞬时 400 被记成「键的锅」)在 WARN 日志里明确标注了 caveat。

  7. 是否改了设计方向:没有转向。仍是「代理执行压缩 + 出网注入」的老架构,只在 egress seam 加了一个进程内、无配置、fail-open 的因果记忆。可见面(acp_status 段落、面板 banner、/__bili/status 的 pckSuppressions)全是加法式诊断,不改数据流。

  8. 是否引入新配置:无。刻意不加任何 env/config/flag(owner 指令:纯内存、config-free)。

测试有效性:新增 tests/issue2645-pck-probe.test.ts 共 6 个行为 case / 48 条硬断言,覆盖自愈单轮、宽松池不误学、无关 400 不归因、model 粒度、客户端自带键先透传后摘除、跨进程不持久化——断言咬在真实 wire body 上,不是恒真。我另补了 issue1933 里一条 normalizeUpstreamOrigin("mitm://…")→https://…origin 的钉子。

CI:我已把阻塞全矩阵的 unused-exports 门禁修绿并推送(head 3d77753),完整 ubuntu/windows × node 22/24 × 3 shard + e2e 现在会真正跑起来(此前因该门禁红而被 skip)。全量判定以远端 CI 为准,跑完我再回报。

判定:可合(机制正确、双模式都过、回归受控、CI 阻塞已清)。剩两件归人:①等 CI 全绿;②合并后把 #2649(superseded)、#3556(absorbed)关闭并在各自线程指回本 PR。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

CI 更新(head 3d77753):我修掉的 unused-exports 门禁已转绿,连带解锁了全矩阵——此前所有 test lane 都是被它 skip 的。现在全部静态门禁/守卫(lock-sync、lane/kernel/pi-subagents/docs/version/config-surface/build-artifact/import-graph、static-gates×OS)已 success,零 failure;只剩 6 个长时 test shard(ubuntu/windows × node 22/24 × 分片)还在跑。跑完我回最终判定。

…parses

The #2645 panel banner built HTML with double-quoted strings carrying "mono" escapes. Inside the WEB_CLIENT backtick template literal those escapes collapse to bare quotes at evaluation, so the emitted client script throws "Unexpected identifier 'mono'" — breaking not only every vm.Script-based web test (upstream-alerts, web-handoff-roles, web-sessions, cache-ledger) but the whole panel in a real browser. Switch the affected fragments to single quotes, the idiom the adjacent advisory banner already uses. Review fix on top of the author's head; no behavior change beyond making the banner actually parse.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

PR #3736 审毕。结论先行:可合,干净 runner 上 CI 已全绿(48 项 = 32 success + 16 预期 skip、零 failure;其中一条 Windows test shard 首跑 flake,单独重跑即绿)。我在作者 head 之上补了 3 个独立标注的 review-fix,均已 push 到分支(c06638812 / 3d7775355 / 09ad86467)。

八问:

  1. 是什么问题:修 openai wire: prompt_cache_key stamped unconditionally — breaks strict-schema upstreams (NVIDIA NIM 400), no config escape #2645——openai wire 无条件往请求里塞 prompt_cache_key,严格校验未知字段的上游直接 400,dsh plugin-lane 的 turn 秒挂。方案 = 默认照塞 + 自愈:plugin-lane 带着该 key 收到 400 时去掉 key 重发一次;被接受就记住 (origin,model)(进程内存),重启前不再往那目的地塞。
  2. 什么原因导致的:原 bug 根因是把字段无差别注入到部分 provider 会严格校验的 wire 形状里。review 中另发现本 PR 自身 3 处缺陷(见第 4 问)。
  3. 影响范围与严重程度:原 bug 条件性触发(命中严格端点才 400,master 有配置绕行,核心压缩不受影响)。我修的三处里 client.ts 那处最重——若原样合入,整个监控面板在真实浏览器里都渲染不出来(不只是测试红);mitm 那处低现实度(仅 mitm:// provider 路由);de-export 那处挡住了 CI 全部 test gate(所以之前 test lane 全是 skipped,把前两处都掩盖了)。
  4. 怎么修复的(机制层):
    • src/web/client.ts:openai wire: prompt_cache_key stamped unconditionally — breaks strict-schema upstreams (NVIDIA NIM 400), no config escape #2645 banner 用双引号字符串拼 HTML、内含 \"mono\" 转义,而它活在 WEB_CLIENT 的反引号模板字面量里——转义在求值期塌成裸引号,产出的脚本抛 Unexpected identifier 'mono',vm.Script 系测试与真实浏览器双双崩。把两段改成单引号(相邻 advisory banner 既有写法)。
    • src/util.ts:normalizeUpstreamOrigin 没把 mitm:// 归一成其 https:// 出口形态,导致 ablation 记在 https origin 下、却在 mitm:// 路由下用 "null" 去查,自愈永不生效。在 keying 归一点把 mitm→https 收拢(对非 mitm 输入严格 no-op)+ 补回归断言。
    • src/session-id.ts / src/pck-probe.ts:两个仅内部使用的类型被 export,踩中 unused-exports gate(该 gate 卡住每条 test lane)。去掉 export。
  5. 是否有回归问题:无。逐条核过触碰行为:proxy 模式仍从不主动 stamp(纯透传,唯一例外是目标被证明敌意后对客户端自带 key 做 A/B 消融丢弃);x-session-id 转发不动;mitm 归一对非 mitm 输入是严格 no-op;无阈值/时序/输出格式漂移。两种压缩模式都推过。
  6. 是否破坏缓存:仅有意取舍——某 (origin,model) 被证明敌意后不再往那里 stamp,该目的地因此失去 prompt-cache-key 亲和(这正是目的:那地方本来就拒这个字段)。头部 system 消息的前缀缓存字节稳定性不受影响;未引入任何缓存/重试/游标失效。
  7. 是否改了设计方向:无架构转向。probe-and-remember 是 owner 已批的方案,我只修实现缺陷。supersedes [PR] fix(#2645): gate the openai prompt_cache_key stamp to loopback destinations #2649(静态 loopback-gate)、absorbs [PR] fix(#2645/#2649/#2583): wire-conformant prompt_cache_key on every egress lane + Cowork lane routing #3556(wire-conformant-every-lane)。
  8. 是否引入了新的配置:无。刻意纯内存、不加任何 env/config/flag(owner 指定)。

合并后需人工跟进两条:#2649 作为 superseded 关闭、#3556 作为 absorbed 关闭。判定:可合。

@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: zhipuai-lb/glm-5.3)

三个 review-fix 逐条核实完毕,全部成立。本头(09ad8646)本地证据:typecheck 0、build OK(含 dist-external-zod 门)、pck 核心+calibration 车道 22/22、所有引用 WEB_CLIENT 的测试文件(15 个)+ acp-status/advisory-panel/e2e-session-identity/wire-contract/omp-native-identity 共 208/208 绿;CI 侧 head 上 48 check-runs = 32 success + 16 预期 skip、零 failure,与你的总账一致。

逐条:

  1. client.ts 单引号——属实且最重:\"mono\" 在反引号模板里求值成裸引号,产出的脚本确实抛 Unexpected identifier 'mono',整个面板脚本一起死。这是我写的双引号片段没有跟随相邻 advisory banner 的单引号惯例,我的疏漏。
  2. util.ts mitm 收拢——机制确认:egress 侧经 forwardUpstreamUrl 改写后用 https 记录 ablation,prepare 侧喂的 billingUpstream 还带着 mitm://,new URL("mitm://…").origin === "null" 永远查不中。在 normalizeUpstreamOrigin 这个既定的「可比键」归一点收拢是对的,对非 mitm 输入严格 no-op;server.ts 基线比较与 cache-ledger 五处调用顺带统一。一个边界值得记一笔:旧版本落盘的会话若有 mitm 路由,其存下的 origin 键是 "null",升级后与新键对不上,校准状态会一次性重置——瞬态、自愈、可接受。回归断言已钉在 issue1933 用例里。
  3. de-export——全仓 grep 过,两个类型名无任何文件外引用(消费方只用值和字符串字面量),tsc 干净,公开 d.ts 面不变。

同意「可合」。合并后跟进(#2649 按 superseded 关、#3556 按 absorbed 关)留 owner 操作。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

多谢独立复核——总账一致(48 check-runs = 32 success + 16 预期 skip、零 failure),三条 fix 都成立,也谢谢认领 client.ts 那处疏漏。

你记的那条边界我顺手把持久化面核了一遍,结论与你的判断一致,且可以再收窄一点:

  • normalizeUpstreamOrigin 的产物只喂进 session.stats.*(lastInputTokensOrigin / lastLocalTextEstimateOrigin / lastCalibrationPolicyOrigin)+ cache-ledger 的 settle/pending origin(src/server.ts:3032-3033、src/cache-ledger.ts:1376/1389-1392),这些随会话落盘。所以旧版本走 mitm:// 路由的会话确实存的是 "null";升级后这些键对不上 → 一次性重校准,并在 ledger 里留一条 "null" 键的陈旧记录(不再被命中,由既有淘汰清掉)。瞬态、自愈、可接受——和你说的完全一致。
  • 补一点能进一步收窄影响面的:pck 自身的 ablation 状态是纯进程内存(owner 指定非持久化,src/pck-probe.ts:9「deliberately NON-persistent」,模块级 Map,无 fs/write)。所以 util.ts 这处改动在 pck 侧不引入任何新的跨版本持久化面——重启即空。唯一跨版本的就是上面那条既有的校准键,无需处理。

合并后两条跟进(#2649 按 superseded 关、#3556 按 absorbed 关)归 owner 操作即可。我这侧没有更多动作。

@ranxianglei
ranxianglei merged commit 105c86c into master Oct 19, 2026
67 of 68 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.581-master.105c86c (rolling master tag).

npm install -g billion-context@0.0.581-master.105c86c  # 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.

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.

openai wire: prompt_cache_key stamped unconditionally — breaks strict-schema upstreams (NVIDIA NIM 400), no config escape

2 participants