From a67ddf59832b0bf96978c40a2bb52dda129b2ff1 Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Sat, 27 Jun 2026 03:52:36 +0530 Subject: [PATCH] fix: drop isinstance(str) guard so client.base_url fallback works with httpx.URL The OpenAI SDK exposes client.base_url as an httpx.URL object, not str. The isinstance(live_raw, str) guard made this branch dead code in production. Use _normalized_runtime_url (which coerces via str()) so the fallback actually fires. --- tools/delegate_tool.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/delegate_tool.py b/tools/delegate_tool.py index 2e25016a4f0..9de91b671b9 100644 --- a/tools/delegate_tool.py +++ b/tools/delegate_tool.py @@ -1013,15 +1013,15 @@ def _inherit_parent_base_url(parent_agent, fallback_base_url: Optional[str]) -> client = getattr(parent_agent, "client", None) if client is not None: - live_raw = getattr(client, "base_url", "") - if isinstance(live_raw, str): - live_url = _normalized_runtime_url(live_raw) - if ( - live_url - and live_url != surface_url - and live_url.startswith(("http://", "https://")) - ): - return live_url + # OpenAI SDK exposes ``base_url`` as an ``httpx.URL``, not ``str`` — + # coerce so the comparison works regardless of the client's type. + live_url = _normalized_runtime_url(getattr(client, "base_url", "")) + if ( + live_url + and live_url != surface_url + and live_url.startswith(("http://", "https://")) + ): + return live_url return fallback_base_url or None