fix: agent tools follow Settings Queue timeout
The hidden 600s agent_tool_timeout_sec never appeared in Settings, so tool calls still died after Queue timeout was set to wait forever.
This commit is contained in:
@@ -308,9 +308,9 @@ def register(registry: ToolRegistry) -> None:
|
||||
executor=t_wait_for_jobs,
|
||||
category="video",
|
||||
requires_project=False,
|
||||
# Owns its own wait contract (timeout_sec → queue_poll_timeout_sec):
|
||||
# exempt from the per-tool wall-clock cap, which would otherwise
|
||||
# cut a legitimate long render wait short.
|
||||
# Owns its own wait (timeout_sec → queue_poll_timeout_sec, 0 = until
|
||||
# done): exempt from the same Queue timeout wrapping every other
|
||||
# tool, so a long render wait is not cut short by a second clock.
|
||||
long_running=True,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -48,9 +48,13 @@ EXPORT_VIDEO_DENIED_NAMES = frozenset({"export_video", "exportVideo"})
|
||||
|
||||
|
||||
def _tool_timeout_sec() -> float:
|
||||
"""Per-tool wall-clock cap from Settings; 0 = disabled."""
|
||||
"""Wall-clock cap for one agent tool call: Settings → Queue → Timeout.
|
||||
|
||||
Same value as the ComfyUI job poll (``queue_poll_timeout_sec``). 0 waits
|
||||
until the tool finishes.
|
||||
"""
|
||||
try:
|
||||
t = float(settings.agent_tool_timeout_sec)
|
||||
t = float(settings.queue_poll_timeout_sec)
|
||||
except (TypeError, ValueError, AttributeError):
|
||||
return 0.0
|
||||
return max(0.0, t)
|
||||
@@ -91,8 +95,9 @@ class ToolDefinition:
|
||||
category: str = "general"
|
||||
destructive: bool = False # flagged in descriptions; pre-execute guard uses it
|
||||
requires_approval: bool = False # HITL: blocked unless the user explicitly asked
|
||||
# True → exempt from the per-tool wall-clock timeout (agent_tool_timeout_sec);
|
||||
# the tool owns its own wait contract (e.g. wait_for_jobs → queue_poll_timeout_sec).
|
||||
# True → exempt from the Queue timeout wall clock;
|
||||
# the tool owns its own wait contract (e.g. wait_for_jobs uses the same
|
||||
# queue_poll_timeout_sec, including 0 = wait until done).
|
||||
long_running: bool = False
|
||||
|
||||
|
||||
@@ -281,8 +286,8 @@ class ToolRegistry:
|
||||
try:
|
||||
result = await self._execute_with_timeout(t, ctx, args)
|
||||
except TimeoutError:
|
||||
# Per-tool wall-clock cap (0 = disabled): a hung tool must stall
|
||||
# its step, not the session. CancelledError passes through so the
|
||||
# Per-tool wall clock is Settings → Queue → Timeout. 0 waits
|
||||
# until the tool finishes. CancelledError passes through so the
|
||||
# Stop button keeps working.
|
||||
return {
|
||||
"ok": False,
|
||||
|
||||
Reference in New Issue
Block a user