Skip to content

Commit 743732a

Browse files
authored
Merge pull request #87 from AI45Lab/fix/ptc-script-timeout
v4.2.7 — generous default timeout for delegation-capable PTC scripts
2 parents 6286ec4 + 79f4d34 commit 743732a

17 files changed

Lines changed: 473 additions & 42 deletions

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "a3s-code-core"
3-
version = "4.2.6"
3+
version = "4.2.7"
44
edition = "2021"
55
authors = ["A3S Lab Team"]
66
license = "MIT"

core/src/tools/program_tool.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ use tokio::sync::Mutex;
1616
use tokio::time::{timeout, Duration};
1717

1818
const DEFAULT_SCRIPT_TIMEOUT_MS: u64 = 30_000;
19+
/// Scripts allowed to delegate (`task`/`parallel_task`) run child agents that
20+
/// each take a full LLM turn, so they need a far more generous default timeout.
21+
const DELEGATION_SCRIPT_TIMEOUT_MS: u64 = 600_000;
1922
const DEFAULT_SCRIPT_MAX_TOOL_CALLS: usize = 20;
2023
const DEFAULT_SCRIPT_MAX_OUTPUT_BYTES: usize = 64 * 1024;
2124
const MAX_SCRIPT_SOURCE_BYTES: usize = 64 * 1024;
@@ -266,7 +269,17 @@ async fn run_quickjs_script(
266269
allowed_tools: HashSet<String>,
267270
limits: ScriptLimits,
268271
) -> Result<ToolOutput> {
269-
let timeout_ms = limits.timeout_ms.unwrap_or(DEFAULT_SCRIPT_TIMEOUT_MS);
272+
// A script that can delegate runs child agents (each a full LLM turn, often
273+
// 30s to several minutes), so the 30s default is far too short and silently
274+
// times out real workflows. Default delegation-capable scripts to a generous
275+
// timeout; pure compute/search scripts keep the short default. An explicit
276+
// limits.timeoutMs always wins.
277+
let delegating = allowed_tools.contains("parallel_task") || allowed_tools.contains("task");
278+
let timeout_ms = limits.timeout_ms.unwrap_or(if delegating {
279+
DELEGATION_SCRIPT_TIMEOUT_MS
280+
} else {
281+
DEFAULT_SCRIPT_TIMEOUT_MS
282+
});
270283
let max_tool_calls = limits
271284
.max_tool_calls
272285
.unwrap_or(DEFAULT_SCRIPT_MAX_TOOL_CALLS);

sdk/node/Cargo.lock

Lines changed: 180 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)