Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Shell timeout guidance: name 2 hours as the most, unless a lower limit is set

AdityaUmale1a07e840a904
diff --git a/server/shell-timeout-hint.test.ts b/server/shell-timeout-hint.test.ts
index ed19bdc7d2..231ecf25d5 100644
--- a/server/shell-timeout-hint.test.ts
+++ b/server/shell-timeout-hint.test.ts
@@ -10,7 +10,7 @@ describe("shellTimeoutHint", () => {
const hint = shellTimeoutHint("Bash", { command: "ffmpeg -i in.mp3 -ar 16000 out.wav" }, TIMED_OUT)!;
expect(hint).toContain("Do not rerun it the same way");
expect(hint).toContain("`timeout`");
- expect(hint).toContain("up to 7200000, which is 120 minutes");
+ expect(hint).toContain("up to 7200000, which is 120 minutes, unless a lower limit is set here");
expect(hint).toContain("foreground");
expect(hint).not.toContain("nohup");
expect(hint).not.toContain("detached");
diff --git a/server/system-prompt.test.ts b/server/system-prompt.test.ts
index 8ed3e71fbf..8eefeeefae 100644
--- a/server/system-prompt.test.ts
+++ b/server/system-prompt.test.ts
@@ -462,7 +462,7 @@ describe("longCommandsPrompt", () => {
it("names Bash's limit everywhere and vm_exec's own limit only with a Local VM", () => {
for (const kind of [null, "local", "vps", "box"] as const) {
const text = longCommandsPrompt(kind);
- expect(text).toContain("`timeout` in milliseconds, up to 7200000, which is 120 minutes");
+ expect(text).toContain("`timeout` in milliseconds, up to 7200000, which is 120 minutes, unless a lower limit is set here");
expect(text).toContain("Never wait inside a command for CI, a deploy or any other job to finish (no sleep loops or repeated polls): check it once");
expect(text).toContain("tell the person what you made (with links). Only on a turn the person started in their own chat, set wait_until or a one-time trigger to check back and end your turn");
expect(text).toContain("When the person writes while you work, answer them first.");
diff --git a/server/system-prompt.ts b/server/system-prompt.ts
index db6dc29635..0662123677 100644
--- a/server/system-prompt.ts
+++ b/server/system-prompt.ts
@@ -261,7 +261,8 @@ export const CREDENTIAL_PROMPT =
/** Two hours: the turn watchdog's default limit for a turn whose tool runs silently (OMB_TOOL_STALL_MS), so a long command
* that keeps working is not cut at ten minutes, and one still running at the limit is stopped and named as looking stuck. */
export const BASH_MAX_TIMEOUT_MS = 2 * 60 * 60_000;
-export const BASH_MAX_TIMEOUT_TEXT = `${BASH_MAX_TIMEOUT_MS}, which is ${BASH_MAX_TIMEOUT_MS / 60_000} minutes`;
+/** The default cap; a person's own BASH_MAX_TIMEOUT_MS can be lower, so the guidance names this as the most it allows. */
+export const BASH_MAX_TIMEOUT_TEXT = `${BASH_MAX_TIMEOUT_MS}, which is ${BASH_MAX_TIMEOUT_MS / 60_000} minutes, unless a lower limit is set here`;
const LONG_COMMANDS_TEXT =
` Long-running shell commands: a shell call is stopped after a default limit (2 minutes for a Bash call) and the output of a stopped command is lost. Before running anything that can take more than a minute, such as transcription (whisper), ffmpeg or ffprobe over long media, renders, large builds or big file transfers, pass a longer per-call timeout (Bash takes \`timeout\` in milliseconds, up to ${BASH_MAX_TIMEOUT_TEXT}) and keep the command in the foreground until it exits; split work that cannot finish within that into shorter pieces. A detached job may be killed when the call ends, so keep work whose result you need in the foreground, and trust only the command's own fresh exit code and output, not a launch exit 0 or an old output file. Never scan the whole disk with \`find /\` or similar: search by name with \`mdfind -name\` on macOS, or search a specific folder such as your workspace or home with a depth limit. If a command times out, do not rerun it the same way. Never wait inside a command for CI, a deploy or any other job to finish (no sleep loops or repeated polls): check it once, and if it is still running, tell the person what you made (with links). Only on a turn the person started in their own chat, set wait_until or a one-time trigger to check back and end your turn; work handed to you by a bot, a routine or an outside event cannot set a wait, so finish it in this turn. When the person writes while you work, answer them first.`;
const VM_LONG_COMMANDS_TEXT =