mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 13:26:04 -06:00
bd897a6143
* fix: exec timeout field does not state its unit, so callers pass milliseconds `exec.timeout` is in seconds, but its sibling `yieldMs` is in milliseconds and the `process` tool's identically named `timeout` is also in milliseconds. Those two tools are used together in one workflow: exec backgrounds a long command, then process polls it. The unit exists only in the field description, and code mode deliberately defers descriptions - the model sees `timeout?: number` and nothing else. A caller that guesses milliseconds passes 900000 intending 15 minutes and gets ~10 days, so the command never times out. Add `timeoutSeconds` as the canonical field, matching the convention already used by the config default (`tools.exec.timeoutSeconds`) and the sibling (`yieldMs`). Keep `timeout` as a deprecated alias; `timeoutSeconds` wins when both are supplied. Project the new field onto `nodeExecSchema`, which hand-picks its properties. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XQojYRCUdXhcKFeu4QW5Gh * fix(ci): satisfy test-type and dependency checks Two CI failures from the test approach, not the change itself. - check-test-types: TypeBox's TOptional does not surface `description` on its static type, so the schema assertions failed under tsgo. Read it through a narrow accessor instead. - check-dependencies: knip flagged resolveExecTimeoutSeconds as an unused export because only the test imported it. Move it beside the schema it resolves, where the exec runtime imports it, so it is production-reachable. Verified with the same commands CI runs: `run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json` reports no errors in these files, and knip --production reports no unused exports. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XQojYRCUdXhcKFeu4QW5Gh * fix(ci): fit the exec description budget and satisfy oxlint - `agent-tools.schema.test.ts` enforces a 550-char budget on the exec tool's model-facing descriptions; the two new ones pushed it to 640. Shortened both. The rename is what makes this possible: the unit now lives in the field name, so the description no longer has to carry it. Extended that budget test to pin `timeoutSeconds` alongside `timeout`. - oxlint `no-base-to-string`: the test's description accessor typed the field as `unknown` and stringified it. Typed as `string | undefined` instead. Verified: budget test passes (137 tests green across both suites), and all six behavior tests still fail against origin/main. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XQojYRCUdXhcKFeu4QW5Gh * fix: remove the unit-ambiguous exec timeout field instead of deprecating it Owner decision on the review's "ambiguous model-visible alias" finding: drop `timeout` entirely rather than keep it as a deprecated alias. Keeping it visible defeated the purpose. Code mode renders property names and types and defers descriptions, so a model would still be offered a bare `timeout` sitting next to a millisecond-based `yieldMs` and could still pick it. A deprecation marker in a description the model never sees changes nothing. Backward compatibility is not required here: every tool call is constructed fresh by the model from the current schema, and a repository search found no internal caller passing `timeout` to the exec tool. `timeoutSeconds` is now the only exec timeout field, on both the main and node-only surfaces. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XQojYRCUdXhcKFeu4QW5Gh * fix: migrate the internal exec callers to timeoutSeconds Removing `timeout` from the exec schema broke three real internal callers that the earlier survey missed, plus two test files and the runtime's own reads. `check-test-types` caught it; my local search had filtered `timeout:` matches to lines mentioning "exec" and discarded these. - src/auto-reply/reply/bash-command.ts - src/auto-reply/reply/commands-diagnostics.ts - src/auto-reply/reply/commands-export-trajectory.ts all passed `timeout: timeoutSec` and now pass `timeoutSeconds: timeoutSec`. - bash-tools.exec-run.ts reads the field through the same typeof narrowing the third call site already used; `params` is loosely typed, so a raw read is `unknown`. - Test fixtures updated. A vitest `waitFor({ timeout })` option in background-abort.test.ts is NOT an exec param and was left alone. `run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json` now reports zero errors in changed files; the 5 remaining `rejectSymlinks` errors are pre-existing on main. 148 tests pass across the affected suites. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XQojYRCUdXhcKFeu4QW5Gh * docs: synchronize the exec config table with timeoutSeconds Addresses the P2 finding. The tools.exec.timeoutSeconds row still described the per-call override as `timeout` and `timeout: 0`, which no longer exist. The only remaining bare `timeout` reference in this page is the deliberate contrast with the process tool's millisecond field. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XQojYRCUdXhcKFeu4QW5Gh * fix: migrate the QA lifecycle caller and the shared ExecToolArgs contract Two findings from the re-review of 6e8c3560e7e, both real. [P1] test/e2e/qa-lab/runtime/openclaw-exec-process-lifecycle.e2e.test.ts:174 still passed `timeout: 0.05`. After the removal that field is accepted and ignored, so the call silently used the default timeout and could not produce the asserted 50 ms `overall-timeout` result. Migrated. [P2] ExecToolArgs in bash-tools.exec-request-preparation.ts:33 still declared `timeout?: number` while the runtime reads only `timeoutSeconds`, offering request-preparation users an accepted-but-inert argument. Renamed. Why the typecheck missed both: ExecToolArgs is `Record<string, unknown> & {...}`, and that index signature defeats excess property checking, so a stale member produces no error at any call site. The e2e file also sits outside the core test tsconfig I had been running locally. Left alone deliberately: `processTool.execute({ action: "poll", timeout })` is milliseconds and correct, and `createBashTool` in sessions/tools/bash.ts is a separate tool surface with its own timeout. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XQojYRCUdXhcKFeu4QW5Gh * fix(test): update the node exec tool property assertion to timeoutSeconds src/gateway/tool-resolution.exclude.test.ts:413 asserts the exact property list of the node-forced exec tool and still expected "timeout". Renamed to match nodeExecSchema. Found by checks-node-compact-large-5; my local core-test tsconfig does not cover src/gateway, so it did not surface there. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XQojYRCUdXhcKFeu4QW5Gh * fix: accept the legacy exec timeout as an undocumented alias Removing the field from the schema does not reject it at runtime: the exec schema accepts unknown properties, so a call built against an older schema was accepted and then silently ignored, taking the default deadline instead of the one it asked for. Route every read through resolveExecTimeoutSeconds, which prefers the canonical timeoutSeconds and falls back to a numeric timeout. The alias stays out of execSchema, nodeExecSchema and ExecToolArgs, so no new caller can adopt it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XQojYRCUdXhcKFeu4QW5Gh * docs: update the background-process guide to timeoutSeconds The exec parameter table and the inheritance note still taught `timeout` and `timeout: 0`, which kept the retired spelling publicly discoverable and contradicted the exec guide. `poll`'s own millisecond `timeout` is left alone; it is a different tool and a different unit, which is the collision this rename removes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XQojYRCUdXhcKFeu4QW5Gh * fix(exec): reject removed timeout field * chore: regenerate plugin SDK API baseline --------- Co-authored-by: Marvinthebored <262704729+Marvinthebored@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>