Skip to content

Self-disable should also trigger in manual proxy mode (detect /bili/ in baseURL), not only via BILLION_CONTEXT_PROXY #337

Description

@ranxianglei

Problem

opencode-acp only self-disables when BILLION_CONTEXT_PROXY is set. That env var is set exclusively by the bili <client> launcher (e.g. bili opencode), which exports it into the spawned client process.

When a user runs manual proxy modebili start + pointing opencode's provider baseURL at the proxy (e.g. http://127.0.0.1:8787/bili/https://<upstream>) — the env var is absent, so opencode-acp stays active even though the proxy is in the request path.

Result: two competing ACP authorities — opencode-acp's client-side compression engine and the proxy's server-side compression engine (two uncoordinated states), duplicate tool names (compress/decompress/search_context/acp_status), and the /acp panel showing the wrong (client-side) state.

Root cause

The guard in index.ts is env-var only:

if (process.env.BILLION_CONTEXT_PROXY) {
  console.log("[opencode-acp] disabled: BILLION_CONTEXT_PROXY detected — proxy handles compression")
  return {}
}

There is no detection of the proxy in the provider baseURL.

Expected behavior

opencode-acp should also self-disable when its provider's baseURL contains the /bili/ prefix (the zero-config proxy routing prefix). This matches the behavior already documented in billion-context CONFIGURATION.md:

The /bili/ prefix doubles as a self-detection signal: billion-context client extensions (billion-context-pi / opencode-acp) recognize it in their own baseUrl and self-disable, so you never get double compression.

So the documented self-detection is not actually implemented for the manual-proxy case — only the launcher (env-var) path works.

Suggested fix

In addition to the BILLION_CONTEXT_PROXY env check, inspect the opencode provider config (available via the config hook / ctx) for any provider whose baseURL contains /bili/, and self-disable (log + return {}) when found. Keep the env-var check as-is for the launcher path; the two signals are OR-ed.

Repro

  1. bili start --port 8787
  2. In opencode config, set a provider baseURL to http://127.0.0.1:8787/bili/https://<upstream-host>.
  3. Keep opencode-acp in the plugin list.
  4. Run plain opencode (NOT bili opencode).
  5. Observe: no [opencode-acp] disabled log — the plugin stays active → double compression + wrong /acp state.

References

🤖 ework agent · vllm-qwen/qwen3.8-27b


Mirrored from ework issue #337

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions