Repository navigation
Conversation
…a frozen watermark Three root causes behind "session hangs / context keeps growing after a restart or model switch": 1. A plain prompt_cache_key is not plugin ownership. Only a real omp registration or a persisted pluginAgent may unwrap the |sub: namespace; otherwise instructions drift (model switch, async tool registration) forked the main conversation into an empty namespace whose compression state was gone, so every existing block was invalidated. 2. Existing conversation mappings now restore their original session and compression blocks instead of minting a fresh bare-id session. 3. A failed preflight freezes the original history BOUNDARY rather than the range worklist it happened to select: every successful fold changes which ranges stay viable, so replaying a stale worklist compressed nothing and the retry looked bigger. The walk now recomputes remaining viable ranges against that boundary after each fold, including the soft-protected recent zone under overflow, while turns appended during the failure window stay out of the compression input. # Conflicts: # CHANGELOG.md # src/plugin.ts # src/preflight.ts # src/server.ts
…eline wedges preflight The preflight trigger floors on session.stats.lastInputTokens. After an as-is forward under preflight (ranxianglei#300) the measured baseline can stay pinned above the window while the prepared payload itself fits (~127k against a 256000 window on a live session). Every turn then re-ran the fold walk on ranges the payload no longer needed: three 60s summarization attempts, structured 502 on upstream 500, dead-end cooldown, repeat. Forward as-is when a known-baseline session's payload estimate fits and its measured baseline sits above the window (ranxianglei#301: as-is is safe; the next usage report self-heals the baseline). Inside-window folding is untouched — the codex headroom target still walks fitting 90-100% payloads. # Conflicts: # CHANGELOG.md
Hosts (claude-code/openai/codex) pre-validate tool arguments against the served schema and reject a missing 'content' CLIENT-side, so the model only ever sees a bare 'content: is required' — observed in production, it gives up instead of retrying, leaving the nudge pending forever. - compress-tool: 'content' no longer schema-required on any served surface; description documents that validation happens at execution and how to recover a rejected call. - stream: malformed calls now reach the executor and get the actionable [Compression FAILED ...] receipt they can fix in the same loop. - server: failed compress call+result pairs are dropped from CLOSED turns before forwarding; current-turn pairs stay for in-place retry, successful compresses are never matched (plugin-mode block carriers). Tests: tests/compress-retry.test.ts; ranxianglei#349 and ranxianglei#841 pin the schema deltas. # Conflicts: # CHANGELOG.md # src/compress-tool.ts # tests/search-context-cross-session.test.ts
After a fold the model keeps anchoring on refs an earlier block already consumed (01a0b0c4, 2026-09-18: three consecutive [Compression FAILED] receipts, two full T1 checkpoints wasted, then it gave up and let the nudge re-fire every turn). The kernel errors say 'run acp_status and retry', but recovery needs two more round-trips a mid-task model won't take. Both failure receipts now append the concrete span that is still raw and directly compressible, computed as the highest mapped raw ref minus the newest active-block boundary; when no raw refs remain it suggests compressing a run of ACTIVE blocks. # Conflicts: # CHANGELOG.md
[bot] 🏷 Reviewed PR #1008 (head Local verification on head
Code review (the PR's own commit
Blockers before merge
Duplicate screening: no duplicate issue/PR found (closest relatives: #743 retryability = PR #1006, #389 stale acp_status ranges, #849 compress-failure loops — this PR complements them; the commit's 01a0b0c4 incident citation makes the root cause plausible: the model re-anchors on refs an earlier fold consumed, and the bare "run acp_status" cost an unrecoverable round trip mid-task). Verdict: the change itself is correct, minimal, and fully green under local verification — mergeable once the branch is rebased onto master (AGENTS.md union) and the sibling PRs land first. The two test/wiring gaps are optional polish. 中文摘要:修复了 compress 失败回执只让模型"去跑 acp_status"导致多烧一轮的问题(回执直接给出当前可压缩的 live ref 区间),代码正确、本地全量验证通过;当前分支与 master 冲突(仅 AGENTS.md,按并集解)且叠在 #1003/#1004/#1006 之上,rebase 并按序合并后即可合并。 |
|
PR 队列扫描更新(issue #1020): 已关闭的堆叠兄弟 PR:#1003 / #1004 / #1006 已判定为被本 PR 完整包含(eeaf10c → 87f64f7 → 0a807da 链都在 #1008 的历史里),作为重复项关闭,合并以本 PR 为准。 两件事需要作者处理:
本地已验证该代码在当前 master 上语义不变,rebase + cherry-pick 后即可进入合并队列。 |
[bot] 🏷 Both requested items are done and verified — I built the exact final state locally and pushed it as a ready-to-retarget branch, since I have no push access to @asuan-dev's fork (verified with a real push attempt, rejected). Verification of your claims
What I did
Result: branch To land it, pick one:
中文摘要:已按最新 master(5f7c00b)完成整条栈的 rebase 并 cherry-pick |
|
解决冲突 并简述本pr动机 如何修改的 |
[bot] 🏷 本 PR 动机 #1008 本身解决:compress 失败时(已压缩过 / anchor 悬空 / 无有效区间),回执只说"去跑 acp_status"——模型要多烧一轮往返(或直接放弃)才能找到当前可压缩的范围。修复方式:失败回执里直接点名当前活着的可压缩 span。 因 #1003/#1004/#1006 已判定被本 PR 完整包含而关闭,合并本 PR 实际带入一条 5 提交栈(按序):
如何修改的(核心提交
冲突如何解决(rebase 至 master
验证状态:head |
|
冲突 ewrok结局 |
[bot] 🏷 冲突结局:4 个文件,全部按"意图并集"解决——两边语义都保留,没有丢弃任何一方。最终状态(head 1. AGENTS.md( 2. src/preflight.ts( let startRef = maps.idxToRef.get(cs);
let endRef = maps.idxToRef.get(ce);
if (!startRef || !endRef) continue;
// #1001: after a client history rewrite, ref numbers are not monotonic ...
if (refNum(startRef) > refNum(endRef)) {
deps.log("warn", `[preflight] normalized reversed range ${startRef}–${endRef} → ...`);
[startRef, endRef] = [endRef, startRef];
}两者不互斥:提升后的 3. src/server.ts( processedMessages = stripReasoning(stripFailedCompressCalls(stripKernelSummaries(turn.messages, turn.state)));
// #1001: a silent client history rewrite takes the same archive+prune path ...
{
const rewrite = detectUnannouncedHistoryRewrite(session, knownRefsBefore, msgs.map((m) => m.id));
if (rewrite.detected) { log("warn", ...); markCompactionBoundary(session); }
}
applyCompactionArchive(session, activeBefore, new Set(msgs.map((m) => m.id)), log);顺序正确:先净化消息(stripFailedCompressCalls),再做重写检测与归档。第三条 wire 路径(Responses)自动合并于 4. src/stream.ts( return `[Compression FAILED: ${errs}${compressibleSpanHint(ctx.session.state)}]`;cherry-pick 的格式提交( 结局一句话:每个冲突点都是"master 的新机制 + 本栈的旧修复"叠加而非二选一;head |
|
Thanks @asuan-dev — the span-hint idea here is exactly right (it fixes the 2026-09-18 failure loop where the model kept re-issuing refs an earlier fold had consumed, burned three retries and two T1 checkpoints, then gave up). Closing this in favor of a slimmed maintainer port: #1036 keeps only the head commit (e4a4700 —
|
Port of PR #1008's head commit, slimmed to just the span hint: both failure receipts (no-valid-ranges and blocksCreated===0) append compressibleSpanHint() — the raw-ref span not covered by an ACTIVE block — so one retry lands on a valid range instead of re-issuing refs an earlier fold consumed. Boundary counts active blocks only (decompress releases it); exhausted fallback names real active block ids for a higher-tier b-range fold (kernel-first-class). Co-authored-by: asuan-dev <asuan_10907@163.com>
Problem
When compress fails (already compressed / dangling anchors / no valid ranges), the rich error only said "go run acp_status" — the model had to burn a round trip (or give up) to find the currently compressible span.
Fix
compressibleSpanHint(state)(src/stream.ts, exported): highest live m-ref minus active-block endRef boundary →"Live compressible refs: mXXXXX–mYYYYY ... Retry NOW"; falls back to naming the ACTIVE block refs (b12..b15) when nothing newer exists. Wired into bothapplyRangesfailure branches (plugin + proxy paths share applyRanges).Tests
tests/compress-retry.test.tsgains "failed compress receipts carry the live compressible span" (state fake: byRef refs + active blocks) — 9/9 pass. stream*/compress*/loop* suites 169/169. Typecheck clean.