diff options
| author | Shantur Rathore <[email protected]> | 2025-12-04 17:33:00 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-04 11:33:00 -0600 |
| commit | a607f33552b653af5e7ab5233c2da3389b978e68 (patch) | |
| tree | 26dc9c6d754973b8a9472e730e92b60c487e7344 | |
| parent | 350a32274a24e6f5ca3ea30be114a8171a58270f (diff) | |
| download | opencode-a607f33552b653af5e7ab5233c2da3389b978e68.tar.gz opencode-a607f33552b653af5e7ab5233c2da3389b978e68.zip | |
tweak: bash tool messages regarding timeouts and truncation more clear for agent (#5066)
| -rw-r--r-- | packages/opencode/src/tool/bash.ts | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/packages/opencode/src/tool/bash.ts b/packages/opencode/src/tool/bash.ts index d8af0a77f..fa737aaec 100644 --- a/packages/opencode/src/tool/bash.ts +++ b/packages/opencode/src/tool/bash.ts @@ -316,17 +316,24 @@ export const BashTool = Tool.define("bash", async () => { }) }) + let resultMetadata: String[] = ["<bash_metadata>"] + if (output.length > MAX_OUTPUT_LENGTH) { output = output.slice(0, MAX_OUTPUT_LENGTH) - output += "\n\n(Output was truncated due to length limit)" + resultMetadata.push(`Output exceeded length limit of ${MAX_OUTPUT_LENGTH} chars`) } if (timedOut) { - output += `\n\n(Command timed out after ${timeout} ms)` + resultMetadata.push(`Command terminated after exceeding timeout ${timeout} ms`) } if (aborted) { - output += "\n\n(Command was aborted)" + resultMetadata.push("Command aborted by user") + } + + if (resultMetadata.length > 1) { + resultMetadata.push("</bash_metadata>") + output += "\n\n" + resultMetadata.join("\n") } return { |
