Skip to content

Keep compacted prompt prefixes byte-stable across passes - #553

Merged
TheGreatAxios merged 6 commits into
mainfrom
cl-6914-every-compaction-rewrites-the-prompt-head-100-kv-cache-loss
Aug 23, 2026
Merged

Keep compacted prompt prefixes byte-stable across passes#553
TheGreatAxios merged 6 commits into
mainfrom
cl-6914-every-compaction-rewrites-the-prompt-head-100-kv-cache-loss

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Compacted prompt prefixes stay byte-identical across later passes: new folds append as later summary turns with an assistant spacer, so the KV-cache head is not rewritten.
  • After a compact that remains over the high watermark, the governor waits for usage to grow by 10% of the window before re-arming. Overflow recovery still compacts immediately.

Verification

  • bun run typecheck passes
  • bun test src/agent/compaction.test.ts src/context-compactor.test.ts tests/unit/context-window.test.ts src/provider/context-window.test.ts passes

Fixes CL-6914

@TheGreatAxios TheGreatAxios added the needs-sawyer-review Touches human-gated context-management code; requires Sawyer's review before merge label Aug 23, 2026
@linear-code

linear-code Bot commented Aug 23, 2026

Copy link
Copy Markdown

CL-6914

Prefix-stable compaction still uses one extractive shape on LLM
failure, but dropping the CL-6906 marker made a lossy stub look like
a real handoff summary. Restore the marker and keep the first summary
turn byte-identical across later successful passes.
…ion-rewrites-the-prompt-head-100-kv-cache-loss
@TheGreatAxios
TheGreatAxios merged commit a4f7d86 into main Aug 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-sawyer-review Touches human-gated context-management code; requires Sawyer's review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant