qwen-code/docs
nas 0579be6ee8
feat(core): add configurable default timeout for foreground shell commands (#6628)
* feat(core): add configurable default timeout for foreground shell commands

Foreground shell commands started by the agent time out after a hardcoded
120s (DEFAULT_FOREGROUND_TIMEOUT_MS). A per-call `timeout` param can raise
that for a single command, but there is no way to change the default for a
project or session, so users repeatedly watch long-running commands fail at
the 2-minute mark.

Add a `tools.shell.defaultTimeoutMs` setting that feeds the existing timeout
resolution. Precedence is now: per-call `timeout` param > setting >
built-in default. When the setting is unset, behavior is unchanged; a value
of 0 disables the timeout, matching the existing per-call semantics.

Fixes #5838

* fix(core): add mock getShellDefaultTimeoutMs + bound defaultTimeoutMs

Address review on #6628:
- Add getShellDefaultTimeoutMs to mock configs in coreToolScheduler.test.ts
  and toAutoClassifierInput.test.ts (ShellTool construction now reads it).
- Add minimum: 0 / maximum: 600000 to the defaultTimeoutMs setting so a
  negative value can't reach AbortSignal.timeout(); regenerate schema.

* chore(core): polish shell defaultTimeoutMs per review

- shell.ts: debug-log the resolved foreground timeout (per-call vs
  configured default vs built-in) for observability
- settingsSchema.ts: use type 'integer' for tools.shell.defaultTimeoutMs
  to match sibling visionBridgeTimeoutMs; regenerate settings.schema.json
- config.test.ts: add loadCliConfig test asserting
  tools.shell.defaultTimeoutMs maps to Config.getShellDefaultTimeoutMs()

* fix(core): validate shell defaultTimeoutMs and fix disabled-timeout hint

Address review on the configurable foreground shell timeout:

- Config: validate shellDefaultTimeoutMs at construction, mirroring
  visionBridgeTimeoutMs, but allow 0 (disables the timeout). Negative,
  fractional, or out-of-range values now coerce to undefined instead of
  reaching AbortSignal.timeout() via a hand-edited settings.json that
  bypasses schema validation.
- settingsSchema: mark tools.shell.defaultTimeoutMs requiresRestart, since
  Config.shellDefaultTimeoutMs is private readonly with no setter, so a
  mid-session change cannot take effect.
- shell: when the timeout is disabled (effectiveTimeout === 0), suppress
  the long-run backgrounding hint instead of firing it on every command
  over ~1s via the longRunThresholdFor floor.
- shell: correct the precedence comment; 0 disables only at the
  settings/default level, as the per-call timeout param rejects <= 0.

Add coverage for negative/fractional coercion to the built-in default and
for 0 disabling the timeout without emitting the spurious hint.

---------

Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
2026-07-12 06:10:29 +00:00
..
design feat(web-shell): render composer references in user messages (#6537) 2026-07-11 17:44:47 +00:00
developers feat(serve): persist dynamic workspace registrations (#6716) 2026-07-11 16:49:40 +00:00
e2e-tests feat(worktree): Phase D — startup --worktree flag + symlinkDirectories + PR refs (#4381) 2026-05-27 17:04:51 +08:00
plans fix(core): preserve managed memory during microcompaction (#6714) 2026-07-11 15:58:54 +00:00
users feat(core): add configurable default timeout for foreground shell commands (#6628) 2026-07-12 06:10:29 +00:00
verification/abort-controller-refactor fix(core): stop AbortSignal listener leak in long sessions (MaxListenersExceededWarning) (#4366) 2026-05-26 14:21:49 +08:00
_meta.ts feat: refactor docs 2025-12-05 10:51:57 +08:00
index.md fix: lint issues 2025-12-19 15:52:11 +08:00