mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
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
This commit is contained in:
@@ -151,7 +151,7 @@ describe("gateway-hosted exec approvals", () => {
|
||||
const pending = await tool.execute("exec-approval-e2e", {
|
||||
command: "printf 'smoke\\n'",
|
||||
workdir: workspaceDir,
|
||||
timeout: 5,
|
||||
timeoutSeconds: 5,
|
||||
});
|
||||
|
||||
expect(pending.details.status).toBe("approval-pending");
|
||||
|
||||
@@ -421,7 +421,8 @@ export function createExecTool(
|
||||
strictInlineEval: defaults?.strictInlineEval,
|
||||
commandHighlighting: defaults?.commandHighlighting,
|
||||
trigger: defaults?.trigger,
|
||||
timeoutSec: params.timeoutSeconds,
|
||||
timeoutSec:
|
||||
typeof params.timeoutSeconds === "number" ? params.timeoutSeconds : undefined,
|
||||
defaultTimeoutSec,
|
||||
approvalRunningNoticeMs,
|
||||
warnings,
|
||||
@@ -444,7 +445,8 @@ export function createExecTool(
|
||||
pathPrepend: defaultPathPrepend,
|
||||
requestedEnv,
|
||||
pty: params.pty === true && !sandbox,
|
||||
timeoutSec: params.timeoutSeconds,
|
||||
timeoutSec:
|
||||
typeof params.timeoutSeconds === "number" ? params.timeoutSeconds : undefined,
|
||||
defaultTimeoutSec,
|
||||
security,
|
||||
ask,
|
||||
|
||||
@@ -232,7 +232,7 @@ test("background exec still times out after tool signal abort", async () => {
|
||||
executeParams: {
|
||||
command: BACKGROUND_HOLD_CMD,
|
||||
background: true,
|
||||
timeout: BACKGROUND_TIMEOUT_SEC,
|
||||
timeoutSeconds: BACKGROUND_TIMEOUT_SEC,
|
||||
},
|
||||
abortAfterStart: true,
|
||||
expectedTimeoutSec: BACKGROUND_TIMEOUT_SEC,
|
||||
@@ -261,7 +261,7 @@ test("background exec with timeout zero bypasses default timeout", async () => {
|
||||
const result = await tool.execute("toolcall", {
|
||||
command: BACKGROUND_HOLD_CMD,
|
||||
background: true,
|
||||
timeout: 0,
|
||||
timeoutSeconds: 0,
|
||||
});
|
||||
expect(result.details.status).toBe("running");
|
||||
const sessionId = (result.details as { sessionId: string }).sessionId;
|
||||
@@ -279,7 +279,7 @@ test("yielded background exec still times out", async () => {
|
||||
executeParams: {
|
||||
command: BACKGROUND_HOLD_CMD,
|
||||
yieldMs: 5,
|
||||
timeout: YIELDED_BACKGROUND_TIMEOUT_SEC,
|
||||
timeoutSeconds: YIELDED_BACKGROUND_TIMEOUT_SEC,
|
||||
},
|
||||
expectedTimeoutSec: YIELDED_BACKGROUND_TIMEOUT_SEC,
|
||||
});
|
||||
|
||||
@@ -369,7 +369,7 @@ export async function handleBashChatCommand(params: {
|
||||
command: commandText,
|
||||
background: shouldBackgroundImmediately,
|
||||
yieldMs: shouldBackgroundImmediately ? undefined : foregroundMs,
|
||||
timeout: timeoutSec,
|
||||
timeoutSeconds: timeoutSec,
|
||||
elevated: true,
|
||||
});
|
||||
|
||||
|
||||
@@ -313,7 +313,7 @@ async function requestGatewayDiagnosticsExportApproval(
|
||||
security: "allowlist",
|
||||
ask: "always",
|
||||
background: true,
|
||||
timeout: timeoutSec,
|
||||
timeoutSeconds: timeoutSec,
|
||||
});
|
||||
if (result.details?.status === "approval-pending") {
|
||||
return { status: "pending" };
|
||||
|
||||
@@ -203,7 +203,7 @@ async function requestTrajectoryExportApproval(
|
||||
security: "allowlist",
|
||||
ask: "always",
|
||||
background: true,
|
||||
timeout: timeoutSec,
|
||||
timeoutSeconds: timeoutSec,
|
||||
});
|
||||
return [
|
||||
`Trajectory bundle: requested \`${request.displayCommand}\` through exec approval. Approve once to create the bundle; do not use allow-all for trajectory exports.`,
|
||||
|
||||
Reference in New Issue
Block a user