Repository navigation
[PR] BILI_PLUGIN_BYPASS env force-switch for the plugin bypass wire lane (#6220) - #6359
Open
ranxianglei wants to merge 1 commit into
Open
ranxianglei wants to merge 1 commit into
ranxianglei wants to merge 1 commit into
Conversation
…s wire lane (#6220) The plugin bypass decision (handle.ts) previously honored only the per-request x-bili-plugin-bypass header that the opencode-acp host plugin stamps for legacy sessions. There was no user-side override: once opencode auto-disabled bili for those sessions, an operator could not force one side or the other per machine. BILI_PLUGIN_BYPASS (env-only, tri-state, owner ruling in the #6220 thread): - unset/auto: per-request header decides (zero behavior change) - 1/on: force bypass for ALL inbound traffic, raw passthrough, no compression, no session state — the escape valve; first hit warns that traffic reaches the model UNCOMPRESSED if nothing in-process is actually compressing - 0/off: ignore any inbound bypass header, including opencode legacy ones; first hit warns that those sessions' pre-existing ref space lives in the in-process acp store, so their history degrades to a read-only archive - unrecognized values: treated as unset (auto) + one warning Each forced state logs one loud warn-once line (module-level warn-once set, test seam _resetPluginBypassForceWarnForTest). Knob resolver lives in src/knobs.ts (pure, env-injectable) per the knob placement discipline; documented in env-only.yaml (generated docs/configuration.md + zh), docs/lifecycle.md §2.9, and covered by tests/plugin-bypass.test.ts (resolver unit + 4 end-to-end proxy cases incl. the warn-once assertions).
Contributor
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9289-pr.6359.2e57a45This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6359.tgz
npm install -g packageInstall instructions are refreshed on each push. |
This branch has not been deployed
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.
What
Issue #6220 asks for a way to force the
x-bili-plugin-bypassdecision from the outside. Today that decision is made per-request, purely from the header the opencode-acp host plugin stamps for legacy sessions — an operator on a machine where opencode auto-disabled bili had no lever to force either side.This PR adds the env-only knob
BILI_PLUGIN_BYPASSat the proxy decision site (src/server/handle.ts):auto1/on0/offEach forced state emits exactly one warn-once log line (per state); later requests stay at debug level.
Why env-only, no config-file key
Owner ruling in the #6220 thread (plan A, "继续"): this is an explicit escape valve, not a per-machine tunable — env-only by design, per reference/env-vars.md hard rule 1 with owner sign-off in-thread. Generic name (not opencode-specific): the header is a generic wire contract, and the same auto-disable conflict can arise from other in-process compressors too.
Changes
src/knobs.ts— pureresolvePluginBypass()resolver (env: NodeJS.ProcessEnvinjectable, returns"on" | "off" | "auto" | "invalid"), placed with the other resolvers per knob-placement discipline.src/server/handle.ts— decision site consumes the resolver: force-on overrides the header; force-off silences it; invalid behaves as auto. Warn-once setpluginBypassForceWarned+ test seam_resetPluginBypassForceWarnForTest(same pattern as_resetNoOutputCeilingWarningsForTest).tests/plugin-bypass.test.ts— newBILI_PLUGIN_BYPASS force switch (#6220)suite: resolver unit test (tri-state + case/trim + invalid classification) and 4 end-to-end proxy cases against the existing harness (force-on with NO header, force-off WITH header, auto/invalid keep header semantics, warn-once loud lines incl. the exact risk wording). Harness switched tolog: true, logFile: "off"(established pattern, e.g. tests/codex-responses-ws.test.ts) so the engine log — a no-op underlog: false— is observable viasetLogCapture. 7/7 pass.website/config-reference/env-only.yamlentry (generated into docs/configuration.md + zh-CN),docs/lifecycle.md§2.9 line.tools/gen-config-docs.mjs generate+check-coverageclean.Verification
node --import tsx --test tests/plugin-bypass.test.ts→ 7/7tests/knobs-config-precedence.test.ts→ 16/16scripts/check-test-import-graph.mjs,scripts/lifecycle-ledger-guard.mjs,scripts/config-surface-guard.mjs→ all OKnpm run typecheck→ clean