The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: retain gateway source invariants across sibling extractions
Tekniume1df5d12bdd4
diff --git a/tests/gateway/test_compression_session_id_persistence.py b/tests/gateway/test_compression_session_id_persistence.pyindex 1a5f1215cfd..18881b5e2ba 100644--- a/tests/gateway/test_compression_session_id_persistence.py+++ b/tests/gateway/test_compression_session_id_persistence.py@@ -20,15 +20,10 @@ and _save() semantics are correct without requiring a live gateway.from __future__ import annotationsimport ast-import inspectimport textwrap-from unittest.mock import MagicMock, call+from unittest.mock import MagicMockfrom gateway import run as gateway_run-from gateway import run_turn as gateway_run_turn-from gateway import run_turn_runner as gateway_run_turn_runner-from gateway import run_turn as gateway_run_turn-from gateway import run_turn_runner as gateway_run_turn_runnerfrom gateway.session_context import set_current_session_id, get_session_env@@ -112,9 +107,11 @@ def test_every_post_compression_session_id_assignment_persists():would compress correctly, the gateway would update its in-memorysession_id, then drop it on next gateway restart."""+ from pathlib import Path+assignments = []- for mod in (gateway_run, gateway_run_turn, gateway_run_turn_runner):- assignments += _session_id_assignments_followed_by_save(inspect.getsource(mod))+ for path in sorted(Path(gateway_run.__file__).parent.glob('*.py')):+ assignments += _session_id_assignments_followed_by_save(path.read_text(encoding='utf-8'))assert assignments, ("No ``session_entry.session_id = ...`` assignments found in gateway/run.py — ""either the structure changed or the AST walker is broken."diff --git a/tests/gateway/test_fallback_chain_reload.py b/tests/gateway/test_fallback_chain_reload.pyindex a94b8fff788..953c3e9458f 100644--- a/tests/gateway/test_fallback_chain_reload.py+++ b/tests/gateway/test_fallback_chain_reload.py@@ -78,7 +78,7 @@ def test_background_and_main_agent_paths_call_refresh():from pathlib import Path_gw = Path(__file__).resolve().parent.parent.parent / "gateway"- source = "\n".join(p.read_text(encoding="utf-8") for p in sorted(_gw.glob("run*.py")))+ source = "\n".join(p.read_text(encoding="utf-8") for p in sorted(_gw.glob("*.py")))# The agent-construction site inside TurnRunner.run_sync (extracted from# the old _run_agent_inner closure) references the runner as# ``self._runner``; the background-agent site still uses bare ``self``.