Repository navigation
fix: plugin manifest / session-effective ccr toolName divergence (#1345) - #1352
ranxianglei wants to merge 1 commit into
Conversation
ccr.toolName merges deepest-wins across global → provider → model, but the plugin manifest reads only the base config — a provider/model-level override left the host registering one name while execution gated on another, so the model's calls were rejected as unknown tools with CCR reporting enabled. Plugin mode now stamps the session under the ADVERTISED name: - store.ts: advertisedRetrieveToolName() = the base-config name the manifest serves; normalizePluginCcrName() folds a divergent resolved toolName back to it (sub-fields untouched), warns once per session. - plugin.ts: manifest name comes from the same helper (single source). - server.ts: the session stamp is normalized in plugin mode only — proxy mode injects per-request under the session name, so per-route renaming keeps working there. - config.ts: warnCcrToolNameOverrides() at load names the level, the rejected value, and the effective base name — a half-applied override surfaces at load time, never at the model's first tool call. Fixes #1345
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1352Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1352.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review verdict: correct within its narrow scope, but the scope is incomplete against the contract approved in #1345 — superseded by #1360. Closing this PR; details below. What I verifiedPulled ① Original issue (#1345) — direction checkThe bug is real and the mechanism was confirmed during #1345 triage: the manifest is built from the GLOBAL view only ( ② Regression review — existing behaviors on the touched paths
Behavior changes are disclosed in the PR body (plugin sessions now dispatch under the base name when an override diverged; new load-time + per-session warnings) — Deliverables rule 4 satisfied. ✅ ③ Code reviewThe implementation of what it sets out to do is correct: fast-path returns the identical reference when names match, the sticky
④ Test validityThe 4 new tests are real (exact-string assertions, sticky-flag check, reference-identity check, live manifest render) — but they pin only the toolName field, and none of them drives the real request pipeline. ⑤ Diff cleanlinessClean: 1 commit, 5 files, every line relevant. ✅ The decisive finding — the
|
Fixes #1345
What & why
ccr.toolNamemerges deepest-wins (global → provider → model), but the plugin manifest reads only the base config — a provider/model-level override left the host registeringacp_retrievewhile the runtime dispatched underretrieve_original: the model's calls rejected as unknown/disabled tools, CCR otherwise reporting enabled, zero diagnostics. Silent half-applied config.Implements the issue's preferred direction (option 1: normalize with a visible load-time signal) — option 2 (alias registry) stays rejected for the same #1192 reason: it makes the static manifest surface dynamic.
Fix
Plugin mode stamps the session under the ADVERTISED name (
src/store.ts):advertisedRetrieveToolName(ccr)— the base-config name the manifest serves (extracted;handlePluginManifestnow uses the same helper = single source of truth);normalizePluginCcrName(stamped, optsCcr, session, log)— folds a divergent resolvedtoolNameback to the advertised name (all sub-fields —enabled,minToolTokens,excludeTools,maxHeadChars— ride along untouched), warns once per session;server.tsapplies it to the CCR stamp in plugin mode only — proxy mode injects the tool per-request under the session-effective name, so per-route renaming keeps working on all four proxy wires (acceptance criterion);config.tswarnCcrToolNameOverrides(routes, globalCcr)fires atloadOptionstime and names the level, the rejected value, and the effective base name for both provider- and model-level overrides (acceptance criterion: load-time diagnostic, never the model's first tool call). Route/model levels keep control over every other CCR sub-field.Model switching within a plugin session can no longer split the registered surface from the effective config: whatever the deepest resolution produces, the stamp is normalized before
storeEffectiveCcr, so gate (retrieveToolName(session)), placeholder hints (buildStoredPlaceholder), and manifest always agree.Tests
tests/issue1345-plugin-ccr-name.test.ts(new, 4):retrieveToolName(session)== manifest);warnCcrToolNameOverrideslogs both levels with the naming pattern (matching names stay silent).Existing
store/ccr-plugin/ccr-v2: 31/31 unaffected. Typecheck 0. Red-on-master: import failure (new API).