Repository navigation
feat(#1958): warn on conflicting pre-routed /bili/ opencode config — expose, don't absorb, don't gate install - #2020
Conversation
…expose, don't absorb, don't gate install Maintainer direction change on #1958: the 'native plugin + hand-written /bili/ provider baseURL' combo is a conflicting configuration (two access paths claiming routing ownership of the same requests). The correction is a loud runtime warning — not silent compat (no stamping/rewrite, the request stays on the plain-proxy path it encodes) and not an install-time refusal (a scanner false positive would permanently block installs). - src/agent/opencode-native.ts (createNativeRoute): on a pre-routed model URL, warn once per (session, origin) unless BILLION_CONTEXT_PROXY pins the SAME origin (supported attach posture — compared via URL.origin so trailing-slash/default-port spellings fold; env, not state.origin, because attach arming does not freeze state.origin synchronously). No behavior change to the request itself: #1365 pinned-channel recording (noteRoutedOrigin) and the isModelApiUrl fall-through are untouched; s.proxyBase stays unset for pre-routed URLs. - tests/issue1958-routed-warn.test.ts: 4 cases — dedup per (session, origin) + no stamping; benign pin silent incl. port folding; mismatched pin warns; non-model /bili/ paths and /__bili/health never warn. - CLIENTS(.zh-CN).md / CONFIGURATION(.zh-CN).md: the three OpenCode access paths are mutually exclusive; runtime warning + fix-it guide documented. Supersedes #1959 (silent stamping) and #1972 (install refusal + stamping).
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2052-pr.2020.35c26d0This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2020.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…URATION.md The note was inserted between the Codex intro line and its toml example, making it read as part of the Codex section. Placed after the OpenCode jsonc block instead — matching the CONFIGURATION.zh-CN.md layout.
[bot] 🏷 Review 结论(#2020,head 方向关(原 issue):与 floor 9 拍板完全一致——矛盾配置只做运行时响亮暴露:不盖章、不改写、不拦安装。#1959/#1972 已关闭并被取代,无并行工作。修的是「冲突从未被看见」这个暴露层缺陷,请求路径零改动。 回归审查(既有行为逐项清点):
代码关:dedup key 测试有效性:4 个新用例断言有牙——精确计数分别抓得住去重破坏、盖章回归、谓词漂移、指引文案丢失。本地定向验证:issue1958 4/4、opencode-native 34/34、opencode-v2 31/31 全绿; diff 整洁度:6 文件 +181/-1,每行都为目的服务;两个线性 commit(第二个修文档落位);en/zh 四份文档同步且内容与实现一致。 七问:
判定:CI 15/15 全绿(e2e 全矩阵 + registry e2e + 各 real-lane),本地定向测试与 typecheck 通过,方向/回归/测试/diff 四关全过——可合。按规则我不代合,请手动合并:#2020 |
Closes #1958. Supersedes #1959 and #1972.
定性(维护者拍板)
"native 插件 + 手写
/bili/provider baseURL" 是矛盾配置:两条互斥接入路径同时认领同一批请求的路由权。纠正手段是运行时响亮警告:s.proxyBase = baked不要);改动
src/agent/opencode-native.ts(createNativeRoute):预烤模型 URL 进入时,除非BILLION_CONTEXT_PROXY钉住同一 origin(受支持的 attach 姿势,URL.origin归一化,尾斜杠/默认端口折叠;比 env 而非state.origin,attach arming 不同步冻结避免良性误报),否则每 (session, origin) 一次console.error+ 二选一指引(去前缀 orbili plugin remove opencode)。请求本身零改动:noteRoutedOrigin(bug: dsh-native — attach 目标瞬时不可达 → 回退 spawn 第二实例:routed baseURL 下工具/模型通道必然脑裂(工具 404 → preflight 502 → 会话不可自愈) #1365 pinned-channel)与isModelApiUrl落空路径原样,不设s.proxyBase。tests/issue1958-routed-warn.test.ts4 例:去重+不盖章;良性钉住静默(含端口折叠);异源钉住警告;非模型/bili/与/__bili/health不警告。验证
tests/issue1958-routed-warn.test.ts4/4;tests/opencode-native.test.ts34/34;tests/opencode-v2.test.ts31/31(干净 env)tsc --noEmit --project tsconfig.build.jsonrc=0;tsconfig.json下仅剩 dsh-settings-ui 的 4 个 pnpm-only esbuild 既有误报(CI 用 npm 不受影响)七问速答