Skip to content

feat(provider): detect and warn on history rewrite breaking KV cache#3

Draft
nilo85 wants to merge 1 commit into
my-fixed-prodfrom
feat/history-rewrite-detection
Draft

feat(provider): detect and warn on history rewrite breaking KV cache#3
nilo85 wants to merge 1 commit into
my-fixed-prodfrom
feat/history-rewrite-detection

Conversation

@nilo85
Copy link
Copy Markdown
Owner

@nilo85 nilo85 commented May 19, 2026

Add detection for when messages sent to the LLM differ between turns, which breaks KV cache prefix matching. Logs a warning with a formatted diff showing what changed and why.

Catches issues like empty reasoning_content being added to messages that previously had none (PR anomalyco#28352), as well as any other message mutations during transformation.

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR.

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

@nilo85 nilo85 force-pushed the feat/history-rewrite-detection branch 9 times, most recently from 2748d5f to b4ceb14 Compare May 19, 2026 21:33
Add detection for when messages sent to the LLM differ between turns,
which breaks KV cache prefix matching. Logs a warning with a formatted
diff showing what changed and why.

Catches issues like empty reasoning_content being added to messages
that previously had none (PR anomalyco#28352), as well as any other message
mutations during transformation.
@nilo85 nilo85 force-pushed the feat/history-rewrite-detection branch from b4ceb14 to 0dc861c Compare May 19, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant