Repository navigation
feat(config): named provider lanes — bind aliasing + dead-field guard (one-shot #1469) - #1473
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1742-pr.1473.a1e60d6This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1473.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 开始 review PR #1473(named provider lanes — bind aliasing + dead-field guard,one-shot #1469)。已拉取分支 |
b7167ac to
1cbc7ef
Compare
[bot] 🏷 Review progress — rebase done, two small fixes pushed, final verdict after CI/local gates. ① Direction (原 issue): matches the one-shot decision exactly. ② Regression audit: walked all four ③ Code: logic/invariants/error handling clean;
④ Tests: all have teeth — 11 new ⑤ Base freshness — action taken: the branch was based on Verdict follows once both go green. Merge stays yours. 中文摘要:审查通过方向与回归审计,已在 PR 分支上顺手修了两处小瑕疵(config.ts 残留的孤立注释、中文文档错别字),并把分支 rebase 到最新 master(干净无冲突)后推送了新 head |
[bot] 🏷 Final review verdict: mergeable — head ① 原 issue(方向关)— passThe implementation matches the #1469 one-shot decision point-for-point: ② 回归审查(既有行为清点)— all cleanWalked every existing consumer of the changed paths:
③ 代码审查 — passLogic/invariants/error handling clean. Spot-checks that mattered: ④ 测试有效性 — real teethNo tautologies: 11 new ⑤ diff 整洁度 — clean (after rebase)10 files, +625/−35; one linear commit chain; every line serves the PR purpose. Action taken during review: branch was based on Behavior-change ledger (old → new, all pre-disclosed in PR body — verified accurate)
Verification evidence (head
|
Narrow the #1383 stopgap veto so an explicitly opted-in non-http(s) baseUrl provider (e.g. pi-claude-bridge's literal "claude-bridge") can claim compaction ownership when its traffic actually flows through bili. Opt-in (either mechanism): config file plugin.nonHttpProviders ({"<providerId>": true}) or env BILI_NON_HTTP_PROVIDERS (comma-separated). The launcher resolves both and mirrors them to the client env. Safety property preserved (#1382): opt-in only widens the candidate set. An opted-in non-http provider still passes the SAME carriage-evidence gate (carriedSids local stamp / /__bili/plugin/status probe), so unrouted traffic never cancels and native compaction keeps working. No behavior change unless opted in: with no opt-in configured, non-http(s) providers are never cancelled - byte-for-byte the prior stopgap behavior.
…rd test (#1392) - Update the #1382 comment block: non-http baseUrl vetoes BY DEFAULT now (BILI_NON_HTTP_PROVIDERS opt-in below widens only the candidate set). - Add case (E): opted-in non-http baseUrl stays outside destinationRoutedThroughProxy — opt-in must never widen wire-side routing (no /bili/ rewrites, no stamped cache keys, no MITM candidacy). Guards Phase B against accidentally wiring the flag into stamp eligibility.
…s table (#1392, owner decision) plugin.nonHttpProviders section is gone — the opt-in now lives where users already look: the providers table, keyed by the provider id, with a compactionOptIn boolean field on the entry: "providers": { "claude-bridge": { "compactionOptIn": true } } A non-URL key is inert for routing (longest-prefix matching never hits it); parseRouteEntry ignores the field. Env mirror BILI_NON_HTTP_PROVIDERS is unchanged (union with the file, deduped). Docs: field reference entries in CONFIGURATION.md (+zh) and the launcher prose updated.
…#1469) A non-URL providers key with 'bind' becomes a pure alias of the bound URL lane: its routing fields (compress/models/proxy/passthrough/compressProtocol/compat/imageBilling) deep-merge onto the URL route at config-load time only (explicit URL key wins per field; external ACP_PROVIDERS beats inline at every level). Name keys without bind stay routing-inert and now get a startup warning when they carry routing fields. Web config API now round-trips raw entry values so saves can no longer clobber bind/compactionOptIn.
1cbc7ef to
b0c5658
Compare
|
Rebased onto current master (head |
[bot] 🏷 Rebase verified; the one red job was a flake in a NEW MASTER test (not PR code) — rerun green, run now 13/13. ① Your conflict resolutions check out. On
② CI: 12/13 then 1 failure —
③ Drift note (informational): your rebase base ④ Flake follow-up: the 400 ms/250 ms fixed walls in that property-net helper will keep biting any PR's windows-24 job under load (it's now in master via #1625). Suggested root fix: make the walls adaptive (baseline-measured latency scaling) or event-driven waits instead of fixed timers. I have not filed a separate issue since this thread is a PR-mirror — say the word and I'll file it with the 来源 marker pointing here. Verdict: no PR-caused regressions; both compression modes unaffected; no load-bearing infra touched. Mergeable once CI is green to your satisfaction (it now is) — merge stays yours. 中文摘要:你 rebase 后的唯一红点是 master 新测试(#1613 abort/rewind property net,不在本 PR 代码里,CI 按 merge-ref 检出才跑到的)在 Windows 慢机器上撞了测试内部写死的 400ms 超时墙——已重跑该任务通过,整条 run 13/13 全绿,与本 PR 无关;冲突解决(文档两节并存、pi.ts import 并集)均已核实无误,可以合并。 |
Closes #1469. Supersedes #1466 (closed unmerged). Also lands the substance of #1437 — which is not actually merged (still open/unmerged on GitHub; master contains none of it — verified by grep + GitHub API), so per the one-shot decision this PR carries both pieces in one linear history.
What changed
1. #1437 substance (cherry-picked from its branch, zero conflicts)
providers["<name>"] = { "compactionOptIn": true }: non-URL keys are routing-inert; the launcher exports the union toBILI_NON_HTTP_PROVIDERS(public env contract, unchanged); the pi/omp plugin's evidence-basedownsCompaction(fix: cancel pi/omp auto-compaction only on evidence the proxy carries the conversation (#1382) #1383) stops vetoing that provider's non-http baseUrl. Default behavior byte-for-byte unchanged when unset.2.
bind— named entries become real lanes (new)bind= an http(s) base URL; the named entry becomes a pure alias of that URL lane. Resolved purely at config-load time inloadRoutes(src/config.ts): the entry's routing fields (compress,models,proxy,passthrough,compressProtocol,compat,imageBilling) deep-merge onto the bound URL route and apply exactly as if written under that URL key. No named-provider awareness anywhere in the request path; names never appear on the wire. When [investigation] Taking over pi-claude-bridge traffic: route the bridge child's upstream calls through bili so compression ownership becomes natural #1468 lands, removal is a deletion, not a refactor (aliasing lives only in config resolution).ACP_PROVIDERSfile beats inline config at every level (aliases fold in source order, first-set wins). Objects merge per key; arrays/scalars are taken wholesale from the winner — no element-wise merging.bindstays routing-inert (agent-side identity only).3. Dead-field guard (the known wart, fixed in the same PR)
A name key without
bindthat carries routing fields → startup warning naming the key and the inert fields ("addbind, or move these under the URL entry"), once per signature — loud, not silent. Invalidbindvalues (non-string, non-http(s) URL) warn and leave the entry inert;bindon a URL key warns and is ignored.4. Web config API made raw-faithful (source-level fix for a clobber)
handleConfigPutrebuilt every provider entry throughparseRouteEntry, which silently drops unknown fields — any web-UI save would have erasedcompactionOptIn(already-shipped shape) and would have erasedbind. GET/PUT now pass raw entry values through; validation is unchanged (legacy-shape reject + proxy scheme check still run).config surface
New/documented fields (owner-gated surface):
providers[<name>].bind(string, http(s) base URL) — new, this PR. Why the existing surface cannot express it: URL keys are matched by longest prefix, so a name key can never carry routing fields today; the launcher-name-map approach (feat: named provider entries bind onto their URL lanes #1466) put aliasing in launcher env plumbing instead of config, splitting one mapping across two layers. Considered and rejected: implicit name→URL inference (ambiguous, silent), per-lanealiasesarray on URL entries (inverse direction — the name must also carrycompactionOptIn, i.e. the identity lives on the name key).providers[<name>].compactionOptIn(boolean) — lands here because feat: opt-in for non-http(s) baseUrl providers to ride bili (#1392) #1437 never merged; shape is exactly the owner-decided one from that thread.bindbehave exactly as before (inert + opt-in consumed); the dead-field warning is advisory, not an error.BILI_NON_HTTP_PROVIDERSenv-var contract unchanged.Behavior changes (disclosed)
providersblock. ExternalACP_PROVIDERSfile entries no longer appear in the view (they were never persistable through the UI's PUT anyway — the old view displayed them while PUT ignored them, which was misleading).loadRoutesnormalizes keys at load time, so stored-key normalization stays intact.[acp-config]): inert routing fields on a name key withoutbind; invalidbindvalue;bindpresent on a URL key.Tests
tests/named-provider-bind.test.ts(11 tests): bind aliasing applies compress/models/proxy onto the bound lane; URL-key per-field precedence incl. presence-semantics (passthrough: false) andcompat.rolesper-key merge; arrays taken wholesale from the URL lane; name-without-bind inertness + warning text; invalid binds (non-URL string /ftp:/// number) warn and stay inert;bindon a URL key warns + ignored; external file outranks inline at every level;compactionOptInconsumed alongsidebindvia theresolveNonHttpProvidersunion; warning dedup across reloads; web round-trip preservesbind/compactionOptInon disk and the runtime alias still resolves; PUT still rejects legacy string entries / socks5 proxies / array providers with 400.Pre-flight (rebased head
b7167ac0, base = current mastera57ab8dd)npm run typecheck✅npm test✅ 2897 tests, 2885 pass, 0 fail, 12 skipped (baseline 2886/2874 + 11 new)npm run build✅ (dist-import-annotations OK)Docs: CONFIGURATION.md en/zh — new "Named provider entries (
bind)" section (alias semantics, precedence, all three warnings), cross-links from the Providers intro andcompactionOptIn.