Repository navigation
fix: advertise absorb/acp_rule in plugin manifest when globally enabled (#1278) - #1281
Conversation
ee5dd94 to
371f15b
Compare
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1281Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1281.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review complete — this is our own earlier work (opened from #1278), so per protocol I verified rather than redid it, and brought it current against master. Mergeable after the rebase below. ① Original issue (direction gate). Re-read #1278 and re-verified the diagnosis at source: the manifest route read the raw kernel-default config while the request path resolves ② Regression audit (existing behaviors on touched paths).
③ Code review. Single call site + one import addition; the comment block documents why the line must not be "simplified" back to ④ Test validity. The two new tests drive the REAL file-config path ( ⑤ Diff cleanliness. 2 files, one commit, every line on-purpose. No churn. Rebase (the one thing that needed doing): the branch was stale — cut from Pre-flight on the rebased head (local, full gate):
中文一句话: 复核了我们自己从 #1278 开的这个 PR——修复方向正确(manifest 路由与请求路径共用同一份已解析的全局压缩配置,治本而非堵症状)、回归面严格限于工具广告(未启用者 manifest 逐字节不变、无共享对象变异)、测试走真实文件配置路径且有牙;唯一动作是把过期分支 rebase 到当前 master(仅 import 行冲突,按并集解决)并重跑全套预检全绿,现 |
…ed (#1278) The /__bili/plugin/manifest route read absorbEnabled(config)/rulesEnabled(config) off the raw kernel-default config (opts.kernelConfig), while the per-request path resolves opts.compress onto it via applyCompressSettings. A user enabling compress.absorb.enabled in their config file therefore got [ACP absorb] prompts on the wire but no callable absorb tool registered by hosts that register only manifest tools (Pi native plugin) — the prompts could never be executed. Resolve the global compress settings at the manifest route so both paths agree; per-session/provider enablement stays execution-time-gated. Adds enabled + disabled regression tests exercising the real file-config path. Fixes #1278
371f15b to
081f05d
Compare
Summary
GET /__bili/plugin/manifestadvertised opt-in tools (absorb,acp_rule) from the raw kernel-default config instead of the user's global compress settings. The per-request path resolvesopts.compressonto the kernel config viaapplyCompressSettings; the manifest route readconfig(=opts.kernelConfig) directly. So a user enablingcompress.absorb.enabled: truein their config file got[ACP absorb] … call absorb(…)prompts on the wire, but hosts that register only the manifest's tools (the Pi native plugin,dist/agent/pi-native.js) never registered a callableabsorb— the prompt could never be executed.Root cause (verified): two config objects diverged on this one route.
handlePluginManifest(res, config)→absorbEnabled(config)/rulesEnabled(config)read off kernel defaults (absorb disabled).resolveRequestConfig(config, opts.routes, url, model, native, opts.compress)→applyCompressSettings(base, limit, compress)setsabsorb.enabled = s.absorb.enabled === true.The existing test
plugin manifest: absorb and acp_rule advertised when enabled in configmasked the bug because its harness injectedabsorbthroughkernelConfig(the exact path the manifest reads), not through the real file-config path (opts.compress).Fix
At the single
/__bili/plugin/manifestcall site insrc/server.ts, resolve the global settings before building the manifest:Both
configandoptsare already in scope of the route handler. This makes the manifest agree with the request path for globally-enabled tools. Per-session / provider / model enablement stays execution-time-gated (the manifest is one static doc for all clients — same intent as #1192).This corrects two tools at once, not just
absorb:absorb— now advertised whencompress.absorb.enabledis globally true (was: always omitted). ← the reported bug.acp_rule— now advertised whencompress.rules.enabledis globally true (was: always omitted). Same latent bug, same root cause; fixed by the same line.For users who have NOT enabled these features, the manifest is byte-for-byte unchanged (kernel defaults still disable both). No change to compression semantics, wire shape, or persistence — only which optional tools are advertised to manifest-driven hosts.
Tests
plugin manifest: absorb advertised when enabled in the global compress block(enabled case, real file-config path).plugin manifest: absorb omitted when the global compress block disables it(disabled case).startHarnesshelper with an optionalcompressparam so tests can exercise the realopts.compresspath (previously onlykernelConfigwas reachable).Pre-flight
npm run typecheck— cleannode --import tsx --test tests/plugin-protocol.test.ts— 16/16 passnpm test— 2449 pass / 3 fail; the 3 failures are pre-existing environmental e2e (tests/claude-native.test.ts: live-ps-walk + real-process lifecycle) that fail identically on a clean tree, unrelated to this change.npm run build— successFixes #1278