fix(tool-bash): handle unavailable spill paths

This commit is contained in:
Tianyi Cui
2026-06-19 01:54:57 +08:00
parent 0334b4ad2e
commit 49bb6a88eb
7 files changed
+69 -10

No files matched your search

+3 -2
View File
@@ -316,7 +316,7 @@ export function apply(ctx: Context): void {
description: 'Execute a bash command (`bash -c`) and return its stdout/stderr. '
+ 'Each call runs in a fresh shell: no state (cwd, variables, functions) persists between calls — '
+ 'pass `workdir` instead of using `cd`. Non-zero exits are reported as `[exit code: N]`. '
+ 'Long output is truncated to its tail; the full output is saved to a file whose path is reported. '
+ 'Long output is truncated to its tail; the full output is saved to a file whose path is reported when available. '
+ 'Set `run_in_background: true` for long-running commands: the call returns a task id immediately; '
+ 'poll it with `bash_output` and stop it with `bash_kill`.',
parameters: {
@@ -377,7 +377,8 @@ export function apply(ctx: Context): void {
let text = read.delta.length > 0 ? read.delta : '(no new output)'
if (read.lossy) {
const paths = [read.stdoutSpillPath, read.stderrSpillPath].filter((p): p is string => p !== undefined)
text += `\n[some output was dropped from memory; full output: ${paths.join(', ')}]`
const fullOutput = paths.length > 0 ? paths.join(', ') : '(unavailable)'
text += `\n[some output was dropped from memory; full output: ${fullOutput}]`
}
text += `\n${statusLine(read.task)}`
return Promise.resolve([{ type: 'text', text }])