agentscope-ai / agentscope-ai/QwenPaw
[Bug]: execute_shell_command hard-capped at 60s in Runtime 2.0 — shell_command_timeout ignored, long commands silently offloaded
- Langage dominant
- Python
- Étoiles
- 34.9k
- Forks
- 3.1k
- Merge moyen
- 1 j 15 h
- PR mergées (30 j)
- 225
Description
## QwenPaw Version
v2.0.0 (Runtime 2.0). Introduced by #5078; not present in v1.1.12.
## Description
Runtime 2.0 caps every `execute_shell_command` at a **hard-coded 60 s** deadline. Longer commands are **offloaded**: the subprocess is killed and the tool returns **`SUCCESS`** — *"…offloaded to background… You may continue."* So the chat shows **no error**, the output is dropped, and the agent continues on incomplete work. This is the "2.0 stops mid-task with no error" symptom on `pytest` / `pip install` / `docker build` / long scripts.
Why the usual knobs don't help:
- **`running.shell_command_timeout` (agent.json, shipped in #3593) is silently ignored.** It is read (`shell.py:515`) into the tool's internal wait as `fallback_secs`, but `cancellable_wait()` ignores `fallback_secs` whenever a call-context exists (`tool_calls/_timeout_helper.py:30-35`) — i.e. always, in-app. Only the coordinator deadline matters → the documented config is a no-op (regression of #3593).
- The per-call `timeout` argument is also only `fallback_secs` → ignored too.
- **Nothing raises the 60 s.** It is the hook default (`react_agent.py`, `default_timeout_secs=60.0`). The one override path (`set_agent_tool_timeout` from `builtin_tools..timeout_seconds`, read at `react_agent.py:654`) is unreachable — `BuiltinToolConfig` has no `timeout_seconds` field and uses `extra="ignore"`; the middleware passes no `deadline_override` (`tool_calls/_middleware.py:49`).
Code path in **Logs** below.
**Related PR(s):** #5078 (Runtime 2.0 — introduced this), #3593 (shipped the now-ignored `shell_command_timeout`)
**Security considerations:** n/a
## Component(s) Affected
- [x] Core / Backend (app, agents, config, providers, utils, local_models)
- [ ] Console (frontend web UI)
- [ ] Channels (DingTalk, Feishu, QQ, Discord, iMessage, etc.)
- [ ] Skills
- [ ] CLI
- [ ] Documentation (website)
- [ ] Tests
- [ ] CI/CD
- [ ] Scripts / Deploy
## Environment
- **QwenPaw version:** v2.0.0 (Docker image `agentscope/qwenpaw:latest`)
- **OS:** Linux (Docker)
- **Install method:** Docker
- **Python version (if applicable):** 3.11
_Root-cause analysis against the v2.0.0 source (exact `file:line` below); the image ships this code unchanged (`uv pip install .`)._
## Steps to Reproduce
1. Set `running.shell_command_timeout: 600` in the agent config (per #3593 this should permit ~10-minute commands).
2. Ask the agent to run a command that takes >60 s, e.g. `sleep 120 && echo done`.
3. Watch the tool card.
## Actual vs Expected
- **Actual:** at ~60 s the command is killed; the tool result is a `SUCCESS` "offloaded to background … You may continue." with no output and no error; the agent proceeds as if nothing failed. `shell_command_timeout: 600` had no effect.
- **Expected:** the command runs up to the configured `shell_command_timeout`; a genuine timeout returns a **visible** timeout/error (as in v1.1.x), not a silent `SUCCESS`.
## Logs / Screenshots
Code path (v2.0.0):
```
agents/react_agent.py hooks.register("execute_shell_command", default_timeout_secs=60.0)
tool_calls/_timeout_helper.py cancellable_wait(): ctx present -> fallback_secs ignored (30-35)
tool_calls/_middleware.py:49 coordinator.execute(...) called without deadline_override
tool_calls/_coordinator.py _handle_deadline_reached / _begin_offload -> SUCCESS "offloaded ... You may continue"
config/config.py BuiltinToolConfig: no `timeout_seconds` field (extra="ignore")
agents/tools/shell.py:515 shell_command_timeout only feeds the (ignored) fallback_secs
```
## Additional Notes
- Likely behind several "2.0 loses progress / stops" reports on longer jobs; the interrupt-then-"continue" flow may also feed #5860. Distinct from #5951 (Windows sandbox) and #4237 / #4045 (observability / adaptive-async — the *intended* long-command UX); this is the narrower correctness bug.
- Fix directions: (1) feed `shell_command_timeout` / the per-call `timeout` into the coordinator `deadline_override` so #3593 works again; (2) add `timeout_seconds` to `BuiltinToolConfig` (already read at `react_agent.py:654`); (3) surface offload/kill in the UI instead of a silent `SUCCESS`.
_中文简述:2.0 里 `execute_shell_command` 被硬编码 60s 上限;agent.json 的 `shell_command_timeout`(#3593)已失效,超时后命令被静默 offload/杀掉并返回 SUCCESS,聊天里看不到报错。_
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.