Repository navigation
fix(agent): opencode v2 preset-env attach — close the pseudo-attach 404 hole (three-mode delivery verified) - #885
Merged
ranxianglei merged 1 commit intoSep 17, 2026
Conversation
…ive plugin instead of standing down
The pseudo-attach hole: presetting BILLION_CONTEXT_PROXY and running bare
opencode disarmed the native bootstrap entirely (no spawn, no attach) while
tools still discovered the proxy through the env — model traffic silently
went direct, the proxy never saw the session, and every tool forward 404'd
("unknown plugin conversation"). planNativeOpencode now treats the preset
value as an external attach target (probe + rewrite + stamp, same semantics
as BILLION_CONTEXT_ATTACH; explicit ATTACH wins when both are set). Kill
switches (BILLION_CONTEXT_PLUGIN=0, BILI_NATIVE_OPENCODE=0) and /bili/
launches (BILI_PROVIDER_REWRITES) still stand down; a garbage preset falls
back to spawn.
Also: the opencode v2 plugin tool forward now returns guided text when the
proxy reports the conversation was never registered, instead of surfacing
the raw 404 that sent the model down a "refresh/restart" tangent.
Verified in-container end-to-end (real qwen upstream) across all four
postures: proxy (baseURL), launcher (bili opencode), native spawn (bare
opencode + plugin), and preset-env attach — session registration, live
conversation, acp_status real execution, /acp panel render.
Owner
Author
|
Fixes #886 (issue filed for the pseudo-attach 404 this PR closes). |
ranxianglei
merged commit Sep 17, 2026
a119940
into
2026-09-15_opencode-native-plugin
1 check passed
This was referenced Sep 17, 2026
Merged
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacks on #850 (base = its source branch). Delivers and verifies the three opencode v2 integration modes end-to-end, and fixes the bug behind the "tools 404 / ACP never activates" reports.
The bug
Presetting
BILLION_CONTEXT_PROXYand running bare opencode disarmed the native bootstrap (no spawn, no attach) while tools still found the proxy through the env: model traffic silently went direct, the proxy never saw the session, and every tool forward 404'd (unknown plugin conversation). The model then told users to "refresh/restart" — the exact symptom reported during v2 testing.The fix
planNativeOpencode: a presetBILLION_CONTEXT_PROXYis now an attach target (probe + rewrite + stamp — same semantics asBILLION_CONTEXT_ATTACH; explicitATTACHwins when both set). Kill switches (BILLION_CONTEXT_PLUGIN=0,BILI_NATIVE_OPENCODE=0) and/bili/launches (BILI_PROVIDER_REWRITES) still stand down; a garbage preset falls back to spawn. Double-rewrite is impossible:isModelApiUrlalready skips/bili/-shaped URLs.opencode-v2tool forward: the never-registered 404 now returns guided text ("send one normal message first; ACP activates automatically") instead of the raw error the model misread.Verification (real upstream, in-container, all four postures)
/bili/)bili opencode)Bun daemon
http.requestRequest-replacement (the #809 core risk) confirmed live in postures 3 and 4: traffic registered on the plugin-managed proxy with[plugin] [acp-usage]header evidence and 99% prefix-cache hits.Pre-flight:
npm run typecheck✅, fullnode --import tsx --testsuite ✅ (b50 run), focused re-runopencode-native/opencode-v219/19 ✅,npm run build✅.Fixes the pseudo-attach half of #809's verification list; the residual daemon-lifetime caveat (a stale
serve --servicedaemon predating a bili launch keeps its old env) remains a usage note, not code.