fix: fs tools now output better error handling to guide the model more effectively
CI / All (ubuntu-latest) (push) Failing after 25s
CI / All (macos-latest) (push) Has been cancelled
CI / All (windows-latest) (push) Has been cancelled

This commit is contained in:
2026-07-14 12:47:43 -06:00
parent dd40892ad5
commit 2fe6704fbc
5 changed files with 31 additions and 10 deletions
+9 -1
View File
@@ -10,5 +10,13 @@ set -e
main() { main() {
# shellcheck disable=SC2154 # shellcheck disable=SC2154
cat "$argc_path" >> "$LLM_OUTPUT" 2>&1 || echo "No such file or path: $argc_path" >> "$LLM_OUTPUT" local path="$argc_path"
# An empty result is shown to the model as the opaque literal "DONE"; emit a note instead.
if [[ -f "$path" && ! -s "$path" ]]; then
echo "(empty file: $path)" >> "$LLM_OUTPUT"
return 0
fi
cat "$path" >> "$LLM_OUTPUT" 2>&1 || echo "No such file or path: $path" >> "$LLM_OUTPUT"
} }
+2 -2
View File
@@ -17,8 +17,8 @@ main() {
local search_path="${argc_path:-.}" local search_path="${argc_path:-.}"
if [[ ! -d "$search_path" ]]; then if [[ ! -d "$search_path" ]]; then
echo "Error: directory not found: $search_path" >> "$LLM_OUTPUT" echo "Error: directory not found: $search_path" >&2
return 1 exit 1
fi fi
local results local results
+2 -2
View File
@@ -21,8 +21,8 @@ main() {
local include_filter="${argc_include:-}" local include_filter="${argc_include:-}"
if [[ ! -e "$search_path" ]]; then if [[ ! -e "$search_path" ]]; then
echo "Error: path not found: $search_path" >> "$LLM_OUTPUT" echo "Error: path not found: $search_path" >&2
return 1 exit 1
fi fi
local grep_args=(-nH --color=never) local grep_args=(-nH --color=never)
+14 -1
View File
@@ -9,5 +9,18 @@ set -e
main() { main() {
# shellcheck disable=SC2154 # shellcheck disable=SC2154
ls -1 "$argc_path" >> "$LLM_OUTPUT" 2>&1 || echo "No such path: $argc_path" >> "$LLM_OUTPUT" local path="$argc_path"
local output
if ! output=$(ls -1 "$path" 2>&1); then
echo "$output" >> "$LLM_OUTPUT"
return 0
fi
# An empty result is shown to the model as the opaque literal "DONE"; emit a note instead.
if [[ -z "$output" ]]; then
echo "(empty directory: $path)" >> "$LLM_OUTPUT"
else
echo "$output" >> "$LLM_OUTPUT"
fi
} }
+2 -2
View File
@@ -23,8 +23,8 @@ main() {
local limit="${argc_limit:-2000}" local limit="${argc_limit:-2000}"
if [[ ! -e "$target" ]]; then if [[ ! -e "$target" ]]; then
echo "Error: path not found: $target" >> "$LLM_OUTPUT" echo "Error: path not found: $target" >&2
return 1 exit 1
fi fi
if [[ -d "$target" ]]; then if [[ -d "$target" ]]; then