Repository navigation
feat: search_context targets historical sessions read-only via conversation_id - #858
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-858Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr858.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review complete — PR #858 verified, ready to merge. CI (head d49c681): all 7 checks pass — tests on ubuntu/windows × node 22/24, build-artifact, version-guard, and the zero-token codex e2e. Local pre-flight on rebased head (branch is a single linear commit directly on current master a752e54 — no stale base):
Diff hygiene: 11 files, +340/−26, every line related to the feature. No lockfile churn, no version touch, no unrelated files. New test file + extended plugin-protocol assertions. Code verification against the three claims:
Both compression modes covered per §6 (proxy mode: wire schema via BILI_ constants; plugin mode: manifest description + No blocking findings. Merge is yours to do (agents don't merge). 中文摘要:审查了跨会话只读搜索(search_context conversation_id)的实现与测试——内核常量零改动、冷加载路径零写入(无 #408 clamp 副作用)、自引用/别名/未知 id 边界全覆盖、双压缩模式均验证通过,本地 typecheck/test/build 全绿且 CI 全绿,可以合并。 |
|
继续 |
|
冲突 另外这个是否有回归问题 这个是否有行为改动 |
…sation_id Extends the #760/#761 per-call conversation_id plumbing with a second, execution-layer semantic for search_context: when the id does not match the caller's own session (verbatim or canonical alias), the call searches that historical session instead of re-routing to it. - resolveForeignSessionState: resident memory first (peekSession / findSessionByCanonicalId), else SessionStore.loadStateForSearch — a new strictly read-only persistence path that never schedules saves (unlike loadSync, which has the #408 clamp side effect). - Cross-session results are scoped and namespaced: output lines carry 'in session <id>' plus a note that block ids are per-session namespaces; decompress stays anchored to the current session, bulk content via 'bili export <id> [--full]'. - Unknown ids fail loudly ([search_context FAILED: unknown session ...]) without creating state. - search_context's conversation_id param description is specialized in the plugin manifest (routing text kept for all other tools); wire-mode schemas gain the optional param via BILI_* derived constants so proxy-mode clients can target historical sessions too. Kernel constants are never mutated. - MCP shim keeps conversation_id in args only for search_context so the proxy resolves the target itself; routing semantics for every other tool are unchanged, and no tool call ever mutates a foreign session. Closes #841
2eefd9b to
b941b5d
Compare
冲突已解决并重新 pre-flight,回归与行为改动逐条回答如下。 冲突
回归(均在 rebased head
行为改动
推送后 CI 会重跑全量检查。合并由你操作(agent 不合并):#858 中文摘要:解决了 master 前进导致的冲突(仅两行 import 取并集,rebase 后 typecheck/test/build 全绿无回归);行为上仅新增"显式指定历史 session 只读搜索"的 opt-in 能力,外加把 MCP search_context 的外部 id 从 re-route(会碰目标 session 状态)改为锚定调用者的只读搜索,默认路径 byte-for-byte 不变,可以合并。 |
Closes #841
What
search_contextaccepts the existing per-callconversation_idparam (shipped for MCP routing in #760/#761) as a read-only cross-session search target: when the id does not match the caller's own session (verbatim or canonical alias), the call searches that historical session's compressed blocks instead of re-routing to it. Omitted or self-referencing ids keep today's behavior byte-for-byte.This satisfies the issue's three minimal points:
pfa-*target —search_context({query, conversation_id: "pfa-old"})searches that session in both proxy mode (wire schema gains the optional param via derivedBILI_*constants; kernel constants never mutated) and plugin mode (param description specialized in the manifest).resolveForeignSessionStateprefers resident memory (peekSession/findSessionByCanonicalId), else a newSessionStore.loadStateForSearch(id)path that reads the envelope and merges state without ever scheduling a save (unlikeloadSync, which carries the 代理压缩不上报改写量,宿主上下文会计塌缩至 ~0(omps recordAnchoredHistoryRewrite 零调用);且持久化 lastInputTokens 恢复无钳制,旧版负值升级后复活 #408 clamp side effect).lastSeenare untouched; the cold-load path performs zero writes (asserted by test: file bytes identical before/after, no pending saves). The MCP shim keepsconversation_idin args only forsearch_contextprecisely so the proxy resolves the target itself rather than adopting it as the caller's binding.Cross-session results are namespaced: output lines carry
in session <id>plus a note that block ids are per-session namespaces (decompressacts on the current session only; bulk content staysbili export <id> [--full]). Unknown ids fail loudly with[search_context FAILED: unknown session "<id>"]and create nothing.Pre-flight (on rebased head, acp-kernel 0.0.74)
npm run typecheckcleannpm test: 1654 pass / 0 fail / 2 skipped (ACP_TEST_E2E-gated e2e not run — needs a live upstream)npm run buildsuccessNew tests:
tests/search-context-cross-session.test.ts(schema derivation + kernel non-mutation, self-reference incl. canonical alias, unknown-id failure, resident-memory hit without disk touch, cold-load read-only proof); extendedtests/plugin-protocol.test.tsmanifest assertions (per-shapeconversation_iddescription, openai shape nested underfunction.parameters).