fix: feature-detect context focus compression support - #16450
Conversation
29df49c to
36e8966
Compare
|
Context for reviewers: this is one of the small follow-up slices from the closed broad host-support PR #13370. Teknium salvaged the compression-boundary signal into #16306, and the remaining host-side pieces from #13370 are being resubmitted as narrow, independent PRs instead of reviving the original large PR. This slice is intentionally limited to its described scope; it does not vendor or bundle any external context-engine implementation. |
7f160fb to
ffc83f2
Compare
ffc83f2 to
e49ede9
Compare
e49ede9 to
d26eb87
Compare
d26eb87 to
0e746f2
Compare
|
@teknium1 refreshed this against current main. This is still relevant: the compression path moved from The refresh now feature-detects optional compression kwargs before calling the engine:
Validation on refreshed head
|
|
Thanks for narrowing this to the compression-call boundary. The premise remains present on current main: The proposed signature-based call construction in Automated hermes-sweeper review. |
GottZ
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Summary
Three PRs cover distinct context-compression failure modes: #9050 injects automatic mid-task resumption, #16450 feature-detects optional compressor arguments instead of masking internal TypeErrors, and #21161 exposes compression activity in gateway busy acknowledgements. Only #16450 directly fixes the target call-boundary compatibility bug without conflicting with the repository’s current stale-task policy or touching the separate gateway-status concern.
Related pull requests
- #9050 [closed]
related— (+97/-13) — remain closed: The diff rewrites the summary prefix and injects a synthetic resume message after a tool result, but this conflicts with the contributor-documented design that historical work must not resume unless the latest real user message requests it. It remains relevant as the rejected automatic-resume alternative and must not be reopened over that blocking design decision. - #16450
related— (+188/-43) — merge: The diff replaces the broad TypeError retry with signature-based optional-argument selection, preserving legacy compressor compatibility while allowing engine-internal TypeErrors to propagate; tests cover legacy, focus-only, **kwargs, failure, and lock-cleanup paths. This agrees with the keep_open review on #16450, which confirmed the bug on current main and found no second production call path. - #21161
related— (+120/-2) — keep open pending rebase: The gateway diff removes misleading iteration 0/N output and adds useful compression activity details, addressing a separate observability defect. Consistent with the keep_open review on #21161, its activity lifecycle must first be moved from the now-obsolete run_agent.py body into agent/conversation_compression.py with cleanup covering every return and exception path.
Suggested consolidation
Merge #16450 because it is the current-path, narrowly scoped fix for compressor capability detection and TypeError masking. Keep #9050 closed due to the explicit contributor-backed design conflict, and retain #21161 as an independent rebase/port candidate rather than treating it as a duplicate; no PRs in this set should be closed as duplicates.
Cross-PR triage: Reviewed 3 pull requests and 0 issues in this complex. Each diff was read against this issue; Assessment working set: 29 kB of PR diffs, 9 kB of issue/PR text, 6 kB of discussion (6 comments), 0 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.
What does this PR do?
Keeps manual
/compress <focus>and forced manual compression compatible with external context engines that were written against oldercompress(...)signatures, without masking real internalTypeErrorbugs from those engines.Current
mainmoved the compression call site fromrun_agent.pyintoagent/conversation_compression.py, but the bug class still existed there: Hermes caught anyTypeErrorfromcontext_compressor.compress(...)and retried without optional kwargs. That fallback preserved old plugins, but it could also hide a genuine engine bug as if the engine merely lackedfocus_topic/forcesupport.This refresh feature-detects optional kwargs before calling the engine instead:
current_tokensfocus_topickeep the/compress <focus>hintforcereceive the manual retry flag**kwargsreceive both optional kwargsTypeErrors now propagate instead of being treated as signature mismatchRelated Issue
Follow-up slice from the closed broad host-support PR #13370. Related context: #16306 salvaged and merged the compression-boundary signal from that same broader lane.
Type of Change
Changes Made
agent/conversation_compression.py: add signature-based optional kwarg detection forcontext_compressor.compress(...)before invoking the engine.tests/run_agent/test_compress_focus_plugin_fallback.py: cover legacy engines,**kwargsengines, focus-only engines, and propagation of internalTypeErrors.tests/agent/test_compression_concurrent_fork.py: update the lock-refresher exception regression now that broadTypeErrorretry fallback is intentionally removed.How to Test
./scripts/run_tests.sh tests/run_agent/test_compress_focus_plugin_fallback.py tests/run_agent/test_413_compression.py tests/agent/test_compression_concurrent_fork.py tests/agent/test_compress_focus.py tests/agent/test_compression_rotation_state.py -q --tb=shortpython3 -m compileall -q agent/conversation_compression.py tests/run_agent/test_compress_focus_plugin_fallback.py tests/agent/test_compression_concurrent_fork.pygit diff --checkruff check agent/conversation_compression.py tests/run_agent/test_compress_focus_plugin_fallback.py tests/agent/test_compression_concurrent_fork.pyValidation
Local validation on refreshed head
0e746f2c43359774a147e4cebd8a9a7b7d653d1e:python3 -m compileall -q agent/conversation_compression.py tests/run_agent/test_compress_focus_plugin_fallback.py tests/agent/test_compression_concurrent_fork.py— passedgit diff --check— passedruff check agent/conversation_compression.py tests/run_agent/test_compress_focus_plugin_fallback.py tests/agent/test_compression_concurrent_fork.py— passed./scripts/run_tests.sh tests/run_agent/test_compress_focus_plugin_fallback.py tests/run_agent/test_413_compression.py tests/agent/test_compression_concurrent_fork.py tests/agent/test_compress_focus.py tests/agent/test_compression_rotation_state.py -q --tb=short—52 passedChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — N/Acli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AFor New Skills
N/A
Screenshots / Logs
Focused local validation logs are summarized above. No UI screenshots; this is a host-side runtime compatibility fix.