diff --git a/tests/agent/test_compression_concurrent_fork.py b/tests/agent/test_compression_concurrent_fork.py index d9647dc9ee1..617ded2e0e0 100644 --- a/tests/agent/test_compression_concurrent_fork.py +++ b/tests/agent/test_compression_concurrent_fork.py @@ -77,6 +77,10 @@ def _build_agent_with_db(db: SessionDB, session_id: str): compressor._last_aux_model_failure_model = None compressor._last_aux_model_failure_error = None agent.context_compressor = compressor + # These tests cover the ROTATION fallback path (forking, child sessions, + # lock contention) — pin in_place=False so they keep exercising it + # regardless of the global default (which flipped to True in #38763). + agent.compression_in_place = False return agent diff --git a/tests/agent/test_compression_logging_session_context.py b/tests/agent/test_compression_logging_session_context.py index c67ffc1fde2..85cd4132074 100644 --- a/tests/agent/test_compression_logging_session_context.py +++ b/tests/agent/test_compression_logging_session_context.py @@ -50,6 +50,10 @@ def _build_agent_with_db(db: SessionDB, session_id: str): compressor._last_aux_model_failure_model = None compressor._last_aux_model_failure_error = None agent.context_compressor = compressor + # This test covers the ROTATION fallback (logging session-context follows + # the id rotation) — pin in_place=False so it keeps exercising rotation + # regardless of the global default (flipped to True in #38763). + agent.compression_in_place = False return agent diff --git a/tests/agent/test_compression_rotation_state.py b/tests/agent/test_compression_rotation_state.py index 510c485182a..83ab63e2a69 100644 --- a/tests/agent/test_compression_rotation_state.py +++ b/tests/agent/test_compression_rotation_state.py @@ -54,6 +54,9 @@ def _build_agent_with_db(db: SessionDB, session_id: str, platform: str = "telegr compressor._last_aux_model_failure_model = None compressor._last_aux_model_failure_error = None agent.context_compressor = compressor + # ROTATION fallback path — pin in_place=False so these keep covering fork + # rotation regardless of the global default (flipped to True in #38763). + agent.compression_in_place = False return agent diff --git a/tests/gateway/test_compression_concurrent_sessions.py b/tests/gateway/test_compression_concurrent_sessions.py index d6fd26deb35..529e694a8f1 100644 --- a/tests/gateway/test_compression_concurrent_sessions.py +++ b/tests/gateway/test_compression_concurrent_sessions.py @@ -71,6 +71,10 @@ def _build_agent_with_db(db: SessionDB, session_id: str): compressor._last_aux_model_failure_model = None compressor._last_aux_model_failure_error = None agent.context_compressor = compressor + # ROTATION fallback path — pin in_place=False so these keep covering the + # concurrent-rotation lock contract regardless of the global default + # (flipped to True in #38763). + agent.compression_in_place = False return agent diff --git a/tests/run_agent/test_compression_boundary_hook.py b/tests/run_agent/test_compression_boundary_hook.py index cf43a50ccf7..db9bb7f4962 100644 --- a/tests/run_agent/test_compression_boundary_hook.py +++ b/tests/run_agent/test_compression_boundary_hook.py @@ -22,7 +22,7 @@ class TestCompressionBoundaryHook: def _make_agent(self, session_db): with patch.dict(os.environ, {"OPENROUTER_API_KEY": "test-key"}): from run_agent import AIAgent - return AIAgent( + agent = AIAgent( api_key="test-key", base_url="https://openrouter.ai/api/v1", model="test/model", @@ -32,6 +32,9 @@ class TestCompressionBoundaryHook: skip_context_files=True, skip_memory=True, ) + # ROTATION fallback — pin in_place=False regardless of default (#38763). + agent.compression_in_place = False + return agent def test_on_session_start_called_with_compression_boundary(self): from hermes_state import SessionDB @@ -167,7 +170,7 @@ class TestSessionCompressEvent: def _make_agent(self, session_db, event_callback=None): with patch.dict(os.environ, {"OPENROUTER_API_KEY": "test-key"}): from run_agent import AIAgent - return AIAgent( + agent = AIAgent( api_key="test-key", base_url="https://openrouter.ai/api/v1", model="test/model", @@ -178,6 +181,9 @@ class TestSessionCompressEvent: skip_memory=True, event_callback=event_callback, ) + # ROTATION fallback — pin in_place=False regardless of default (#38763). + agent.compression_in_place = False + return agent def _stub_compressor(self): compressor = MagicMock() diff --git a/tests/run_agent/test_in_place_compaction.py b/tests/run_agent/test_in_place_compaction.py index 999eec343ab..2d19021af13 100644 --- a/tests/run_agent/test_in_place_compaction.py +++ b/tests/run_agent/test_in_place_compaction.py @@ -184,9 +184,11 @@ class TestInPlaceCompaction: assert calls["n"] == 1 -class TestRotationStillDefault: +class TestRotationFallbackWhenFlagOff: def test_rotation_when_flag_off(self): - """Regression guard: flag off => legacy rotation is unchanged.""" + """Rotation is now the OPT-OUT fallback (default flipped to in-place in + #38763). With in_place=False explicitly set, legacy rotation is + unchanged — forks a renamed continuation session.""" from hermes_state import SessionDB from agent.conversation_compression import compress_context @@ -247,10 +249,12 @@ class TestInPlaceSignalForGateway: class TestInPlaceConfigDefault: - def test_flag_defaults_off(self): + def test_flag_defaults_on(self): + """In-place is the default as of #38763 (rotation is now opt-out via + compression.in_place: false).""" from hermes_cli.config import DEFAULT_CONFIG - assert DEFAULT_CONFIG["compression"].get("in_place") is False + assert DEFAULT_CONFIG["compression"].get("in_place") is True class TestCompactedTurnsStaySearchable: