From 063f6941e57475155d2a94116aee0c6972c1e225 Mon Sep 17 00:00:00 2001 From: kshitij <82637225+kshitijk4poor@users.noreply.github.com> Date: Sat, 8 Aug 2026 14:01:18 +0530 Subject: [PATCH] fix: drop redundant None-guard on agent_result in agent:end payload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit agent_result is guaranteed non-None at this point — line 17926 calls .get() on it unconditionally, and line 18099 in the same block does the same without the guard. The if/else was dead defensive code inconsistent with surrounding access patterns. --- gateway/run.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gateway/run.py b/gateway/run.py index 647a5d11f3..940a9c58b0 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -18112,8 +18112,8 @@ class GatewayRunner(GatewayAuthorizationMixin, GatewayKanbanWatchersMixin, Gatew await self.hooks.emit("agent:end", { **hook_ctx, "response": (response or "")[:500], - "model": agent_result.get("model", "") if agent_result else "", - "provider": agent_result.get("provider", "") if agent_result else "", + "model": agent_result.get("model", ""), + "provider": agent_result.get("provider", ""), }) # Check for pending process watchers (check_interval on background processes)