fix(compaction): ignore blank summaries during rehydration#985
fix(compaction): ignore blank summaries during rehydration#985sahniaditya007 wants to merge 1 commit into
Conversation
|
This PR was auto-closed. Only contributors approved with Maintainers review auto-closed issues daily. Issues that do not meet the quality bar in CONTRIBUTING.md will not be reopened or receive a reply. If a maintainer replies See CONTRIBUTING.md. |
socallmebertille
left a comment
There was a problem hiding this comment.
Thanks a lot for your contribution, I would appreciate it if you can take my next comment in consideration, run npx run prettier . to pass the check and then we'll be able to merge it ! 👍
| // Regression test for issue #950: | ||
| // When compaction fails, summary: '' is persisted to the DB. | ||
| // Re-hydrating that blank summary creates { type: 'text', text: '' } in the assistant message, | ||
| // which Anthropic rejects with "text content blocks must be non-empty". |
There was a problem hiding this comment.
I think these comments are just a duplicate of the previous description so maybe you can remove them
Summary
Fixes #950.
When conversation compaction fails, an empty summary (
summary: "") is persisted. During conversation reconstruction, this empty summary is treated as a valid compaction and reconstructed into an assistant message containing an empty text block.Anthropic rejects requests containing empty text content blocks, causing the conversation to fail.
Changes
findLastCompactionPart().Result
Failed compactions are treated as absent during rehydration, preventing invalid empty text blocks from being constructed while preserving the existing compaction metadata.
Testing