The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: scope stable execution identity to canonical local sources
Tekniumc3aa2e5c4424
diff --git a/gateway/run_turn_runner.py b/gateway/run_turn_runner.pyindex a4bda0c4b0a..a0f9cd9f2b7 100644--- a/gateway/run_turn_runner.py+++ b/gateway/run_turn_runner.py@@ -58,8 +58,8 @@ class TurnRunner(GatewayTurnProgressMixin, GatewaySessionAgentMixin):authority = getattr(runner, "session_authority", None)self._approval_owner = Noneif authority is not None:- owner_id = next((sid for sid, live in authority.sessions.items()- if live.route == ctx.session_key), ctx.session_id)+ source = getattr(ctx, 'source', None)+ owner_id = source.chat_id if getattr(source, 'platform', None) == Platform.LOCAL else ctx.session_idif owner_id in authority.sessions:generation = authority.db.get_session(owner_id)["runtime_generation"]self._approval_owner = (authority, owner_id, generation)diff --git a/tests/gateway/test_local_session_lineage.py b/tests/gateway/test_local_session_lineage.pyindex c7b6d32140b..f8a96b4338d 100644--- a/tests/gateway/test_local_session_lineage.py+++ b/tests/gateway/test_local_session_lineage.py@@ -119,6 +119,15 @@ async def test_local_lineage_transitions_preserve_owner_or_roll_back(tmp_path, mdb.set_meta('gateway.local_policy.v1:unrelated-fork', json.dumps(local_receipt(db, ref.session_id)))with pytest.raises(RuntimeStoreError, match='storage_unavailable'):await restarted.attach(actor, SessionRef('fixture', 'unrelated-fork'))+ # Route reuse by a native reset must not pick a departed logical owner's generation.+ from gateway.run_turn_runner import TurnRunner+ from gateway.session import SessionSource+ from gateway.session_authority import LiveSession+ restarted.sessions[reset.session_id] = LiveSession(None, live.route)+ native = SimpleNamespace(session_id=reset.session_id, session_key=live.route,+ source=SessionSource(Platform.TELEGRAM, 'native'))+ turn = TurnRunner(fourth, native)+ assert turn._approval_owner[1] == reset.session_id@pytest.mark.linux_only