fix(agent_orchestration): Unbounded timeout for delegation tools — delegate_tools_agent, run_code (#4734)#4741
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 31 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Comment |
…yhumansai#4734) ArchetypeDelegationTool synthesizes delegate_tools_agent (tools_agent) and run_code (code_executor). It defaulted to ToolTimeout::Inherit = the global 120s per-tool cap, so any delegated sub-agent run exceeding two minutes was hard-killed and truncated (Sentry TAURI-RUST-K29: 1236 events / 71 users; TAURI-RUST-8HB: 755 / 51). The child bounds its own lifetime via max_iterations, the run cancellation token, and each inner tool's timeout, so override timeout_policy -> Unbounded, matching spawn_parallel_agents (tinyhumansai#4686) and the long-running scripting tools. Adds a unit test asserting the override.
c408115 to
5df7911
Compare
Summary
delegate_tools_agent,run_code, and any other archetype-delegate tool) now opt out of the global 120s per-tool wall-clock, so a sub-agent run that legitimately takes longer than two minutes is no longer hard-killed mid-flight.TAURI-RUST-K29(delegate_tools_agent, 1236 events / 71 users) andTAURI-RUST-8HB(run_code, 755 events / 51 users).Problem
Both
delegate_tools_agentandrun_codeare synthesized by the same type,ArchetypeDelegationTool. It never overrodetimeout_policy(), so it inheritedToolTimeout::Inherit= the global per-tool cap (tool_timeout::DEFAULT_TIMEOUT_SECS = 120). Every tool call is wrapped intokio::time::timeout(deadline, exec), so a delegation whose sub-agent runs past 120s was hard-killed at exactly 120.000s and truncated — surfacing astool '<name>' timed out after 120 seconds. The delegated agents are internally bounded (theiragent.tomlmax_iterations, the run cancellation token, and each inner tool's own timeout), so the 120s cap doesn't protect against runaway work — it just truncates legitimate long-running delegation.The sibling
spawn_parallel_agentstool had this exact bug fixed in #4686 (timeout_policy -> Unbounded); the long-running scripting tools (shell,node_exec,npm_exec) are already Unbounded-by-default.ArchetypeDelegationToolwas simply missed.Solution
Override
timeout_policy() -> ToolTimeout::UnboundedonArchetypeDelegationTool, mirroring #4686. The child agent governs its own lifetime, so the delegation primitive should not impose the single-tool wall-clock. Adds a unit test asserting the override (mirrorsspawn_parallel_agents_tests).Scope is deliberately narrow:
SkillDelegationTool(→integrations_agent, quick Composio actions) and the baseDelegateToolroute to short-lived agents and are intentionally left on the default — no speculative widening.RCA-vs-suppress: Bucket = real-defect (a wrong timeout policy truncating internally-bounded work). This corrects the policy; it is not a suppression.
Submission Checklist
timeout_policy() == Unbounded; existingArchetypeDelegationTooltests cover the delegation happy/blank-prompt pathscargo-llvm-cov+diff-cover --compare-branch=upstream/main: 100% on changed lines (7/7)N/A: behaviour-only reliability change (no feature row)## Related—N/AN/A: internal tool-timeout policyCloses #NNNin## RelatedImpact
Related
AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
fix/4734-delegation-tool-timeout(rebased onto currentmain, past the fix(tests): restore test-module imports broken by recent refactors #4759 libtest fix)Validation Run
pnpm --filter openhuman-app format:check— N/A (noapp/changes)pnpm typecheck— N/A (no TS changes)delegation_opts_out_of_the_global_tool_timeout— passes (test result: ok. 1 passed)cargo fmt --checkclean,cargo check --libclean,cargo clippy --libclean on the changed fileBehavior Changes
Parity Contract
spawn_parallel_agentspattern exactly.Duplicate / Superseded PR Handling