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
…1006 review) - re-indent the blocksCreated===0 return in applyRanges (dedented 4 spaces) - drop a stray blank line before applyRanges - restore the two-space JSDoc continuation on refNum
[bot] 🏷 Reviewed — the fix itself is sound and I verified it green in isolation, but the branch has 3 blockers that need your action before this can merge. Details below. Verified (what I ran)The branch bundles three commits, so I verified the actual PR scope by cherry-picking only
Design checks (both compression modes per AGENTS.md §6):
Blockers (need you)
Fixed directly on the branch (commit
|
…1006 review) - re-indent the blocksCreated===0 return in applyRanges (dedented 4 spaces) - drop a stray blank line before applyRanges - restore the two-space JSDoc continuation on refNum
Problem
A malformed compress call (missing/invalid content) fails schema validation and the model often gives up instead of retrying — the nudge then re-fires every turn while history keeps growing.
Fix
contentout of schema-required. Bad calls now reach the bili executor, which returns a rich error + a retry template instead of a silent schema rejection.applyRangesfailures (stream.ts) carry "Compression FAILED ... Retry NOW in this same turn" guidance.No 3-strike silencing — that would deadlock compression.
Tests
tests/compress-retry.test.ts— 8 tests green: 3 surface schemas drop required content; strip: closed-turn dropped, current-turn kept, validation marker dropped, success kept, non-compress kept, no-user unchanged. Typecheck clean.