Repository navigation
feat(#2302): digestion batching guard — defer small folds on huge raw history - #2332
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2525-pr.2332.e87f9d9This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2332.tgz
npm install -g packageInstall instructions are refreshed on each push. |
|
CI caught a real design bug in the first push: preflight overflow-compress also rides 03ea69f gates the guard to model-initiated calls only ( |
… guard Review drive-by (#2332): the PR body lists "block-ref (bN..bM) T2-style consolidation calls" as a stated skip, but no test pinned it — without the BLOCK_REF_RE guard, refNum("bN") feeds the span arithmetic and a T2 consolidation call on a huge raw session would be mis-deferred like any small m-ref fold. New case asserts the guard stays silent and consumes no deferral budget on bN endpoints.
[bot] 🏷 Review 结论(#2332,head ① 是什么问题 ② 什么原因导致的 ③ 怎么修复的 ④ 是否有回归问题
⑤ 是否破坏缓存 ⑥ 是否改了设计方向 ⑦ 是否引入了新的配置
审查动作记录
|
b624e5f to
7fdfea3
Compare
… guard Review drive-by (#2332): the PR body lists "block-ref (bN..bM) T2-style consolidation calls" as a stated skip, but no test pinned it — without the BLOCK_REF_RE guard, refNum("bN") feeds the span arithmetic and a T2 consolidation call on a huge raw session would be mis-deferred like any small m-ref fold. New case asserts the guard stays silent and consumes no deferral budget on bN endpoints.
[bot] 🏷 上游冲突已解决并推送(
判定:分支干净可合,等 CI 全绿即可由人工合并。 |
|
a639956 switches the payload to the compress tool's preferred line form (owner review): content is ONE string that may carry every range — one block per range, first line A test round-trips the skeleton headers through the real |
|
Owner call: the digest-batch deferral guard is removed (05aa57c rewrote the branch — guard commits dropped, knobs/seed/tests gone with it). Deferring a fold the model needs to make risks context growth and quality loss from re-reading unfolded history — the wrong trade for a cost optimization. What remains is the single-layer root fix: the recommendation ships as a line-form one-call payload (refs headers pre-serialized in the compress tool's preferred single-string shape, summaries left to the model), appended at every surface the model reads — nudge injection (4 wire lanes), post-compress receipt tail, acp_status. #1198 conditional framing and delete-don't-split licensing intact; tier-2/3 and sub-floor ranges skip. |
626abca to
1907c38
Compare
收到 owner 决定:defer 守卫整体移除,只保留 one-call payload。已按重写后的 head 范围核对:重写把守卫相关全部拿掉了 —— 七问:
本地验证(head 建议一条:PR 标题/正文仍描述已移除的守卫("digestion batching guard — defer small folds"),合并前建议更新,避免合并历史带误导性描述。 结论:剩余范围干净、验证充分,等 CI 全绿;若 CI 守住即可合。 |
CI 已全绿: 最终状态:分支干净(线性 3 commit,基于 master tip)、mergeable=True、本地定向验证与 CI 双重绿。唯一遗留建议仍是 PR 标题/正文更新(现描述的是已移除的 defer 守卫)。可以合并。 |
The model was HANDED the wrong shape: the nudge lists 10 recommended ranges
and hints 'fold in ONE call' — the model digests the list in groups, one
compress call per group (the live 44s burst: five single-range calls re-billed
1.38M tokens; one 9-range call on the same log paid once). Instructions about
batching do not survive contact with the model; the arguments themselves now
do.
src/one-call-payload.ts (bili-side, kernel untouched):
- oneCallPayload(ranges) serializes every recommended range into the exact
single-call compress args — { "content": [ { startId, endId, summary: … } ] } —
copy, fill summaries, send once. >16 ranges fold into a same-call note.
- withOneCallPayload(text, nudge, config) appends it at every surface the
model reads: the injected nudge in all four wire lanes (server.ts ×4),
the post-compress receipt tail (stream.ts postCompressTail), and
acp_status (acp-status.ts).
- #1198-safe framing: conditional 'if you compress', 'DELETE any entry you
still need … never split it into several calls'. Skips tier-2/3 nudges
(block-ref single-shot calls), single remaining ranges, and sub-floor
entries the submit gate would reject (#847).
Tests: tests/one-call-payload.test.ts (4) + digest-batch guard stays as the
backstop; neighbors green (acp-status/ccr-v2/loop-core/digest-batch 67,
tag-echo/compress suites 81, nudge suites 19); typecheck 0.
…ne form
Owner review: the JSON content-array skeleton was the wrong shape twice —
(1) it prescribed packaging the model should decide for itself, and
(2) the tool's preferred form is the LINE FORM: content is ONE string that
may carry every range, one block per range ('mNNNNN–mNNNNN optional topic'
header, summary body below, no JSON, no escaping).
oneCallPayload now emits a line-form skeleton: refs headers authoritative
(ours, round-trip through the real parser — pinned by a test), summary
bodies entirely the model's ('<write your summary of this range>'). The
framing stays #1198-safe: 'If you compress… send every block below in a
single call; DELETE the blocks you still need — never split'. No JSON
shells anywhere.
Overflow beyond 16 ranges collapses into a '+N more range(s) — continue the
SAME string' note instead of separate blocks.
kernel-change: the one-call skeleton belongs with the nudge that recommends the ranges — renderNudgeText now appends it itself (gentle AND emergency), so every host of acp-kernel gets the fix and the bili-side module plus its six wiring points disappear. - kernel/src/nudge-text.ts: oneCallPayload (line-form skeleton) + oneCallTail (framing + skeleton; conditional framing for gentle #1198, unconditional 'When you compress' for emergency; empty below two ranges). renderNudgeText appends the tail for tier-1 nudges; T2/T3 block-ref nudges never see it. - kernel 0.0.105 → 0.0.106. - bili: src/one-call-payload.ts deleted; the four wire lanes render the kernel text verbatim again; postCompressTail + acp_status call the kernel export directly. - tests: kernel nudge-text pins (gentle/emergency/T2/under-two) + bili-side round-trip through the real compress parser.
…tch form kernel-change: all surfaces now teach ONE shape — a single-string batch (one block per range, 'mNNNNN–mNNNNN topic' header + summary). The mixed signals (single-entry JSON examples in the emergency nudge and the TOOLS list, a JSON-array alternative in the gentle tip) are what the model was actually following when it split batches. - compress-tools TOOLS entry: leads with the ONE-string batch example; single range is the same shape with one block; object entries demoted to 'also accepted' - COMPRESS_TOOL description + content param description: PREFERRED form first (single string holding ALL ranges), alternatives after - emergency nudge: single-entry JSON example line removed — the appended skeleton IS the example - gentle tip: points at the skeleton, no more JSON-array alternative - oneCallTail shortened to one imperative line (the tool description and the tip carry the semantics; the tail just frames the skeleton) - fixtures regenerated (TOOLS section bytes) kernel 1260/1260; bili typecheck 0; payload suite 4/4.
5ee621d to
bd5f34e
Compare
冲突唤醒处理完毕。这轮 master 前进了(#2352 zed-launcher 及 #2345/#2318 一串),且你在我工作期间自己把 master 合进了分支( 顺带按 Kernel Boundary 审了本轮新增的内核迁移面(8857ffe 起):
七问:
双层验证(Kernel Boundary 规则 5):kernel 套件 1262/1262、bili typecheck 0、unused-exports gate 0(新增导出 结论:分支干净、双绿,等 CI 全绿即可合。 |
|
Review(独立,本地实跑 head ① 方案(#2302 根因=递指令不生效→递参数):one-call skeleton 收进 kernel ② 发现的问题(已修):kernel 迁移 commit 改写了 ③ 修复: ④ 遗留(不阻塞,owner 自便):①PR 标题/正文还在描述已移除的 defer 守卫(上一轮已提);②server.ts 四通道的 ⑤ 结论:kernel 改动=human-only 档, |
你的 golden 漂移发现与修复我核实了——同时必须认领我自己的错误。 我的错在哪:上一轮我说「host 侧 wire-contract golden 门本地通过」,实际跑的是 对
七问:
CI( 结论:修复成立、双绿待 CI;CI 守住即可合。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.119-master.2495ad2 # this exact build
npm install -g billion-context@master # always the newest merged build
|
kernel-change: the one-call skeleton lives with the nudge that recommends the ranges — renderNudgeText appends it itself, bili-side module and six wiring points removed.
What
#2302 root fix, single layer, inside the kernel:
The nudge used to hand the model a LIST of recommended ranges plus a batching hint — and the model digests the list in groups, one compress call per group. Each separate call resets the provider prefix cache from its fold point and re-bills the whole remaining history; one call carrying every range pays once (live incident: five single-range calls over 44s on a 555K-token session re-billed 1.38M tokens; one 9-range call on the same log paid once). Instructions about batching do not survive contact with the model — the arguments themselves now do.
$2302 history: the digest-batch deferral guard was removed at owner call (deferring a fold risks context growth and quality loss from re-reading unfolded history — wrong trade for a cost optimization).
Shape
by a test); summary bodies entirely the model's; packaging NOT prescribed
beyond one call / one string (line form = the compress tool's preferred
shape; no JSON shells, no escaping)
directive ('When you compress'); T2/T3 block-ref nudges never see it;
empty below two viable ranges
post-compress receipt tail, acp_status
Commits
Verification
emergency unconditional, T2 exempt, under-two empty)
tag-echo/issue2146/issue847 suites 97/97