fix(compact): validate compact_threshold is at least 1000 (#838) - #889
Queued
Artemon-line wants to merge 3 commits into
Queued
Conversation
Artemon-line
force-pushed
the
838-compaction-accepts-compact_threshold-values-below-the-openai-minimum
branch
from
September 2, 2026 12:54
eaadc66 to
61f001e
Compare
…xy#838) Validate that in compaction entries is an integer of at least 1000 tokens. Invalid or missing threshold values now return a 400 response instead of silently skipping or executing compaction. Fixes praxis-proxy#838 Signed-off-by: Artemy <ahladenk@redhat.com>
Artemon-line
force-pushed
the
838-compaction-accepts-compact_threshold-values-below-the-openai-minimum
branch
from
September 2, 2026 14:58
61f001e to
dc2e02c
Compare
Artemon-line
marked this pull request as ready for review
September 2, 2026 15:41
praxis-bot
reviewed
Sep 2, 2026
praxis-bot
left a comment
Collaborator
There was a problem hiding this comment.
PR Review
Summary: Validates compact_threshold as at least 1000, converting extract_compaction_config and should_compact to return Result so invalid values produce invalid_request_error instead of being silently skipped. Clean refactor with good test coverage for threshold edge cases.
Overall: The validation logic, error messaging, and integration test are solid. One new validation path lacks test coverage.
| Severity | Count |
|---|---|
| Critical | 0 |
| Large | 0 |
| Medium | 1 |
…ues-below-the-openai-minimum
…_config Signed-off-by: Artemy <ahladenk@redhat.com>
leseb
enabled auto-merge
September 3, 2026 12:18
leseb
approved these changes
Sep 3, 2026
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
Validate
compact_thresholdas at least 1000 when parsing the compaction entry incontext_management. Invalid or missing proxy-consumed values produce aninvalid_request_errorrather than silently skipping or executing compaction.Related issue
Closes #838
Validation
cargo test -p praxis-ai-apis -- compact)cargo test -p praxis-tests-integration -- compact)make lintVerification Proof
To test the rejection for an invalid threshold (< 1000), send a value below 1000 (e.g. 50):
The proxy will intercept it and return HTTP 400 Bad Request directly:
Checklist
Signed-off-bytrailer.Breaking changes
None.