fix: harden context compression against silent failures#5457
Closed
luinbytes wants to merge 1 commit into
Closed
Conversation
2247930 to
60eefd7
Compare
Author
|
bump — rebased onto latest upstream, all conflicts resolved. @teknium1 |
- Add post-compaction empty recovery: when the model returns empty right after compression, inject a continuation prompt and retry instead of breaking with (empty) and killing the conversation - Add fallback summary model: if the primary summary model fails (bad config, API error, timeout), try openrouter/qwen as fallback before dropping all middle turns without a summary - Upgrade summary-failure logging to ERROR level with model name and error details so config mistakes are immediately visible - Remove dead code: _classify_empty_content_response() was defined but never called; also removed now-unused is_local_endpoint import
60eefd7 to
5a819da
Compare
9 tasks
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
When context compression fires, the model sometimes returns empty on the next turn. Hermes sends
(empty)to the user and the conversation dies. Two fixes:Post-compaction empty recovery — sets a
_just_compactedflag after compression. If the very next model response is empty, injects a continuation prompt and retries instead of sending(empty).Retry via provider routing — if the primary summary model fails (bad config, API error, timeout), retries the same
call_llm(task="compression", ...)call without the explicit model override.call_llmalready has its own provider fallback chain, so this goes through the normal routing pipeline instead of hardcoding a specific provider/model in core code.Also upgrades summary-failure logging from
warningtoERRORwith model name and error details, so misconfigured summary models are visible in logs immediately.What happens today without this
summary_modelpointing at a broken or unreachable endpoint(empty)sent to them, conversation is effectively deadTest plan
py_compilepasses on both files