Repository navigation
[PR] fix(opencode-lane): stop rewriting the shared http.request payload — route model traffic at fetch time (#5625) - #5626
ranxianglei wants to merge 11 commits into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.11201-pr.5626.e850b6cThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5626.tgz
npm install -g packageInstall instructions are refreshed on each push. |
… the fetch-time contract (#5625) CI follow-up on PR #5626 head 58438f1: - unused-exports gate: replaceRequestTarget had no remaining callers once the routes stopped rewriting e.request — removed. - tests/opencode-native.test.ts: the #4669 V2-composition pin asserted the old hook-time rewrite; it now installs the chain like its sibling and asserts the hook keeps the payload intact while the chain rewrites at send time. - tests/issue5625-opencode-v2-hook-payload.test.ts: the pool-endpoint pin predated #4256's classifier arm for the v1internal dialect (DSH Desktop Code-Assist traffic rides exactly that URL); it now asserts the post-#4256 contract — the hook stays out of the provider plugin's way and the chain forwards the pool URL byte-preserving with no bili identity invented.
…#1248) CI follow-up on PR #5626 head a40ef0f: every test shard died at the #1248 SPAWN_RE tripwire because tests/issue5625-opencode-v2-hook-payload.test.ts spawns node children (setup-gate probe) but was never registered. Concurrency reviewed: three rows are in-process with a fake fetch sink (no sockets), the probe server is listen(0), child env is mkdtemp-isolated — appended (slot = index drives zone bands, mid-list inserts renumber later files).
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 e-work 镜像检索("opencode http.request payload kiro antigravity"、"kiro auth bridge empty responses")无命中;GitHub open PR 检索只返回本 PR。本 PR 即被 revert 的 #4280(原始报告 #4276/#5625)的官方重做,无并行在途修复。 标签: bug, p1, scope/wiring, opencode, opencodev2, dsh(Kiro 用户拿到空回复、Antigravity 直接抛错——核心能力整体停摆 = p1;改动面是客户端接入层钩子管线;DSH Desktop Code-Assist 流量被披露的行为变更明确波及)。 审核结论(八问)1. 是什么问题:opencode 车道的 http.request 钩子过去把每个模型请求的 URL 改写成 2. 什么原因导致的:根因是插件在钩子层改写了共享状态(e.request),而不是只决定自己的出站路由——钩子 payload 是宿主递给所有插件的共享基础设施,不是 bili 私有对象。fetch-time 改写方向正确:钩子只做发现/标记,真正的 3. 影响范围与严重程度:opencode V2 车道(native 插件安装 + 4. 怎么修复的:route() 改为 discovery-only(oversize 本地拒绝不变);两个 setup() 都装共享 fetch 拦截链,统一承担 5. 是否有回归问题:逐项清点既有行为——
6. 是否破坏缓存:不涉及。缓存/重试/增量游标/去重键均未动;pf-* 水位头照旧(协议头,转发上游前剥除)。 7. 是否改了设计方向:是,本 PR 的目的——opencode 车道路由决策点从「钩子层共享 payload 改写」移到「fetch-time 私有出站改写」,与 pi/omp/dsh 等车道的共享链架构对齐;钩子层保留发现 + 标记(biliDirect/豁免/本地拒绝)。 8. 是否引入新配置:无。补全已文档化的 审核中发现的问题与处置(全部已在 PR 分支修掉)本地跑相关套件发现 3 处必红 + 上述 WS 回归:
开审时 CI follow-up 已向分支推了 a40ef0f / 50fc076,修掉 1–3(与我的定位等价,采纳其版本)并把新套件登记进 LIVE_FILES;我在 50fc076 之上只 cherry-pick 了我独有的第 4 项(209b24b)并推送。新 head 本地验证:5 个套件 84/84 绿 + typecheck 干净 + unused-exports 干净;全量裁决看远程 CI(镜像缓存尚停留在上一 sha,未轮询)。 行为变更披露(PR 原有 + 本次审核)
判定:方向正确、机制成立、披露完整;发现的 4 处问题已全部在分支上修复(3 处 CI follow-up + 1 处我修)。等新 head 209b24b 远程 CI 绿即可合(人工合并)。 |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
Reviewed end-to-end against current master. PR head 50fc076af is 0 commits behind master (merge-base == master), clean 3-commit linear history. CI: no check failures at read time (kernel-guard / version-guard / gate green; e2e lanes gated-skip; a few guard jobs still running). No kernel/ touched.
The core #5625 fix is correct and I approve it. It does exactly what #4276 asks: the opencode-lane http.request hook stops replacing the shared e.request (which leaked the rewritten proxy URL into every later hook, including provider-scoped plugins like Kiro/Antigravity) and only discovers state.proxyBase; the <proxy>/bili/<url> rewrite moves to fetch time in the shared intercept chain (installNativeFetchIntercept, now installed by the new setup() wrappers in both opencode-native.ts and opencode.ts). Verified independently:
replaceRequestTargetremoved cleanly — zero remaining references at head (grep acrosssrc/+tests/+scripts/).- Steady-state HTTP output is byte-identical to the old rewrite path (same
${origin}/bili/<upstream>target, same stamps); the newtests/issue5625-opencode-v2-hook-payload.test.tspins the payload contract (untouched request, fetch-time routing, pool dialect, direct exemption, child-process install gate) and is registered inscripts/live-files.mjs. - Dead-origin handling moving to the chain's recover/retry/give-up-direct is covered by the updated launcher suite (respawn re-route + failed-respawn direct degrade).
providers.<url>.directcompletion for the V2 lanes reuses the zcode store lane's boundary rule (exact key or key+"/",directExemptMatch); no new config field invented (respects the owner-gated config surface).- Behavior changes are disclosed old→new in the PR body per policy.
One semantic edge to close before/at merge — see 🔶 below.
结构化八问
- 是什么问题:opencode 车道在
http.requesthook 里把共享请求对象改写成代理 URL,泄漏给后续所有 hook(含其它插件的 provider-scoped hook),导致校验上游 URL 的插件(Kiro/Antigravity)失效。 - 什么原因导致的:根因是「在 hook 里改写共享可变 payload」——opencode 把同一个 Request 对象递给每个后续 hook,而
Request.url运行时只读(#810),只能整体替换引用,于是改写串到所有下游。 - 影响范围与严重程度:所有「opencode 车道 + 挂了 URL 校验型 provider 插件」的用户;Kiro 表现为静默空回复(体验级 p1),Antigravity 直接抛错。修后恢复。
- 怎么修复的:hook 只做发现(
state.proxyBase)+打戳+本地拒绝;真正的/bili/改写下沉到 fetch 时刻的共享拦截链(V1/V2 两个 setup 都装链)。共享 payload 原样透传,provider 插件重新看到上游原始 URL。 - 是否有回归问题:稳态 HTTP 字节等价、已测;死源降级 / direct 豁免 / 签名体本地拒绝(#1884)均按披露生效。但有一处相邻路径回归见下方 🔶:
experimental.ws.handshake隧道重建丢了「陈旧 baked overlay 在端口漂移重启后重定向到 live origin」的旧行为。 - 是否破坏缓存:不破坏。打戳仍落在同一请求对象上,稳态出站 URL 不变,prefix cache 行为一致;direct 豁免是用户按上游显式 opt-out(本就不压缩)。
- 是否改了设计方向:是且有意——从「hook 时改写」转向「fetch 时路由」,与 pi/zcode 等车道统一;这是 #4276 的正解方向,合理。
- 是否引入了新的配置:无新字段;补全既有
providers.<url>.direct(此前仅 ZCode 车道实现),CONFIGURATION.md 措辞同步更新。
🔶 需要决策 — ws.handshake 隧道重建丢失「陈旧 overlay 重定向到 live」
src/agent/opencode-v2.ts:439-452(ws.handshake handler):新逻辑只覆盖两种情况——(a) reqUrl.startsWith(${state.proxyBase}/bili/)(baked overlay 且 origin == 当前 live,即稳态),(b) isModelApiUrl(httpUrl)(裸模型 URL)。它没有覆盖「baked overlay 的 origin ≠ state.proxyBase」这一格——即 launcher 车道里 proxy 死亡后 respawn 到不同端口(port drift)时,baked 进 opencode 配置的 /responses WS URL 仍指向旧端口:
- branch (a) 失败(baked origin ≠ live origin);
- branch (b) 失败:
isModelApiUrl对/bili/前缀 URL 恒为 false(native-intercept.ts:309segments[0]==="bili" → return false); - →
httpTunnel === undefined→ return,不建隧道。
改动前的代码靠 route 里 replaceRequestTarget(e, ${live}/bili/${upstream}) 先把合成请求重写到 live origin,所以旧代码对这一格是正确重定向的。opencode 车道没有装全局 WebSocket wrapper(只有 pi-native.ts 装 installNativeWebSocketIntercept),fetch 链也覆盖不到 WebSocket,所以 ws.handshake hook 是唯一出路——HTTP 能靠 fetch 链自愈,WS 不能,这个不对称就是缺口所在。
触发条件较窄(launcher 车道 + Responses-over-WS provider + 端口漂移重启),且下次 opencode 启动会重新 bake 配置而自愈,会话本身不死,故判为非阻塞(p2~p3)。但它是本 PR 引入的相邻路径回归,且 opencode-v2.ts:444-447 注释声称 tunnel「byte-identical to the old rewrite + replace pipeline」——该等价性只在 baked-origin == live-origin 时成立,对漂移场景不成立;此外这段隧道重建逻辑在本 PR 中无任何测试钉住。
请二选一:
- A(推荐):在 else-if 链补一格——当
httpUrl/reqUrl是/bili/baked overlay(origin 任意)时,用routedBiliModelUrl解出内层 upstream,对state.proxyBase(live)重建${live}/bili/responses/<inner>,复刻旧的重写行为,并加一条「stale-origin-after-restart」的 pin; - B:确认该路径不可达(launcher 从不产出 baked 的
/responsesWS URL),在注释里写明边界。
此项属路由语义、跨 native/launcher 两车道,我不擅自改;给出方向供拍板。
Verdict: APPROVE (substantive) — the #5625 fix itself is correct, tested, green and current with master; the single 🔶 item above is a narrow non-blocking edge routed for your decision (label needs-decision applied), not a merge blocker.
(Process note: a formal APPROVE review event could not be filed from this identity — GitHub rejects self-approval when the reviewer account is the PR author. This comment carries the complete assessment; the merge call is yours as usual.)
|
(ai: vllm-qwen/qwen3.8-27b) Correction to my review comment above — that one was filed against head I independently reproduced the same WS stale-origin regression the prior review thread called out: a launcher-baked Verified the live head
So the 🔶 需要决策 item in my earlier comment is already resolved on-branch — no open decision remains. I have withdrawn that framing and removed the Net verdict stands: the #5625 core fix is correct, tested, green and current with master; with |
(ai: vllm-qwen/qwen3.8-27b) Review 完成(第二次独立复核)。 核心 #5625 修复经独立代码走查确认正确、已测、绿、与 master 同步。我独立复现了前一轮 review(floor 8)指出的同一处 WS stale-origin 回归(launcher baked overlay 在端口漂移 respawn 后隧道不建、宿主连死 origin),并核实当前 live head |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) CI 修复完成:11 个红掉的 test 分片是同一个根因,已在 PR 分支修掉并验证全绿。修复提交 根因:PR 新增的 修法:先做并发假设审查(3 个用例纯进程内 fake-fetch、第 4 个 listen(0) 临时端口 + mkdtemp 隔离子进程,无固定端口、无需端口区带),再按 append-only 纪律把文件追加到 LIVE_FILES 表尾(slot=index 决定端口区带,中途插入会重编号后续所有文件)。本地双重验证:tripwire 逻辑复刻干净(1082 文件扫描)+ 该套件定向跑 4/4 通过。 回归审查:改动仅 +7 行(1 条表项 + 注释),不动任何既有登记项、不改 tripwire 语义;不涉及缓存/配置面/设计方向。另核对了后续落下的功能提交 两个非缺陷现象:①推送后自动打标签 1 秒内连加 6 个标签触发 6 次 labeled ci.yml run,被 #3772 的 判定:我负责的红 CI 已全部修完并实证绿,收工;PR 现头 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 收到更正,CI 侧确认完毕——现头
与你的独立复现结论一致: CI 车道收工:我负责的两段(11 分片 tripwire 根因修复 |
…route model traffic at fetch time (#5625) Rework of PR #4280 (reverted by c076614 over a master conflict; original report #4276) on top of current master. The opencode-lane http.request hook used to replace e.request with a new Request pointed at `${proxyOrigin}/bili/<originalUrl>`. opencode hands that one mutable event to every later http.request/http.response hook, including provider-scoped hooks from other plugins, so provider auth plugins validating the upstream URL broke: Kiro's bridge silently stopped engaging (empty responses after ~10 retries) and Antigravity threw "pool requests need the default Google base URL" before its own hook could run. The routes now only DISCOVER the proxy (state.proxyBase; oversize refusal / direct-degrade on death) and leave the hook-visible payload untouched. Both setup()s install the shared native fetch intercept chain, which performs the /bili/ rewrite at fetch time — the bytes other plugins see in their hooks are unchanged. The WS handshake hook builds its own tunnel URL instead of relying on the rewritten request. These lanes also honour providers.<url>.direct (#1622), previously implemented only in the ZCode lane: matching requests are marked biliDirect in the hook and sent direct by the chain. Behavior changes (disclosed per policy): - Provider plugins in opencode lanes see original upstream URLs again. - Signed-body model requests (x-goog-api-key / SDK-HMAC-SHA256) in V2 processes get the local #1884 refusal instead of unsigned-through-bili. - #3304 prepareDirectSend and #3248 onResponse acks activate in V2 processes (dead code before the chain existed there). - Launcher dead-origin handling moves from preemptive unwrap-to-upstream to the chain's recover/retry/give-up-direct path. - v1internal pool-shaped URLs (e.g. daily-cloudcode-pa.googleapis.com, recognized since #4256 for DSH Desktop Code-Assist traffic) ride the chain like any other model request: byte-preserving forward through bili, no bili identity headers invented. Hosts wanting such traffic fully off bili opt out per upstream via providers.<url>.direct. Tests: new tests/issue5625-opencode-v2-hook-payload.test.ts pins the hook payload contract (untouched request, fetch-time routing, pool dialect, direct exemption, install gate); launcher/native suites updated to the fetch-time contract; the #4669 inline-composition test installs the chain like its sibling and asserts the hook keeps the payload intact. Closes #5625
… the fetch-time contract (#5625) CI follow-up on PR #5626 head 58438f1: - unused-exports gate: replaceRequestTarget had no remaining callers once the routes stopped rewriting e.request — removed. - tests/opencode-native.test.ts: the #4669 V2-composition pin asserted the old hook-time rewrite; it now installs the chain like its sibling and asserts the hook keeps the payload intact while the chain rewrites at send time. - tests/issue5625-opencode-v2-hook-payload.test.ts: the pool-endpoint pin predated #4256's classifier arm for the v1internal dialect (DSH Desktop Code-Assist traffic rides exactly that URL); it now asserts the post-#4256 contract — the hook stays out of the provider plugin's way and the chain forwards the pool URL byte-preserving with no bili identity invented.
…#1248) CI follow-up on PR #5626 head a40ef0f: every test shard died at the #1248 SPAWN_RE tripwire because tests/issue5625-opencode-v2-hook-payload.test.ts spawns node children (setup-gate probe) but was never registered. Concurrency reviewed: three rows are in-process with a fake fetch sink (no sockets), the probe server is listen(0), child env is mkdtemp-isolated — appended (slot = index drives zone bands, mid-list inserts renumber later files).
…ale baked overlays (#5625) Review fix on the #5625 rework branch: master rebuilt the Responses-WS tunnel from the route()-rewritten URL, so a launcher-baked overlay whose origin had died was re-baked to the live origin. The fetch-time rework builds the tunnel from the untouched request instead: a stale baked URL misses the live-prefix branch and its /bili/ path fails isModelApiUrl, so the handshake is dropped and the host connects to the dead origin. The launcher respawns its proxy on a fresh dynamic port (port 0), making this reachable after any mid-session proxy death. Branch 2 now also decodes routedBiliModelUrl and tunnels the embedded upstream from the live origin — byte-identical to master's output; regression test added.
209b24b to
629a10a
Compare
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
Pass-2 re-review after rebase — head 629a10a37 (previously 50fc076af → 209b24b71). The branch was rebased onto current master (5dee4850b; merge-base == master, i.e. up-to-date). Same 4 logical commits / 10 files as my prior review — no content change, only base movement. I re-verified the rebase is clean rather than trusting it:
- Master's concurrent changes preserved. Between the old and new base, master independently edited several of the same files. All its additions survive at head: the
native-intercept.tssilent-direct body-cap feature (outgoingBodyBytesCapped/streamBytesCapped/MAX_SILENT_DIRECT_BODY_BYTES/emptySlotOversizeRefusal/unattributedByteOversizeRefusal) is intact;opencode-v2.tsreceived modifications only (no symbols dropped). - No rebase duplication / drift.
isModelApiUrl(:303) /directExemptMatch(:321) /installNativeFetchIntercept(:1158) each defined exactly once;replaceRequestTargetstill fully removed (zero refs); the fetch chain is installed in bothopencode-native.tsandopencode.ts; the WS stale-origin tunnel fix is present (opencode-v2.ts:458→routedBiliModelUrl(httpUrl)). - Cross-feature coherence. The
providers.<url>.directexemption branch (native-intercept.ts:1514) sits after theisModelApiUrlgate and before the #1884 signed-body logic, short-circuiting to a byte-untouchedsend()by design — so it correctly never trips master's separate oversize-refusal branches (different decision points, no collision). - CI green on
629a10a37. 30 checks, 0 failed, 0 pending — all test shards + static-gates + unused-exports + version-guard + lifecycle-ledger-guard success; e2e lanes gated-skip as normal.
Eight questions (deltas vs pass 1):
- 是什么问题: opencode-lane 的
http.requesthook 重写了共享e.request,把<proxy>/bili/<upstream>泄漏给后续所有 hook(含 provider 插件)→ Kiro/Antigravity 等拿到错误 URL。 - 什么原因: 原设计在 hook 层改写共享请求对象;正确的层次是 hook 只做发现,真正改写在 fetch 时完成(共享拦截链)。
- 影响范围与严重程度: dsh/opencode 宿主 + provider 插件场景;p1(provider 插件拿到错误 URL = 该车道功能错乱)。核心修复在 pass 1 已逐行验证。
- 怎么修复的: hook 只发现 + 打戳 + 本地拒绝;
/bili/改写在 fetch 时经installNativeFetchIntercept链完成,两个setup()wrapper 都装链。 - 是否有回归问题: 本轮重点是 rebase 完整性——master 并发改动全部保留、无重复定义、无语义漂移;pass 1 发现的 WS stale-origin 边角回归已由同分支 commit 修复并带回归钉;CI 全绿。
- 是否破坏缓存: 不涉及(不动压缩 / 缓存键 / 重试策略)。
- 是否改了设计方向: 不变(仍是「hook 发现 / fetch 路由」的分层)。
- 是否引入新配置: 无(补全既有
providers.<url>.direct,未新增字段)。
Verdict: approvable / mergeable. Rebase is clean, the diff is identical to what I verified line-by-line in pass 1, and CI is green on the live head. GitHub forbids author self-approval (reviewer == author here), so I'm posting this as a COMMENT-event review carrying the approval recommendation rather than an APPROVE event — please merge manually.
(ai: vllm-qwen/qwen3.8-27b) PR #5626 pass-2 复审完成(分支已 rebase 到最新 master |
|
@ranxianglei, please rebase this branch off master. |
(ai: vllm-qwen/qwen3.8-27b) Checked the branch state before touching anything: it has fallen 14 commits behind master since the last rebase — master is now at I haven't pushed it yet: rewriting the branch would reset the currently-green CI and invalidate the pass-2 sign-off, and this request came in as an external comment rather than from the owner — so I'd like a quick confirm before rewriting history. On confirmation I'll rebase onto current master, resolve any conflicts by union-of-intent, push the same branch, and re-run typecheck/build + let CI re-verify. (The PR stays fully mergeable in the meantime — "behind" is not a merge blocker.) |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 冲突处理进行中(interim)——分支与 master 已脱节 775 个提交(master 推进到 共 6 个文件冲突 / 8 个 hunk,已完成 3 个:
剩余 3 个文件 5 个 hunk( |
…lict resolution (#4599 help-merge) Conflicts (6 files / 8 hunks), all union-of-intent: - scripts/live-files.mjs: both sides appended LIVE_FILES entries -> keep master's 5 new suites then the #5625 hook-payload suite - CONFIGURATION.md: master moved docs to docs/ (redirect stub) -> take stub; port the branch's providers.direct description update (#1622/#4276/#5625 OpenCode V2 direct-marking semantics) into docs/configuration.md en+zh-CN - src/agent/native-intercept.ts: _resetForTest clears both module states (branch directExemptSeen + master declaredPatterns) - src/agent/opencode-native.ts: imports = master additions minus replaceRequestTarget (dropped by this PR as dead after fetch-time routing; zero refs remain in merged tree); state setup keeps BOTH directPrefixes (#4276) and declaredWindowForDirect (#5032); V2 setup wrapper keeps the branch's fetch-intercept install AND passes master's onResponse option (merged V2SetupOptions accepts both) - src/agent/opencode-v2.ts: V2HttpRequestEvent gains both optional fields (biliDirect #4276 + response for http.response events) - src/agent/opencode.ts: imports = master additions minus replaceRequestTarget; keep V2PluginContext (used by merged setup wrapper)
…ogHostEvent Master merged #5706 since this branch's base: its new guard test (tests/issue5706-opencode-host-console.test.ts) forbids raw console.* in the two opencode plugin entries (host TUI terminal) and requires every relocated diagnostic to ride logHostEvent. The v2 install lines added here still used raw console.log, so the merge-of-master head failed the guard on CI shard ubuntu-22-2 (not ok 1833/1834). Both lines now match their v1 siblings; behavior is unchanged apart from the output channel (terminal -> bili.log), which is exactly what #5706 mandates.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) CI 红项定位完成,确定性回归已修并推送(新 head ① test (ubuntu-latest, 22, 2) = 跨分支交互回归(本分支引入,已修):master 在本分支基点之后合入了 #5706,其新增守卫测试 ② test (windows-latest, 22, 1) 与 ③ test (ubuntu-latest, 24, 2) = 瞬态噪音(判定,待重跑证实):两份日志的 TAP 流都正常推进到中途后戛然而止(断在行中间),无任何错误注解/退出码;日志最后时间戳比 job 结束早 1~3.5 分钟 = 测试进程运行中被杀(OOM/runner 故障特征),不是测试失败。与 #4599 今日记录的全局抖动(#6138 Windows npm-ci ECONNRESET、多起 flake 自愈)吻合。本次重跑会直接给出裁定。 本地定向验证(全量裁决仍归远程 CI):#5706 套件 2/2 绿、#5625 hook-payload 套件 4/4 绿、opencode-native 套件绿(65 内层用例)、typecheck 干净。 CI 在新 head 上跑完后我会补最终结论(含八问)。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) CI 车道收工:新 head 八问1. 是什么问题:merge-of-master head( 2. 什么原因导致的:① ubuntu-22-2:master 在本分支基点之后合入 #5706,其新增守卫测试禁止两个 opencode 插件入口文件出现裸 3. 影响范围与严重程度:仅影响本 PR 的 CI 门禁,无用户面影响。修复本身对用户是正向小改进(见行为变更披露)。 4. 怎么修复的:两行改为与各自 v1 兄弟行字节级一致的 5. 是否有回归问题:逐项审过既有行为——修复只改变这两行的输出通道;#5706 守卫双向断言(禁裸 console + 诊断必须仍在)本地 2/2 绿;#5625 hook-payload 契约套件 4/4、opencode-native 套件全绿、typecheck 干净;远程 CI 上原先红的 3 个分片全部转绿,e2e lane 的 skip 为 env 门控跳过(与前几轮一致,非异常)。merge base 之后 master 新增 5 提交与本 PR 文件集仅重叠 6. 是否破坏缓存:不涉及。 7. 是否改了设计方向:否——本次修复是向 #5706/#2827/#2831 已确立的 host-log 惯例(所有 native 车道走 logHostEvent)对齐。 8. 是否引入了新的配置:无。 行为变更披露(旧值 → 新值 + 原因)v2 fetch-patch 安装提示行: 判定:CI 车道全部闭环并实证绿,PR head |
…lict resolution (#4599 help-merge) Single conflict: scripts/live-files.mjs — both sides appended LIVE_FILES entries at the table tail. Union resolution keeps master's two new entries (pack-install, ci-janitor-fork-heads) in master's slot order and appends the #5625 suite entry after them (its comment states no zone band is needed, so the slot shift is inert). docs/configuration{,.zh-CN}.md auto-merged: master's compressAtFoldPoint doc removal applied, this PR's providers.direct V2 wording preserved. No other files conflicted.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 上游冲突已处理完毕:master(259cd87)已合入分支,唯一冲突已解,新 head 本轮做了什么:
CI 结论(新 head cb408bc,活体核实): 50 个 check run = 37 success + 13 skipped(设计内 env-gated e2e 车道)+ 0 失败;merge state = blocked(= 可合并、等待人工,不再是 dirty)。注:镜像缓存轮询器本次卡在 16:59:35Z 未刷新(>25 分钟),CI 结论改用单次 GitHub API 读取核实(非轮询)。 八问:
判定:冲突已解、CI 全绿,PR 就绪,等待人工合并。 |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
Pass-3 review — head cb408bcc56. The branch has been rebased onto current master (259cd87674) via CI-lane merge commits (#4599 help-merge) and is now up-to-date (0 behind). The only new logical change since the previous reviewed head is 7dad138221, which routes the two v2 fetch-patch bootstrap lines from console.log to logHostEvent — required because master merged #5706 (a guard test forbidding raw console.* in the two opencode plugin entries). Verified: logHostEvent is imported in both src/agent/opencode-native.ts:93 and src/agent/opencode.ts:27, the new lines (opencode-native.ts:1024, opencode.ts:184) match their v1 siblings, and behavior is unchanged apart from the output channel (terminal → bili.log), which is exactly what #5706 mandates. All core markers of the fix survive the merges: replaceRequestTarget is gone (0 refs), directExemptMatch + the isModelApiUrl /bili/ guard are present in src/agent/native-intercept.ts, installNativeFetchIntercept is installed in both the native and launcher setups, and the WS routedBiliModelUrl tunnel rebuild is in src/agent/opencode-v2.ts:497. The doc (now docs/configuration.md + docs/configuration.zh-CN.md) correctly describes the new opencode-lane behavior and the URL-boundary match rule. CI is green (30 jobs, 0 failed, 0 pending). No new findings this pass — the one small finding (raw console.log in the v2 bootstrap lines) was already fixed on-branch by the CI sentinel. Verdict: clean and mergeable. (Self-approval is not possible — reviewer identity == author — so this is posted as a comment; human merge.)
八问(结构化审核):
- 是什么问题:opencode-lane 的
http.request钩子不再改写共享的e.request请求对象——旧实现在钩子里把目标 URL 替换成<proxy>/bili/<upstream>,把改写过的前缀泄漏给之后所有钩子(包括 Kiro/Antigravity 等 provider 插件),它们看到的是被 bili 改写的 URL 而非真实上游。 - 什么原因导致的:根因是"在错误的层做路由改写"——在
http.request钩子链中间改共享请求对象,污染了后续钩子的视图。正确做法是把<proxy>/bili/<upstream>的重写下沉到 fetch 时刻(所有钩子都跑完之后)才做。 - 影响范围与严重程度:仅当 opencode-lane 同时挂了 provider 插件时,这些插件看到的是被改写的 URL 而非真实上游(可能影响签名/识别);属"特定条件下有问题"。修后 provider 插件重新看到真实上游 URL。
- 怎么修复的:钩子只做发现(
state.proxyBase)+ 打标(e.biliDirect)+ 本地拒绝;真正的目标重写在共享 fetch 拦截链installNativeFetchIntercept里做,native 与 launcher 两个setup()入口都装;direct 豁免走directExemptMatch(精确匹配或<prefix>/边界),与 zcode store lane 语义一致。 - 是否有回归问题:逐项过既有行为——provider 插件重新看到真实上游 URL(有意变更,已披露);signed-body(#1884 x-goog-api-key/SDK-HMAC-SHA256)本地拒绝在 V2 生效(有意);#3304
prepareDirectSend+ #3248onResponseacks 激活(原为死代码);launcher 死 origin 走链 recover/retry/give-up-direct;v1internal 池 URL 走链字节保持;WS 隧道对 stale baked overlay(端口漂移重启后)经routedBiliModelUrl从 live origin 重建(pass 1 发现、分支已修)。无回归。 - 是否破坏缓存:不涉及缓存/重试/增量游标/去重键的失效策略;fetch 时刻重写不改变上游请求语义。
- 是否改了设计方向:路由改写层从"钩子内改共享对象"下沉到"fetch 时刻共享链"——这是本次修复的核心方向变化(有意),让 provider 插件看到真实 URL。
- 是否引入新的配置:无新配置字段;完成既有
providers.<url>.direct的语义(en/zh 文档已同步更新,补 #4276/#5625 引用与 URL 边界规则措辞)。
结论:干净、可合并(合入权在 human)。本 PR 未触碰 kernel/(#5620 的 kernel 变更属 master,非本 PR),无授权门禁。
(ai: vllm-qwen/qwen3.8-27b) PR #5626 pass-3 review done (head |
…lict resolution (#4599 help-merge)
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 上游冲突已再次处理完毕:master(f21b601)已合入分支,3 处冲突全部解决,新 head 本轮做了什么:
CI 结论(新 head a82b65e,活体核实): 50 个 check run = 37 success + 13 skipped(设计内 env-gated e2e 车道)+ 0 失败;merge state = blocked(可合并、等待人工,不再是 dirty)。注:镜像缓存轮询器本轮两次停更(>10 分钟不刷新),CI 结论以单次 GitHub API 读取核实(非轮询),镜像恢复后亦确认同一状态。 八问:
判定:冲突已解、CI 全绿,PR 就绪,等待人工合并。 |
…lict resolution (#4599 help-merge) Single conflict in scripts/live-files.mjs (LIVE_FILES registry): union-of-intent — kept master's new tests/upstream-ca-default-trust.test.ts entry at its slot and appended this PR's tests/issue5625-opencode-v2-hook-payload.test.ts at table end (both entries are SPAWN_RE tripwire-only, no zone band needed). docs/configuration.md + zh auto-merged; verified the PR's providers.direct V2 wording survives and master's compressAtFoldPoint removal is intact. Local: tripwire scan clean (1351 files / 71 registered / 0 unregistered), typecheck clean, build OK, targeted suites 84/84 green.
(ai: vllm-qwen/qwen3.8-27b) 上游冲突已再次处理完毕:master( 本轮做了什么:
CI 结论(新 head 八问:
判定:冲突已解、本地验证全绿、合并态回 |
|
(ai: vllm-qwen/qwen3.8-27b) Re-review (pass 4) — head The branch advanced since the last review: the CI sentinel merged two newer masters ( Verified against the new base:
CI: 19/30 checks done (7 success, 12 skipped), 11 test shards in progress, 0 failures so far. The PR content is byte-identical to the prior head that was fully green, so the re-run is expected to pass. Verdict: clean / mergeable (human merge). The core fix — stop rewriting the shared 8问(中文,供人工 reviewer)
判定:可合(人工合并),待 CI 全绿(当前 0 失败)。 |
(ai: vllm-qwen/qwen3.8-27b) Pass-4 review complete (head |
…lict resolution (#4599 help-merge) Single conflict in scripts/live-files.mjs (LIVE_FILES registry): union-of-intent — kept master's new tests/storage-integrity-cache.test.ts (#7156) entry at its slot and appended this PR's tests/issue5625-opencode-v2-hook-payload.test.ts at table end (both SPAWN_RE tripwire-only, no zone band needed). docs/configuration.md + zh auto-merged; verified the PR's providers.direct V2 wording survives. Local: tripwire scan clean (1360 files / 72 registered / 0 unregistered), typecheck clean, build OK, targeted suites 97/97 green.
(ai: vllm-qwen/qwen3.8-27b) 上游冲突已再次处理完毕:master( 本轮做了什么:
CI 结论(新 head 八问:
判定:冲突已解、本地验证全绿、合并态回 |
|
(ai: vllm-qwen/qwen3.8-27b) Re-review (pass 5) — head The branch advanced once more: the CI sentinel merged the latest master ( Verified against the new base:
CI: fully green — 30/30 (17 success, 13 skipped, 0 failed). Verdict: clean / mergeable (human merge). No new findings; the rebase onto the latest master is clean and the full suite is green. 8问(中文,供人工 reviewer)
判定:可合(人工合并),CI 已全绿。 |
(ai: vllm-qwen/qwen3.8-27b) Pass-5 review complete (head |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Pass-5 review of PR #5626 done — verdict: clean / mergeable (human merge). What I verified this pass (head
Full review with the Chinese 8问 is on the PR (comment |
…lict resolution (#4599 help-merge) Single conflict in scripts/live-files.mjs (LIVE_FILES registry): union-of-intent — kept master's new tests/storage-backup-repair.test.ts (#7156) entry at its slot and appended this PR's tests/issue5625-opencode-v2-hook-payload.test.ts at table end (both SPAWN_RE tripwire-only, no zone band needed). docs/configuration.md + zh auto-merged; verified the PR's providers.direct V2 wording survives. Local: tripwire scan clean (1381 files / 73 registered / 0 unregistered), typecheck clean, build OK, targeted suites 105/105 green.
(ai: vllm-qwen/qwen3.8-27b) 上游冲突已再次处理完毕:master( 本轮做了什么:
CI 结论(新 head 八问:
判定:冲突已解、本地验证全绿、合并态回 |
|
(ai: vllm-qwen/qwen3.8-27b) Re-review (pass 6) — head The branch advanced once more: the CI sentinel merged master Verified against the new base:
CI: 29/30 green (17 success, 12 skipped, 0 failed); one test shard ( Verdict: clean / mergeable (human merge). No new findings. 8问(中文,供人工 reviewer)
判定:可合(人工合并)。 CI 29/30 绿、0 失败,仅剩 1 个 test shard 在跑(PR 自身 diff 与全绿的第 5 轮逐字节一致,预期收尾即绿)。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Pass-6 review complete (head |
(ai: vllm-qwen/qwen3.8-27b) Re-review (pass 7) — head The branch has not advanced: head is still CI is now fully green. Pass 6 left 29/30 with one test shard ( Master advanced My independent verification (re-done this pass, not a re-read of pass 6):
One observation (not a blocker): Verdict: clean / mergeable (human merge). CI 30/30 green, 0 failed; PR diff byte-identical to the green pass 6; master advance is a clean doc-area union; no regression found on independent re-verification. 8问(中文,供人工 reviewer)
判定:可合(人工合并)。 CI 30/30 绿、0 失败,PR 自身 diff 与全绿的第 6 轮逐字节一致,master 推进为 doc 区干净 union,独立复核无回归。 |
(ai: vllm-qwen/qwen3.8-27b) APPROVE — head Formal review verdict. The full independent verification is in the preceding pass-7 comment (same head); this confirms the state is unchanged and green. Why clean:
Small findings: none requiring a fix commit. ( 8问(中文,供人工 reviewer)
判定:APPROVE(可合,人工合并)。 CI 30/30 绿、0 失败;无 kernel 改动、无授权门禁;独立复核无回归、无行为漂移、无缓存破坏。合并按仓库规则由人工执行。 |
(ai: vllm-qwen/qwen3.8-27b)
Rework of PR #4280 (reverted by c076614 over a master conflict; original report #4276) on top of current master. Closes #5625.
What
The opencode-lane http.request hook used to replace
e.requestwith a new Request pointed at${proxyOrigin}/bili/<originalUrl>. opencode hands that one mutable event to every laterhttp.request/http.responsehook, including provider-scoped hooks from other plugins, so provider auth plugins validating the upstream URL broke:@servoy/opencode-kiro-auth): bridge silently stopped engaging → empty assistant responses after ~10 retries.@cortexkit/opencode-antigravity-auth): threw "pool requests need the default Google base URL" before its own hook could run.The routes now only DISCOVER the proxy (
state.proxyBase; oversize refusal / direct-degrade on death) and leave the hook-visible payload untouched. Both setup()s install the shared native fetch intercept chain, which performs the/bili/rewrite at fetch time. The WS handshake hook builds its own tunnel URL instead of relying on the rewritten request.Config surface
No new fields. Completes the already-documented
providers.<url>.direct(#1622) for the OpenCode V2 lanes — previously implemented only in the ZCode lane. Matching requests are markedbiliDirectin the hook and sent direct by the chain; CONFIGURATION.md wording updated accordingly.Behavior changes (disclosed per policy)
x-goog-api-key/SDK-HMAC-SHA256) in V2 processes get the local bili 改写带 body 签名的模型请求,CodeArts(华为 APIG SDK-HMAC-SHA256)全部 401 #1884 refusal instead of unsigned-through-bili → upstream 401.providers.<url>.direct.Tests
New
tests/issue5625-opencode-v2-hook-payload.test.tspins the hook payload contract (untouched request, fetch-time routing, pool dialect, direct exemption, child-process install gate); launcher/native suites updated to the fetch-time contract; the #4669 inline-composition test installs the chain like its sibling and asserts the hook keeps the payload intact. Local targeted runs green (3 suites, 75 tests) + typecheck clean; full-suite verdict = remote CI.