Repository navigation
fix(#2751): clarify search_context receipts — truncation, evidence window, narrowing hint - #2787
Conversation
…indow, narrowing hint
Long multi-term queries could return only generic-term blocks while the
unique-entity block was ranked below the limit, and the receipt gave no way
to tell 'cut at limit' from 'absent from history' — so the model misread a
truncated result as 'not in history' and re-investigated.
- S1: disclose candidate count + truncation ('showing N of M candidates — pass
limit:M'); scope the no-match message to active topics/summaries and stop
phrasing it as history-absence.
- S2: replace the fixed 200-char head preview with a bounded window centered
on the pool-rarest matched term (marked 【term】), so a unique match past
char 200 is surfaced instead of hidden. Budget stays 200 chars.
- S3: when a long query's distinctive term is absent from every returned block
yet present in lower-ranked candidates, add a one-line hint to narrow to it.
Host-side only (executeSearchContext); no kernel/scorer change, no new config.
Surrogate-safe slicing (#816 family). Regression suite: tests/search-context-2751.test.ts.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3071-pr.2787.2447393This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2787.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review 完成:发现 1 处漏改测试导致 CI 红,已直接代修并推回分支,重跑全绿 → 可合。 过程摘要:按 [PR] 协议未重做,拉分支核对代码 + 本地定向验证(6 个相关套件 63/63、tsc 干净)+ 审 CI。首轮 CI(run 38138922068)四个 test-matrix job 全红,失败仅一条: ① 原 issue(#2751)方向审核:回执三缺陷(静默截断、匹配词位置不可见、多词查询无收窄指引)均真实成立,属回执渲染层信息丢失。S1/S2/S3 全部打在产生缺陷的位置( ② 回归审查(触碰路径的既有行为清单,逐项):
③ 代码审查: ④ 测试有效性:新增 5 例断言全有牙——精确措辞匹配、exactly-at-limit 不出现假截断提示、200 字符外的特征词被窗口捕获且带标、crowd-out 场景同时断言 truncated+tip+目标缺席、CJK 无孤立代理。非恒真,bug 回归时抓得住。 ⑤ diff 整洁度:干净,4 文件 +188/-7,每行与本 PR 目的相关,无跑题/空白噪音。 行为变更披露(旧值→新值+原因,均有测试钉住):
结构化八问:
备注:PR 正文提到的既有 lock↔pkg 版本漂移( 判定:可合(CI 全绿、mergeable、无回归、行为变更已披露)。合并由人执行:#2787 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.348-master.5906b73 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Closes #2751
Summary
Long multi-term
search_contextqueries could return only generic-term blocks while the unique-entity block ranked below the defaultlimit, and the receipt gave the model no way to distinguish "cut at limit" from "absent from history" — leading it to conclude a researched project was never discussed and re-investigate old dirs/artifacts. This makes the search receipt honest about its own scope and truncation, and surfaces the actual match evidence instead of hiding it past char 200.Host-side only (
executeSearchContextinsrc/decompress-shared.ts). No kernel/scorer change, no new config surface, no cross-session expansion, no auto-reactivation of inactive blocks.Changes
S1 — truncation + scope disclosure.
limit: append[truncated: showing {n} of {c} candidates by relevance — pass limit:{c} to see the rest]. Previously the tail was silently dropped andFound {n}read like a total.[No blocks matched "{q}" among {activeCount} active block(s){scope}. Scope = active compressed topics/summaries only — NOT visible messages, inactive/distilled blocks, or other sessions; absence here ≠ never-discussed.]instead of the bare[No blocks matched "{q}"]which implied history-absence.[No compressed blocks exist yet…]) unchanged.S2 — evidence window instead of fixed head-preview.
safePrefix(summary, 200)head clamp with a bounded window centered on the most distinctive matched term (fewest candidate blocks containing it), marked【term】. Total budget stays 200 chars; a unique match past char 200 is now surfaced instead of hidden. Falls back to the exact old head-clamp when no query term is present in the summary body. Slicing is surrogate-safe (compactEntry summary clamp (slice(0,199)+'…') can strand a lone high surrogate → same deterministic UTF-8 gateway 500 family #816 family).S3 — narrowing hint.
[tip: none of the top {n} results contain "{term}" but {k} lower-ranked candidate(s) do — try searching "{term}" alone to surface its block directly].Behavior changes (old → new)
Found 5 block(s)…(tail silently dropped)[truncated: showing 5 of 8 … pass limit:8…][No blocks matched "q"][No blocks matched "q" among N active block(s)… Scope = … absence here ≠ never-discussed.]【term】markedThe
Found {n} block(s) for "{q}"{scope}:header line is byte-stable (existing tests'/Found \d+ block\(s\)/anchors still hold); new information is additive footer lines.buildVisibilityMarkerclassification untouched (no failure keyword introduced), so 🔍 vs ❌ rendering is unchanged.Config surface
None added. Reuses the existing
limitargument for pagination. (Per Config Surface Discipline.)Tests
tests/search-context-2751.test.ts(5 cases): over-limit truncation disclosure; exactly-at-limit (no false truncation); distinctive term surfaced past char 200 with【】mark; crowd-out (unique block ranked below the cut → truncated + hint + target absent); CJK long-连写 match surfaced with no unpaired surrogate introduced.tests/search-context.test.ts,tests/search-context-cross-session.test.ts).4387bcfb0):tsc --noEmitclean; targeted suites (search-context, -2751, -cross-session, issue1333-derived-inheritance, search-plan-aware, loop-core) 63/63 pass. Full suite delegated to CI.Notes
decompress-shared.tsvia [Bug][proxy] unframed host-side history deletion leaves zombie fold blocks rendering carriers forever — one carrier flaps in/out every turn (persistent prefix-cache churn) #2695/refactor(#2607): remove compress.stripImages — default media folding replaces it #2688/建议:compress.stripImages默认开启——否则带图消息不可压缩会形成只升不降的输入地板撑爆上下文 #2607/[Bug][decompress] 空 imageRef 抢占文本恢复路径,返回图片列表成功回执但未恢复 blockId(0.1.190) #2626 in decompress/image areas — no overlap with the search path, auto-merged clean).package-lock.jsonrecords kernel0.0.110/ pi-subagents0.1.3while the committedkernel/package.json/pi-subagents/package.jsonare0.0.111/0.1.4— a pre-existing lock↔pkg version drift that CI tolerates. Left for the owner to reconcile separately.