Repository navigation
Description
Describe the bug
Synchronous Harness agent_spawn and agent_send calls are timed as ordinary tool executions, even though AgentSpawnTool already manages the complete subagent wait. A longer application-controlled subagent deadline cannot take effect when the ordinary tool deadline expires first.
For example, an ordinary-tool timeout of 10 minutes can cancel a subagent intended to run for up to 30 minutes. This interrupts the whole multi-step agent invocation, rather than an individual script or child tool call, and can cause unnecessary follow-up work.
To Reproduce
-
Configure the parent Toolkit with an ordinary-tool timeout:
Toolkit toolkit = new Toolkit(ToolkitConfig.builder() .executionConfig(ExecutionConfig.builder() .timeout(Duration.ofMinutes(10)) .build()) .build());
-
Enable Harness subagents and supply an application-controlled force-sync budget:
RuntimeContext ctx = RuntimeContext.builder() .sessionId("parent-session") .put(AgentSpawnTool.CTX_FORCE_SYNC, true) .put(AgentSpawnTool.CTX_FORCE_SYNC_TIMEOUT_SECONDS, 1800) .build();
-
Invoke
agent_spawn, or follow up withagent_send, for a task that needs more than 10 minutes across multiple reasoning/tool steps. No individual child tool needs to exceed the ordinary-tool timeout. -
The outer
ToolExecutor.applyTimeout()cancels the entire delegation at 10 minutes. Cancellation propagates throughAgentSpawnToolto its child subscription.
The same mismatch reproduces without a long wait: use a 50 ms Toolkit timeout, a 5 s subagent budget, and a child invocation that completes after 200 ms. Both direct Toolkit.callTool() and ReAct's batch Toolkit.callTools() path apply the shorter outer deadline.
Expected behavior
Delegation tools that already manage their own wait should use that budget independently of the ordinary-tool timeout. Tools executed inside the child should retain their normal tool timeout, and cancelling the parent should still cancel synchronous child execution.
The trusted application override should be usable above 600 seconds while the LLM-provided timeout_seconds retains its existing 600-second cap.
Error messages
Tool execution failed: Tool execution timeout after PT10M
Environment
- AgentScope Java:
2.1.0-SNAPSHOT, upstreammainate190a8d1b855312af5f349334ec14c6ea1013d4f - Validation host: Java 21, Windows; the timeout composition is platform-independent.
Additional context
ToolExecutor.executeWithInfrastructure() wraps the complete delegation in applyTimeout(). Separately, AgentSpawnTool.resolveEffectiveTimeoutMs() also clamps the trusted application override to 600 seconds. Removing that clamp alone therefore does not fix this outer timeout.
Related: #3166 covers the application-side 600-second ceiling; #1451 reports a similar outer timeout for task_output. This report and its proposed fix focus on synchronous agent_spawn / agent_send. The existing #2749 changes timeout precedence but retains the 600-second clamp and does not separate these delegation waits from the outer ordinary-tool timeout.
Activity
fix(core,harness): separate subagent waits from ordinary tool timeouts (