mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
fix: prevent stale lock-skip signal leaking between compress_context calls
Advisor review found a critical stale-signal leak: if auto-compress sets _compression_skipped_due_to_lock during a lock-skip, a subsequent successful manual /compress will see the stale signal, falsely report 'Compression already in progress', and discard the compression results. Fix: - compress_context clears _compression_skipped_due_to_lock = None at entry so each call's outcome alone determines the signal. - Unified gateway 'holder: unknown' drift to match CLI/TUI pattern (omit holder clause when not a descriptive string). - Added MagicMock opt-outs in 3 sibling test files broken by the new signal check (test_compress_here, test_compress_focus, test_compress_plugin_engine). - Added stale-signal-leak invariant test proving the fix.
This commit is contained in:
parent
07cb4a697e
commit
e8000b42e7
6 changed files with 74 additions and 3 deletions
|
|
@ -1283,6 +1283,12 @@ def compress_context(
|
|||
_try_acquire_lock = None
|
||||
_lock_lookup_error: Optional[Exception] = None
|
||||
_legacy_session_db_without_lock_api = False
|
||||
# Clear any stale lock-skip signal from a prior call so this call's
|
||||
# outcome alone determines what callers see. Without this an
|
||||
# auto-compress lock-skip followed by a successful manual /compress
|
||||
# would falsely report "Compression already in progress" and discard
|
||||
# the compression results.
|
||||
agent._compression_skipped_due_to_lock = None
|
||||
if _lock_db is not None:
|
||||
try:
|
||||
_legacy_session_db_without_lock_api = _lock_api_is_absent_on_session_db(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue