You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add BILLION_CONTEXT_NATIVE stand-down guard (coexistence with bili native plugin) #438
Config hook: /bili/ prefix in provider baseURLs → disabledByBiliProxy + deny own tools
Neither checks BILLION_CONTEXT_NATIVE. billion-context's host-native plugin (bili plugin install opencode, ships in billion-context v0.1.x, see billion-context#918/#919) sets BILLION_CONTEXT_NATIVE=opencodesynchronously at module load and spawns its proxy asynchronously, rewriting baseURLs in its own config hook.
What happens today when both are installed (manual case)
Load order opencode-acp first: its load-time check sees no BILLION_CONTEXT_PROXY (native's proxy isn't up yet) → stays armed. If its config hook also runs before the native plugin's rewrite, findBiliProxyProviders finds nothing → ACP stays armed for the whole process (guards are only re-evaluated on config reload).
Both register tool.compress/decompress/search_context/acp_status — last registration wins; hooks (experimental.chat.messages.transform etc.) from opencode-acp still run with ITS ref space while tools route to billion-context's kernel → double machinery / mismatched refs.
billion-context's installer now strips opencode-acp entries from the global opencode.json (74701fb), but project-local installs and hand-edited configs can still produce the conflict.
Suggested fix
Mirror the pi extension (billion-context-pi) behavior: in the config hook (and ideally each tool/hook action), also stand down when process.env.BILLION_CONTEXT_NATIVE === "opencode":
The env var is set synchronously at native plugin module load, so by the time any config hook or LLM request runs it is visible regardless of plugin load order.
Repro
opencode.json (global): "plugin": ["opencode-acp", "<configDir>/plugins/billion-context"] (the latter from bili plugin install opencode)
Start opencode 1.18.31 with a provider that has an explicit baseURL
Depending on hook order you get double-registered compress tools and/or both kernels armed
(Reported from billion-context PR #919 review — user spotted the coexistence hazard.)
Activity
ranxianglei commentedon Sep 18, 2026
重复判定:与 #405 一模一样,且修复已在 PR #406 实现(CI 全绿,待人工合并)。 建议关闭本条并打
重复标签。共同点(一句话):两条指向同一根因——ACP 现有两个 bili guard(
BILLION_CONTEXT_PROXY加载期检查 + config hook 的/bili/baseURL 检查)都不看BILLION_CONTEXT_NATIVE,与 billion-context native 模式共存时 ACP 不会退让、双压缩;解法也相同——动作时(config hook + 各 tool/hook 调用)依据该 env 退让。核对结果(对照当前 master
06efd39c):index.ts:38只在 setup 时读一次BILLION_CONTEXT_PROXY;lib/bili-proxy.ts只认 provider baseURL 里的/bili/前缀;全仓库BILLION_CONTEXT_NATIVE出现 0 次——master 上确实没有这个 guard。BILLION_CONTEXT_NATIVE === "opencode"时退让)是 PR fix: yield to billion-context native mode via action-time env re-check (#405) #406 实现的严格子集。fix: yield to billion-context native mode via action-time env re-check (#405) #406 覆盖三处采样点(setup fast path、每次 hook 调用的guard()重采样、每次 config run 重采样)+resolveToolContext()单点拦截(全部 5 个工具 execute 的第一句),并顺带把BILLION_CONTEXT_PROXY也改为动作时重采样;非 latching(marker 移除即恢复);新增 10 个测试且经变异验证(回退修复后 7/10 失败)。32d94ac,CI 6 项全部 success(pr-validation / build / build-artifact / test 22 / test 24 / e2e);按仓库规范还差第二个独立 agent review + 人工合并,我不会代合并。本会话没有 issue 管理权限,无法代为执行关闭 / 打标签操作,请 @ranxianglei 按重复处置约定确认关闭。
一句话总结:#438 与 #405 完全相同(同根因、同方案),所需 guard 已在 PR #406 实现且 CI 全绿,建议按重复关闭本条,评审精力集中在 #406 上。