Repository navigation
fix(agent): gate opencode native route behind nativeActive (#840) - #842
ranxianglei merged 1 commit into
Conversation
…ious overlap warning (#840)
[bot] 🏷 收到,这是 agent 已完成的 [PR],按规范不重做——正在核对分支代码、跑 pre-flight(typecheck/test/build)、检查 CI 状态,结论稍后回复。 |
Verified — no rework done (per [PR] protocol: audited code + CI + reproduced pre-flight instead of redoing). Diff cleanliness: single commit, 3 files, +164/−1 — every line serves the stated purpose. The source change is 3 lines of logic ( Correctness (code read):
Local pre-flight at head
Regression proof reproduced: restored the pre-fix CI status on head
Stacking: verified Nothing to fix in the PR branch itself — no small issues found during review. 中文摘要:修复了 opencode native 插件在 overlap 模式下无条件创建 |
|
继续 |
0a997a4
into
2026-09-15_opencode-native-plugin
…existence-audit fix(agent): gate opencode native route behind nativeActive (ranxianglei#840)
What
#840 audit fix (a): gate the opencode native entry's traffic-touching route/setup creation on
nativeActive, mirroring pi's gated fetch intercept (src/agent/pi-native.ts).Under a
bili opencodelaunch the launcher owns the proxy; the native entry previously still created itshttp.requestroute unconditionally. The idle route never rewrote anything (no origin to probe), but on HTTPS (cert-MITM) launches it fired one misleadingproxy unavailable — model requests go direct (uncompressed)line even though the launcher's proxy was compressing fine.With this change the overlap-mode export degrades to exactly the launcher-mode shape (
src/agent/opencode.ts): no route → no probing, no rewriting, no warning; header stamping falls back to/bili/-URL orBILLION_CONTEXT_PROXYenv detection, which is correct in overlap mode (both plugins stamp identical values — the known harmless redundancy of #840 gap 3).Why not fully inert the export (which would also fix gap 3): that changes behavior for manual-
BILLION_CONTEXT_PROXYedge users (they currently keep native tools via env detection) and exceeds the scope of (a) as scoped in the issue. Gap 3 stays deferred for owner decision.Per-seam tests (owner constraint: per-seam e2e before merging)
tests/opencode-native-overlap.test.ts— evaluates the REAL native entry under a launcher env (BILLION_CONTEXT_PROXY+BILI_PROVIDER_REWRITES): request reference untouched across hook fires, zeroproxy unavailable/bili-nativewarnings, launcher-mode header stamping intact (env-detection and/bili/-wrapped URL cases). Regression proof: with the source fix stashed, this file FAILS (the spurious warning fires); with the fix, green.tests/pi-native-overlap.test.ts— real pi native entry under both launcher-env variants: global fetch NOT patched (intercept flag absent, fetch identity unchanged), no native host marker, plugin export unconditional. Codifies the hands-on pi-seam verification (passes pre-fix too — pi's seam was already correctly gated).Hands-on verification (real binaries, local upstream)
bili pi) — single proxy instance, compression active (prefix-affinity chain advancing, high cache-hit ratio), zerobili-native:lines in any log. Confirms the code-read inference: pi overlap is fully silent (fetch intercept never installed).x-bili-hop/x-bili-tunnelstamps (via-proxy proven), single proxy, no double spawn, zero spurious warnings post-fix.Pre-flight
npm run typecheck— cleannpm test— 1654 pass / 0 fail / 2 skipped (ACP_TEST_E2E-gated e2e)npm run build— successStacks on PR #824 (base =
2026-09-15_opencode-native-plugin) because the native-mode entries are not on master yet; rebase onto master once #824 lands.Fixes #840