The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): webhook/msgraph/relay producer ingress goes through the runner's canonicalize seam
teknium11f9fc38ae033
diff --git a/gateway/platforms/webhook_ingress.py b/gateway/platforms/webhook_ingress.pyindex 4b96c6a03ba..e67f389dc1f 100644--- a/gateway/platforms/webhook_ingress.py+++ b/gateway/platforms/webhook_ingress.py@@ -18,12 +18,17 @@ async def producer_scope(adapter, event):if not registered or home is None:raise RuntimeStoreError('profile_mismatch')source = event.source+ # Identity is pinned through the runner's single canonicalization seam (a secondary's own+ # bot, or the primary's routed profile); a rejected primary route is refused downstream.if profile:- runner._stamp_event_profile(event, profile)- elif not source.profile and not runner._stamp_routed_profile(source):- source.profile_route_rejected = True+ runner._canonicalize(source, transport_profile=profile)+ runtime_home = runner._resolve_profile_home_for_source(source) if source.profile else home+ else:+ runtime_home = runner._admit_primary_source(source, home)+ if runtime_home is None:+ source.profile_route_rejected = True+ runtime_home = homesource._authorization_profile_home = home- runtime_home = runner._resolve_profile_home_for_source(source) if source.profile else home# The routed profile's own ledger admits the delivery; an unserved route is refused.authority = authority_for_home(runner, runtime_home)if authority is None:diff --git a/tests/gateway/test_webhook_route_toolsets.py b/tests/gateway/test_webhook_route_toolsets.pyindex 220eabb9b61..5c0578fc7b0 100644--- a/tests/gateway/test_webhook_route_toolsets.py+++ b/tests/gateway/test_webhook_route_toolsets.py@@ -171,6 +171,9 @@ class TestToolsetsBindToAuthenticatedRoute:adapter.handle_message = _captureapp = web.Application()+ # Admission is durable: the route handler acks only through a session authority.+ from tests.gateway.fixtures.webhook_route_authority import mount_authority+ mount_authority(app, adapter)app.router.add_post("/webhooks/{route_name}", adapter._handle_webhook)body = json.dumps({"text": "hi"}).encode()sig = "sha256=" + hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()