Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix: extend local terminal observation timeout (#18982)

Rylan Cai0dc7f249de1c
diff --git a/packages/builtin-tool-local-system/src/manifest.ts b/packages/builtin-tool-local-system/src/manifest.ts
index 01d57657656..beb1d47b743 100644
--- a/packages/builtin-tool-local-system/src/manifest.ts
+++ b/packages/builtin-tool-local-system/src/manifest.ts
@@ -229,9 +229,9 @@ export const LocalSystemManifest: BuiltinToolManifest = {
},
},
{
- defaultTimeoutMs: 30_000,
+ defaultTimeoutMs: 60_000,
description:
- 'Start a terminal session to execute a shell command and return console output collected during the wait window (up to 30 seconds by default). If the command is still running after the wait window, the result includes `shell_id` for later observation or termination.',
+ 'Start a terminal session to execute a shell command and return console output collected during the wait window (up to 60 seconds by default). If the command is still running after the wait window, the result includes `shell_id` for later observation or termination.',
humanIntervention: 'required',
name: LocalSystemApiName.runCommand,
parameters: {
@@ -262,9 +262,9 @@ export const LocalSystemManifest: BuiltinToolManifest = {
},
},
{
- defaultTimeoutMs: 30_000,
+ defaultTimeoutMs: 60_000,
description:
- 'Retrieve output from a running or completed background shell command. Waits for one output window (up to 30 seconds by default).',
+ 'Retrieve output from a running or completed background shell command. Waits for one output window (up to 60 seconds by default).',
name: LocalSystemApiName.getCommandOutput,
parameters: {
properties: {
diff --git a/packages/local-file-shell/src/shell/__tests__/process-manager.test.ts b/packages/local-file-shell/src/shell/__tests__/process-manager.test.ts
index bb1d8c2f0a8..c5674409b97 100644
--- a/packages/local-file-shell/src/shell/__tests__/process-manager.test.ts
+++ b/packages/local-file-shell/src/shell/__tests__/process-manager.test.ts
@@ -141,7 +141,7 @@ describe('ShellProcessManager', () => {
return result;
});
- await vi.advanceTimersByTimeAsync(29_999);
+ await vi.advanceTimersByTimeAsync(59_999);
expect(resolved).toBe(false);
await vi.advanceTimersByTimeAsync(1);
diff --git a/packages/local-file-shell/src/shell/process-manager.ts b/packages/local-file-shell/src/shell/process-manager.ts
index 00088981ce6..470e6e8849c 100644
--- a/packages/local-file-shell/src/shell/process-manager.ts
+++ b/packages/local-file-shell/src/shell/process-manager.ts
@@ -9,7 +9,7 @@ import type { GetCommandOutputParams, GetCommandOutputResult, KillCommandResult
import { decodeClixml } from './clixml';
import { buildOutputPreview } from './utils';
-const DEFAULT_OBSERVATION_TIMEOUT_MS = 30_000;
+export const DEFAULT_OBSERVATION_TIMEOUT_MS = 60_000;
const MAX_OBSERVATION_TIMEOUT_MS = 120_000;
const RUN_COMMAND_HEAD_RATIO = 0.2;
const GET_COMMAND_OUTPUT_HEAD_RATIO = 0;
diff --git a/packages/local-file-shell/src/shell/runner.ts b/packages/local-file-shell/src/shell/runner.ts
index b71790fa21e..cff7224bdf0 100644
--- a/packages/local-file-shell/src/shell/runner.ts
+++ b/packages/local-file-shell/src/shell/runner.ts
@@ -4,6 +4,7 @@ import type { SandboxPolicy } from '@lobechat/device-sandbox';
import type { RunCommandParams, RunCommandResult } from '../types';
import type { ShellOutputFiles, ShellProcess, ShellProcessManager } from './process-manager';
+import { DEFAULT_OBSERVATION_TIMEOUT_MS } from './process-manager';
import { detectWindowsShell, getShellConfig, normalizeEnvVarRefs } from './utils';
export interface RunCommandOptions {
@@ -36,7 +37,7 @@ export async function runCommand(
description,
env: extraEnv,
run_in_background,
- timeout = 30_000,
+ timeout = DEFAULT_OBSERVATION_TIMEOUT_MS,
}: RunCommandParams,
{ processManager, logger, onSandboxUnavailable, sandboxPolicy }: RunCommandOptions,
): Promise<RunCommandResult> {