tweak: bash tool messages regarding timeouts and truncation more clear for agent (#5066)
Some checks are pending
deploy / deploy (push) Waiting to run
format / format (push) Waiting to run
snapshot / publish (push) Waiting to run
test / test (push) Waiting to run

This commit is contained in:
Shantur Rathore 2025-12-04 17:33:00 +00:00 committed by GitHub
parent 350a32274a
commit a607f33552
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 {