2025-10-18 17:35:29 -04:00
#!/bin/bash
2025-12-19 15:02:06 +11:00
2026-02-12 21:12:11 +11:00
LIB_DIR = " $( cd " $( dirname " $0 " ) " && pwd ) "
source " $LIB_DIR /test_providers_lib.sh "
2025-12-19 15:02:06 +11:00
2026-02-12 21:12:11 +11:00
echo "Mode: normal (direct tool calls)"
echo ""
2025-10-18 17:35:29 -04:00
2026-02-12 21:12:11 +11:00
GOOSE_BIN = $( build_goose)
BUILTINS = "developer"
2025-10-18 17:35:29 -04:00
2026-02-10 11:01:28 +08:00
mkdir -p target
TEST_CONTENT = "test-content-abc123"
TEST_FILE = "./target/test-content.txt"
echo " $TEST_CONTENT " > " $TEST_FILE "
2026-02-03 11:21:59 -05:00
run_test( ) {
2026-02-12 21:12:11 +11:00
local provider = " $1 " model = " $2 " result_file = " $3 " output_file = " $4 "
2026-02-03 11:21:59 -05:00
local testdir = $( mktemp -d)
2026-02-10 11:01:28 +08:00
local prompt
if is_agentic_provider " $provider " ; then
cp " $TEST_FILE " " $testdir /test-content.txt "
prompt = "read ./test-content.txt and output its contents exactly"
else
2026-02-19 20:06:48 +11:00
# Write two files with unique random tokens. Validation checks that text_editor
# was used and that both tokens appear in the output, proving the model actually
# read the files (random tokens can't be guessed or hallucinated).
local token_a = " smoke-alpha- $RANDOM "
local token_b = " smoke-bravo- $RANDOM "
echo " $token_a " > " $testdir /part-a.txt "
echo " $token_b " > " $testdir /part-b.txt "
# Store tokens so validation can check them
echo " $token_a " > " $testdir /.token_a "
echo " $token_b " > " $testdir /.token_b "
prompt = "Use the text_editor view command to read ./part-a.txt and ./part-b.txt, then reply with ONLY the contents of both files, one per line, nothing else. Do NOT use any other tool in Developer."
2026-02-10 11:01:28 +08:00
fi
2026-02-03 11:21:59 -05:00
(
export GOOSE_PROVIDER = " $provider "
export GOOSE_MODEL = " $model "
2026-02-12 21:12:11 +11:00
cd " $testdir " && " $GOOSE_BIN " run --text " $prompt " --with-builtin " $BUILTINS " 2>& 1
2026-02-03 11:21:59 -05:00
) > " $output_file " 2>& 1
2026-02-10 11:01:28 +08:00
if is_agentic_provider " $provider " ; then
if grep -qi " $TEST_CONTENT " " $output_file " ; then
2026-02-12 21:12:11 +11:00
echo "success|test content found by model" > " $result_file "
2026-02-10 11:01:28 +08:00
else
2026-02-12 21:12:11 +11:00
echo "failure|test content not found by model" > " $result_file "
2026-02-10 11:01:28 +08:00
fi
2026-02-03 11:21:59 -05:00
else
2026-02-19 20:06:48 +11:00
local token_a token_b
token_a = $( cat " $testdir /.token_a " )
token_b = $( cat " $testdir /.token_b " )
2026-02-13 15:16:46 +11:00
if ! grep -qE "(text_editor \| developer)|(▸.*text_editor.*developer)" " $output_file " ; then
2026-02-12 21:12:11 +11:00
echo "failure|model did not use text_editor tool" > " $result_file "
2026-02-19 20:06:48 +11:00
elif ! grep -q " $token_a " " $output_file " ; then
echo " failure|model did not return contents of part-a.txt ( $token_a ) " > " $result_file "
elif ! grep -q " $token_b " " $output_file " ; then
echo " failure|model did not return contents of part-b.txt ( $token_b ) " > " $result_file "
2026-02-03 11:21:59 -05:00
else
2026-02-19 20:06:48 +11:00
echo "success|model read and returned both file contents" > " $result_file "
2026-02-03 11:21:59 -05:00
fi
fi
2026-02-12 21:12:11 +11:00
rm -rf " $testdir "
}
2026-01-22 16:10:41 -08:00
2026-02-12 21:12:11 +11:00
build_test_cases
run_test_cases run_test
report_results