The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: steer API runs through the current authority claim
Tekniuma69efa90ffe3
diff --git a/gateway/platforms/api_server_runs.py b/gateway/platforms/api_server_runs.pyindex 56e3ad0442d..3499788e917 100644--- a/gateway/platforms/api_server_runs.py+++ b/gateway/platforms/api_server_runs.py@@ -787,6 +787,19 @@ async def _handle_steer_run(self, request: "web.Request", *, _api_server) -> "weself, request, _api_server=_api_server, permission=None, active_fallback=False)if err is not None:return err+ if getattr(self.gateway_runner, 'session_authority', None) is not None:+ from gateway.platforms.api_server_authority_runs import run_admission+ from hermes_state_runtime import RuntimeStoreError+ owned = run_admission(self, run_id)+ agent = None+ if owned is not None and run_id not in self._stopping_run_ids:+ authority, row = owned+ try:+ authority.check_approval_generation(row['target_session_id'], row['generation'])+ from gateway.session_contract import SessionRef+ agent = authority.agent(SessionRef(authority.profile_id, row['target_session_id']))+ except RuntimeStoreError:+ pass# /stop keeps agent refs during cooperative shutdown, so the status gate (not the# agent ref) is what rejects stop-then-steer.if status.get("status") != "running" or not hasattr(agent, "steer"):diff --git a/tests/gateway/fixtures/api_authority_peer.py b/tests/gateway/fixtures/api_authority_peer.pyindex 3f42b9bfbf4..7097ff290e8 100644--- a/tests/gateway/fixtures/api_authority_peer.py+++ b/tests/gateway/fixtures/api_authority_peer.py@@ -99,6 +99,10 @@ async def probe(peer):return (await response.json())['run_id']blocking = await create_run('BLOCK_FIFO')assert await asyncio.to_thread(peer.blocked.wait, 10)+ async with client.post(f'http://127.0.0.1:{api_port}/v1/runs/{blocking}/steer',+ json={'input': 'SAFE_STEER'}, headers=headers) as response:+ steered = await response.json()+ assert response.status == 200 and steered['accepted'], steeredqueued = await create_run('CANCEL_ONLY_QUEUED')async with client.post(f'http://127.0.0.1:{api_port}/v1/runs/{queued}/stop', headers=headers) as response:stopped = await response.json()