From 49057f267f2130a39eadb31668b469180a7d55a2 Mon Sep 17 00:00:00 2001 From: Ahmed Allam Date: Sat, 1 Aug 2026 21:25:09 +0000 Subject: [PATCH] fix(tools): halve the wait_for_message ceiling to 300s A mutual wait between two agents resolves only when both hit their cap, so the ceiling is the worst-case idle burn. Name the constants instead of repeating the literal, and align the interactive auto-resume timeout. --- strix/core/execution.py | 2 +- strix/tools/agents_graph/tools.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/strix/core/execution.py b/strix/core/execution.py index d9f8c0a9..5862adb2 100644 --- a/strix/core/execution.py +++ b/strix/core/execution.py @@ -540,7 +540,7 @@ async def _exhausted_recovery( return result -_WAITING_AUTO_RESUME_TIMEOUT_S = 600.0 +_WAITING_AUTO_RESUME_TIMEOUT_S = 300.0 async def _plain_waiting_timeout( diff --git a/strix/tools/agents_graph/tools.py b/strix/tools/agents_graph/tools.py index b5d1af9d..ec1e3912 100644 --- a/strix/tools/agents_graph/tools.py +++ b/strix/tools/agents_graph/tools.py @@ -218,11 +218,18 @@ def _session_items_payload(items: list[Any]) -> list[dict[str, Any]]: return payload -@function_tool(timeout=601) +_WAIT_DEFAULT_TIMEOUT_S = 300 +# Enforced by the SDK around the whole tool call, so it caps an oversized +# ``timeout_seconds`` the model asks for. One second of headroom lets the +# tool's own timeout fire first and return a clean result. +_WAIT_HARD_CEILING_S = _WAIT_DEFAULT_TIMEOUT_S + 1 + + +@function_tool(timeout=_WAIT_HARD_CEILING_S) async def wait_for_message( # noqa: PLR0911 ctx: RunContextWrapper, reason: str = "Waiting for messages from other agents", - timeout_seconds: int = 600, + timeout_seconds: int = _WAIT_DEFAULT_TIMEOUT_S, ) -> str: """Pause this agent until a message lands in its inbox (or timeout). @@ -255,7 +262,8 @@ async def wait_for_message( # noqa: PLR0911 reason: One-line note shown in graph snapshots while you're waiting (helps a human or sibling agent debug who's stuck on what). - timeout_seconds: Max seconds to wait (default 600). This is only + timeout_seconds: Max seconds to wait (default 300, and values above + that are cut short by a hard ceiling). This is only a cap — the tool returns the INSTANT a message arrives, so a larger value never makes you wait longer when the reply does come. Right-size it to what you're waiting on: a short wait