summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-08-12 14:51:13 -0400
committerDax Raad <[email protected]>2025-08-12 14:51:13 -0400
commit6aa157cfe6195effa6f9fea3dc18380a48544489 (patch)
treeaf26c87ac946e6ce97e8aa97c33c578a6cba2932
parent9fff9a37d09796c0a438d30b21205e2e147986b2 (diff)
downloadopencode-6aa157cfe6195effa6f9fea3dc18380a48544489.tar.gz
opencode-6aa157cfe6195effa6f9fea3dc18380a48544489.zip
limit bash tool to 1000 lines of output
-rw-r--r--packages/opencode/src/tool/bash.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/opencode/src/tool/bash.ts b/packages/opencode/src/tool/bash.ts
index b6266dc22..4e54d798a 100644
--- a/packages/opencode/src/tool/bash.ts
+++ b/packages/opencode/src/tool/bash.ts
@@ -12,7 +12,6 @@ import { Wildcard } from "../util/wildcard"
import { $ } from "bun"
import { Agent } from "../agent/agent"
-const MAX_OUTPUT_LENGTH = 30000
const DEFAULT_TIMEOUT = 1 * 60 * 1000
const MAX_TIMEOUT = 10 * 60 * 1000
@@ -107,7 +106,6 @@ export const BashTool = Tool.define("bash", {
const process = exec(params.command, {
cwd: app.path.cwd,
signal: ctx.abort,
- maxBuffer: MAX_OUTPUT_LENGTH,
timeout,
})
@@ -155,6 +153,12 @@ export const BashTool = Tool.define("bash", {
},
})
+ const lines = output.split("\n")
+ if (lines.length > 1000) {
+ output = lines.slice(0, 1000).join("\n")
+ output += "\n\n(Ouput was truncated)"
+ }
+
return {
title: params.command,
metadata: {