Skip to content

fix(orchestration): honor per-agent timeout on inter-agent tasks (#418) - #423

Merged
vybe merged 1 commit into
mainfrom
feature/418-inter-agent-timeout
Apr 20, 2026
Merged

vybe merged 1 commit into
mainfrom
feature/418-inter-agent-timeout

Conversation

@vybe

@vybe vybe commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #418.

Inter-agent task invocations (MCP chat_with_agent with parallel=true, fan_out, and scheduled fan-out calls) were being killed at ~610s regardless of the target agent's configured execution_timeout_seconds (default 900s, max 7200s). Root cause was upstream of TaskExecutionService — three layers of hardcoded 600s defaults prevented None from reaching the service's per-agent resolution (TIMEOUT-001).

The reporter's 80-minute incident (~120 failed sub-executions across 7 delegate agents on one parent schedule) is explained by the Zod .default(600) on the MCP tool schema filling in 600 before the backend could fall back to the per-agent config.

Changes

MCP server (TypeScript):

  • src/mcp-server/src/tools/chat.ts — dropped .default(600) from timeout_seconds on both chat_with_agent and fan_out tools. Descriptions updated to document the per-agent fallback.
  • src/mcp-server/src/client.ts — when caller omits timeout_seconds, client.task() and client.fanOut() now omit it from the request body (conditional spread) and use (timeout_seconds ?? 7200) + 60 as the HTTP ceiling so fetch() doesn't abort before the backend.

Backend (Python):

  • src/backend/routers/fan_out.py — FanOutRequest.timeout_seconds is now Optional[int] = None; validator short-circuits on None.
  • src/backend/services/fan_out_service.py — separates outer fan-out deadline from per-subtask timeout. Each sub-task dispatches with timeout_seconds=None so TaskExecutionService resolves per-agent config. asyncio.timeout() only wraps the gather when an outer deadline is set.

Tests & docs:

Backwards compatibility

  • Callers that pass an explicit timeout_seconds see no behavior change.
  • Older MCP clients (pre-fix) still include timeout_seconds=600 in their request body — backend honors the explicit value as before.
  • Per-agent execution_timeout_seconds configuration surface (TIMEOUT-001) unchanged.

Test Plan

  • pytest tests/test_inter_agent_timeout_unit.py -v — 7 passed in 1.14s
  • npx tsc --noEmit clean in src/mcp-server/
  • Manual verification on a long-running inter-agent task (>10 min) once deployed: agent-B's execution_timeout_seconds=1800 is now respected when agent-A invokes via chat_with_agent(parallel=true) without explicit timeout_seconds.

Generated with Claude Code

Remove hardcoded 600s default from MCP chat_with_agent and fan_out tools
so undefined flows to the backend and TaskExecutionService resolves the
target agent's configured execution_timeout_seconds (TIMEOUT-001).

FanOutService now separates the outer fan-out deadline from per-subtask
timeouts — each sub-task dispatches with timeout_seconds=None (per-agent
config), and asyncio.timeout() only wraps the gather when an outer
deadline is set. MCP client HTTP ceilings raised to the platform max
(7200s + 60s) so fetch does not abort before the backend finishes.

Adds 7 unit tests covering FanOutRequest validation and the per-subtask
None dispatch path. Syncs fan-out, mcp-orchestration, and
parallel-headless-execution feature flow docs.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: inter-agent task timeout hardcoded at 600s ignores per-agent execution_timeout_seconds

1 participant