Repository navigation
feat(compress): reject truncated summaries; optional proportional summary floor - #520
miaomiaozii wants to merge 2 commits into
Conversation
…mary floor - rejectTruncatedSummary (default true): reject summaries ending in an ellipsis or with an unclosed ``` fence. A cut-off summary becomes the only record of the range and is silently lossy. - minSummaryRatio (default 0 = off): min summary chars per token of the range's direct messages. Consumed blocks are excluded so tier-2/3 distillation is unaffected; floor is capped at maxSummaryLength/2.
The PR was committed with two lines over the 80-col print width, so format:check was red. Rewrap only; no logic change. Verified: 7/7 summary-integrity tests pass, tsc --noEmit clean, format:check green.
PR review — #520 (reject truncated summaries; optional proportional summary floor) Duplicate screening: 不重复. This PR addresses ranxianglei/billion-context#6927 (summary validation lets truncated/undersized summaries through → silent data loss). No other open PR does this work; #520 is the acp-kernel half of ranxianglei/billion-context#6927's two-repo proposal (the billion-context-pi config-forwarding half is separate). What I verified live (on the PR head):
Findings: F1 — refold-in-place path bypasses the truncation guard (recommend closing before merge). F2 — behavior change (intended, flagged per policy). F3 — F4 — companion work in another repo (informational). ranxianglei/billion-context#6927 also proposes forwarding these fields from 8-question checklist (中文):
Verdict: Faithful, well-tested implementation of ranxianglei/billion-context#6927's kernel proposal. Formatting fixed and pushed (CI re-running). One narrow completeness gap (F1: refold path) recommended to close before merge; F2/F3 are intended design. Happy to apply the F1 fix directly if you'd like. |
Cross-thread finding from the ranxianglei/billion-context#6927 triage (not a full review — the #520 thread owns that): the refold path bypasses the new truncation check.
Repro (confirmed locally on this PR head):
That is the exact silent data loss ranxianglei/billion-context#6927 fixes, reachable through refold. Suggested fix: run the truncation check in |
🔶 需要决策 — Verified live this run (head
What I did:
Options:
Default if undecided: A — it's the author's fork, it's a two-step git + UI fix, and no design decision is involved; only the rename is missing. 8问 (CI 修复轮):
判定: 本轮无法自行收工——分支改名需要作者或 owner 侧动作(选项 A/B/C,推荐 A)。已打 |
Re-verified live this wake — no change since my previous comment:
Still waiting on A/B/C from the previous comment (recommended A: author renames the branch on their fork; B: owner grants 8问 (本轮复核): 本轮零代码改动——①问题/②原因/③影响/④修法 同上条「🔶 需要决策」评论(分支名不合规,需作者 fork 侧改名);⑤回归:无;⑥缓存:不涉及;⑦设计方向:不涉及;⑧新配置:不涉及。 |
[ework] auto-fix stalled: pr-validation — stopping for human review |
|
Superseded by #521: same commits on a correctly named branch ( |
Fixes ranxianglei/billion-context#6927.
Change
rejectTruncatedSummary(defaulttrue):detectTruncatedSummary()rejects a summary ending in…/...or with an odd number of ``` fences. The error tells the model to finish the sentence/fence and resubmit.minSummaryRatio(default0, off): min summary chars per token of the range's direct messages. Checked aftercompressedTokensis computed and before consumed blocks are added, so tier-2/3 distillation is not penalized. Floor capped atmaxSummaryLength / 2(orsummaryMaxChars / 2).Both live in
CompressValidationConfigas optional fields, so existing configs and adapters compile unchanged.Tests
tests/summary-integrity.test.ts(7 tests): detector true/false cases, default rejection, opt-out, ratio reject/pass, ceiling cap, ratio off by default.node --import tsx --test tests/summary-integrity.test.ts→ 7 passnpm test→ 1238 pass / 2 fail. The 2 failures (applyRetrieve exports large originals to a file,default builders are byte-stable against checked-in fixtures) fail identically on unmodifiedmasteron this Windows machine (verified withgit stash), so they are environment-related, not from this change.tsc --noEmitclean.