fix: fail closed on malformed compaction translation - #977
Open
mkoushni wants to merge 2 commits into
Open
Conversation
Invalid or missing encrypted_content was decoded to an empty string and dropped, so Chat Completions backends received the current turn without compacted history. Require valid base64 UTF-8 and return a translation error otherwise. Signed-off-by: mkoushni <mkoushni@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Responses-to-Chat translation treated missing, non-string, invalid-base64, or non-UTF-8 compaction
encrypted_contentas an empty string and dropped the item. Translation still succeeded, so Chat Completions backends received the current turn without compacted history.append_compaction_itemnow returnsTranslationErrorfor those cases. Valid empty decoded summaries are still omitted.Related issue
Closes #936
Validation
make lintCovered by Responses-to-Chat translation unit tests, including the issue reproduction (
%%%not-base64%%%).make coverage-checkpassed at 96.06% line coverage. No new example config is required; this is fail-closed validation on an existing input item type.Checklist
Signed-off-bytrailer.Breaking changes
Malformed compaction items that previously translated successfully (with compacted history silently removed) now fail translation.