Repository navigation
fix(orchestration): honor per-agent timeout on inter-agent tasks (#418) - #423
Merged
Merged
Conversation
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]>
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #418.
Inter-agent task invocations (MCP
chat_with_agentwithparallel=true,fan_out, and scheduled fan-out calls) were being killed at ~610s regardless of the target agent's configuredexecution_timeout_seconds(default 900s, max 7200s). Root cause was upstream ofTaskExecutionService— three layers of hardcoded 600s defaults preventedNonefrom 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)fromtimeout_secondson bothchat_with_agentandfan_outtools. Descriptions updated to document the per-agent fallback.src/mcp-server/src/client.ts— when caller omitstimeout_seconds,client.task()andclient.fanOut()now omit it from the request body (conditional spread) and use(timeout_seconds ?? 7200) + 60as the HTTP ceiling sofetch()doesn't abort before the backend.Backend (Python):
src/backend/routers/fan_out.py—FanOutRequest.timeout_secondsis nowOptional[int] = None; validator short-circuits onNone.src/backend/services/fan_out_service.py— separates outer fan-out deadline from per-subtask timeout. Each sub-task dispatches withtimeout_seconds=NonesoTaskExecutionServiceresolves per-agent config.asyncio.timeout()only wraps the gather when an outer deadline is set.Tests & docs:
tests/test_inter_agent_timeout_unit.py— 7 unit tests coveringFanOutRequestvalidation (Optional, None, out-of-range) andFanOutServiceper-subtaskNonedispatch (with and without outer deadline). Runs without a backend.docs/memory/feature-flows/fan-out.md,mcp-orchestration.md,parallel-headless-execution.mdand added bug: inter-agent task timeout hardcoded at 600s ignores per-agent execution_timeout_seconds #418 entry to the feature-flows index.Backwards compatibility
timeout_secondssee no behavior change.timeout_seconds=600in their request body — backend honors the explicit value as before.execution_timeout_secondsconfiguration surface (TIMEOUT-001) unchanged.Test Plan
pytest tests/test_inter_agent_timeout_unit.py -v— 7 passed in 1.14snpx tsc --noEmitclean insrc/mcp-server/execution_timeout_seconds=1800is now respected when agent-A invokes viachat_with_agent(parallel=true)without explicittimeout_seconds.Generated with Claude Code