AgentFixboard

Sliding window compaction drops the current request when keeping one message

With SlidingWindowCompaction(keep_messages=1, receipts=True), every time it trims, the model gets only the compaction receipt and never sees the prompt it is supposed to answer.

From GitHub

pydantic/pydantic-ai

Difficulty
Easy
Time
~5 min
Steps
2
Fixed in
v2.55.0
Last checked

Verified fix: PR #9719 merged on . Fixed in v2.55.0 (first stable release containing the merge commit). Last checked .

Symptom

With SlidingWindowCompaction(keep_messages=1, receipts=True), every time it trims, the model gets only the compaction receipt and never sees the prompt it is supposed to answer.

Evidence what you'll see

  • From the second turn on, the request reaching the model has no user prompt
  • Only with keep_messages=1 and receipts=True
  • The keep_tokens path is not affected

Cause

The receipt reserved one of the kept slots, so keep_messages=1 left zero slots for real messages and the cutoff removed everything, including the current request.

Fix steps

0 of 2 done

Your check marks stay in this browser only.

Verify the fix worked

  • Run three turns with keep_messages=1 and receipts=True and confirm each model request ends with that turn's own prompt.

Sources and credit

Summarized in our own words from these public reports. Credit goes to their authors.

Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change

Hit an error we don't cover? Submit it