Skip to content

Commit 6c3b655

Browse files
authored
🤖 fix: improve bash timeout error message with actual timeout value (#667)
_Generated with `mux`_ Improves the bash tool timeout error message to include the actual timeout value that was exceeded, making it clearer for LLMs how to adjust their tool calls. **Before:** ``` Command exceeded timeout ``` **After:** ``` Command exceeded timeout of 3 seconds. You can increase the timeout by setting the `timeout_secs` parameter on the tool call. Do not use the `timeout` bash command to increase the timeout. ``` The error message now: - Shows the actual timeout value that was exceeded - Explains how to increase the timeout via the `timeout_secs` parameter - Warns against using the bash `timeout` command as a workaround Relates to #652
1 parent 5e96883 commit 6c3b655

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

‎src/node/services/tools/bash.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ function formatResult(
136136
truncated: boolean,
137137
overflowReason: string | null,
138138
wall_duration_ms: number,
139-
overflowPolicy: "tmpfile" | "truncate"
139+
overflowPolicy: "tmpfile" | "truncate",
140+
effectiveTimeout: number
140141
): BashToolResult {
141142
const output = lines.join("\n");
142143

@@ -153,7 +154,7 @@ function formatResult(
153154
if (exitCode === EXIT_CODE_TIMEOUT) {
154155
return {
155156
success: false,
156-
error: "Command exceeded timeout",
157+
error: `Command exceeded timeout of ${effectiveTimeout} seconds. You can increase the timeout by setting the \`timeout_secs\` parameter on the tool call. Do not use the \`timeout\` bash command to increase the timeout.`,
157158
exitCode: -1,
158159
wall_duration_ms,
159160
};
@@ -457,7 +458,8 @@ File will be automatically cleaned up when stream ends.`;
457458
truncated,
458459
overflowReason,
459460
wall_duration_ms,
460-
config.overflow_policy ?? "tmpfile"
461+
config.overflow_policy ?? "tmpfile",
462+
effectiveTimeout
461463
);
462464
},
463465
});

0 commit comments

Comments
 (0)