Repository navigation
feat: seed opencode.ai into the omp/opencode lane MITM whitelist (#1405) - #1409
ranxianglei wants to merge 0 commit into
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1409Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1409.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 PR review — #1409 (feat: seed opencode.ai into the omp/opencode lane MITM whitelist) ① 原 issue(方向关) ✅ — PR 精确实现了 #1405 的方案:按既有 per-lane stock-gateway 先例( ② 回归审查(既有行为清点) — 触碰路径:
③ 代码审查 ✅ — 最小改动(client-config +7 / discover +10),完全跟随既有模式与注释风格,无 ④ 测试有效性 ✅ — 3 个新测试都有牙:unit ⑤ diff 整洁度 ✅ — 5 文件 +44/-7,每一行都服务于本 PR 目的,无跑题/重排/生成物。 验证(我在本地全部重跑,不只信 PR 证据):
⚠ Behavior change(确认作者披露准确):OLD 分析中发现的一个相邻问题(已单独立项 #1411):#1405 正文假设「opencode/omp provider 显式写了 baseURL 会被发现」——不属实: 结论:代码方向正确、实现干净、测试有牙、行为变更披露充分。合并前需要 rebase 到当前 master(其 head 落后 ~30 提交;我已本地验证 rebase 零冲突且 rebased head 全绿——CI 会对新 head 再跑一遍)。rebase 后即可由人工合并(我不执行 merge)。 中文一句话:审了 PR#1409(opencode.ai 进 omp/opencode lane MITM 白名单):方案与先例一致、回归面干净(seed 实为无条件但与 qoder/trae/aider 同类且已披露)、测试有牙;3 个测试失败系 stale-base 而非 pre-existing,rebase 到当前 master 后本地全套 2790 绿;另发现 opencode/omp 显式 provider URL 从未被自动发现的相邻缺口已立 #1411;rebase 后可合并。 |
…covery and config-files order note - tests/discover.test.ts: the union of #1409 (zen seed) + #1413 (declared hosts) dropped the closing '});' of the #1411 partial-configs test — restore it (tsc TS1005 at EOF). - CONFIGURATION.md + zh-CN: one sentence on opencode/omp declared-provider MITM discovery (#1411) next to the existing bili opencode line. - src/client-config.ts: note that opencodeConfigFiles order is irrelevant (first parse wins per key).
82b4817 to
c030b56
Compare
|
#1417 深审 + rebase 交付(详表见追踪板)。这两个 PR 是栈式的,必须 #1409 先合、#1413 后合(同文件:client-config.ts / discover.ts / discover.test.ts)。 #1409 是什么:给 omp/opencode 车道种入 zen 网关默认域 行为影响:feat(白名单扩容,不是纯机械)——默认多信任一个上游域。空配置 opencode/omp 从"MITM 不拦截任何域"变为"拦截 opencode.ai"。这是安全面扩张,按仓库纪律保持人工合并。 深审修复:cherry-pick 到当前 master(c030b56,原分支 228 behind)零冲突重放,head=642ed4a。定向 30/30+typecheck 0 错(全量交给远程 CI)。 非阻塞:与 #1413 的测试断言冲突已在 #1413 侧按 union 解(其 partial-configs 测试断言从 |
What
opencode's built-in zen gateway (
opencode auth login) resolves its baseURL (https://opencode.ai/zen/v1/messages) from the models.dev catalog — it lands in no local config file, sodiscoverMitmDomainsnever sees it. Today that traffic blind-tunnels through bili: zero compression, zero session management, one easy-to-missBLIND TUNNEL WARNING(#897).This seeds the zen host into discovery using the exact per-lane precedent already in the codebase (
QODER_DEFAULT_MODEL_HOSTS,TRAE_DEFAULT_MODEL_HOSTS,AIDER_DEFAULT_MODEL_HOSTS— "stock model gateways, cert-MITM'd sobili Xcompresses"):src/client-config.ts: newOPENCODE_DEFAULT_MODEL_HOSTS = ["opencode.ai"].src/discover.ts:extractHttpsHostsseeds it when theopencodeoromplane is present (omp runs zen models too). Union semantics — unlike qoder/trae/aider's replace-on-explicit-override, it coexists with explicit provider base URLs, because a user can mix custom providers with zen models in one setup.discoverMitmDomains()itself insideisMitmHost(), so launched (bili omp/bili opencode) and standalone instances are both covered./zen/v1/messagesalready detects as Anthropic wire (server.tsendsWith("/v1/messages")).opencode.ai).⚠ Behavior change (old → new)
CONNECT opencode.ai:443→ blind TCP tunnel — traffic usable but never decrypted/compressed; one-timeBLIND TUNNEL WARNINGper host.CONNECT opencode.ai:443→ TLS terminated by bili's root CA; model endpoints (/zen/v1/messages) enter the compression pipeline; non-model paths on the same host are relayed verbatim ([Bug] DSH native fetch 拦截误伤非 LLM 端点:任何以 /messages 结尾的 URL 都被当成模型 API #1284 fallback). Scope is identical to howapi.anthropic.com/ qoder / trae / aider stock hosts already behave on any machine running bili (discovery seeds them unconditionally too). Remote clients may now be MITM'd for this host as for other whitelisted hosts (loopback-only blind tunnels unchanged).Evidence
npm run typecheck✅ ·npm test: 2449 pass / 3 fail — the 3 failures (tests/claude-native.test.tsps-walk/hook-e2e) reproduce identically on clean master in this environment (pre-existing, unrelated) ·npm run build✅dist/index.js start, drovecurl -x <proxy> https://opencode.ai/— log showsmitm … tunnel established (TLS terminated locally)(no BLIND TUNNEL WARNING), CA generated lazily, second attempt trusting the CA returned HTTP 200 from opencode.ai through bili.bili ompsession with a zen model showing compression + context drop — the wire shape is pinned by the existing anthropic-wire tests; [Bug] bili omp 扩展 stampPromptCacheKey 无条件注入顶层 prompt_cache_key —— 严格 schema 上游(opencode zen anthropic 端点)全量 400 #1403's client-sideprompt_cache_keyleak (the strict-schema 400 risk called out in the issue) is already fixed upstream of this proxy path.Closes #1405