The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(gateway): the handed-off-chat tests fail again when the old conversation stays on the chat
Tekniumdf5ae8022bff
diff --git a/tests/gateway/test_authority_cold_route_recovery.py b/tests/gateway/test_authority_cold_route_recovery.pyindex 32b7dae946e..924415adf17 100644--- a/tests/gateway/test_authority_cold_route_recovery.py+++ b/tests/gateway/test_authority_cold_route_recovery.py@@ -28,8 +28,14 @@ class _Runner(GatewayAuthorizationMixin):self.adapters = {}self._draining = False- def _cached_agent_for(self, route): # no turn ran in these fixtures: no route holds an agent- return None+ def _cached_agent_for(self, route):+ """A chat's route holds the agent of the conversation it names (a stand-in: no turn ran), so+ ``agent(ref) is None`` proves a conversation the chat moved past never reaches it."""+ from gateway.run import _parse_session_key+ platform = (_parse_session_key(route) or {}).get('platform')+ if platform in (None, 'local'):+ return None+ return self.__dict__.setdefault('_lane_agents', {}).setdefault(route, SimpleNamespace(route=route))def _source(platform='telegram', chat_id='4242', profile=None, chat_name=None):diff --git a/tests/gateway/test_handoff_local_receipt.py b/tests/gateway/test_handoff_local_receipt.pyindex b1e5d6a9b9f..297d17f8318 100644--- a/tests/gateway/test_handoff_local_receipt.py+++ b/tests/gateway/test_handoff_local_receipt.py@@ -499,6 +499,7 @@ async def test_a_moved_conversation_mounted_by_startup_recovery_stays_writable_ocold.authorize(owner, a, 'session:read')for capability in ('session:submit', 'session:control'):cold.authorize(owner, a, capability) # Teknium's ruling: writable, detached off the lane+ assert cold.sessions[a.session_id].detached and cold.agent(a) is None # never the lane'sfinally:runner.session_store.close_all_db_handles()@@ -529,6 +530,7 @@ async def test_a_moved_conversation_resumed_on_another_chat_moves_there(tmp_pathawait _handoff(runner, warm, a.session_id, first)await _handoff(runner, warm, chat('Chat B').session_id, first)warm.authorize(owner, a, 'session:submit') # Teknium's ruling: writable, detached off the lane+ assert warm.sessions[a.session_id].detached and warm.agent(a) is None # never chat 4242'sawait _resume_gateway(runner, warm)._handle_resume_command(MessageEvent(text='/resume --all Chat A', source=second))route = runner.session_store._generate_session_key(second)@@ -542,6 +544,7 @@ async def test_a_moved_conversation_resumed_on_another_chat_moves_there(tmp_pathwarm.register(second)for capability in ('session:submit', 'session:control'):warm.authorize(owner, a, capability) # Teknium's ruling: writable, detached off the lane+ assert warm.sessions[a.session_id].route != route and warm.agent(a) is None # never chat 77's@pytest.mark.asyncio