Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 35 additions & 4 deletions scripts/test_providers.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/bash
# Test providers with optional code_execution mode
# Usage:
# ./test_providers.sh # Normal mode (direct tool calls)
# ./test_providers.sh --code-exec # Code execution mode (JS batching)

CODE_EXEC_MODE=false
for arg in "$@"; do
case $arg in
--code-exec)
CODE_EXEC_MODE=true
shift

Copilot AI Dec 19, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shift command has no effect here because the loop iterates over "$@" directly, not positional parameters. Remove this line as it serves no purpose in this context.

Suggested change
shift

Copilot uses AI. Check for mistakes.
;;

Copilot AI Dec 19, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shift command inside the loop will cause the loop to skip arguments. Since you're iterating over "$@" with "for arg in", the shift modifies the positional parameters but doesn't affect the loop iteration. Remove the shift command as it serves no purpose here and could cause unexpected behavior if additional arguments are added in the future.

Suggested change
;;

Copilot uses AI. Check for mistakes.
esac
done

if [ -f .env ]; then
export $(grep -v '^#' .env | xargs)
fi
Expand Down Expand Up @@ -37,6 +52,22 @@ else
PROVIDERS+=("databricks:databricks-claude-sonnet-4:gemini-2-5-flash:gpt-4o")
fi

# Configure mode-specific settings
if [ "$CODE_EXEC_MODE" = true ]; then
echo "Mode: code_execution (JS batching)"
BUILTINS="developer,code_execution"
SUCCESS_PATTERN="execute_code | code_execution|read_module | code_execution"

Copilot AI Dec 19, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex pattern mixes literal pipes (with spaces) and regex OR operator (pipe without spaces), making it unclear. Consider using explicit grouping like "(execute_code | code_execution)|(read_module | code_execution)" to make the intent clearer, or escape the literal pipes if they should be matched literally.

Suggested change
SUCCESS_PATTERN="execute_code | code_execution|read_module | code_execution"
SUCCESS_PATTERN="(execute_code | code_execution)|(read_module | code_execution)"

Copilot uses AI. Check for mistakes.
SUCCESS_MSG="code_execution tool called"
FAILURE_MSG="no code_execution tools called"
else
echo "Mode: normal (direct tool calls)"
BUILTINS="developer,autovisualiser,computercontroller,tutorial,todo,extensionmanager"
SUCCESS_PATTERN="shell | developer"
SUCCESS_MSG="developer tool called"
FAILURE_MSG="no developer tools called"
fi
echo ""

RESULTS=()

for provider_config in "${PROVIDERS[@]}"; do
Expand All @@ -52,13 +83,13 @@ for provider_config in "${PROVIDERS[@]}"; do
echo "Model: ${MODEL}"
echo ""
TMPFILE=$(mktemp)
(cd "$TESTDIR" && "$SCRIPT_DIR/target/release/goose" run --text "please list files in the current directory" --with-builtin developer,autovisualiser,computercontroller,tutorial,todo,extensionmanager 2>&1) | tee "$TMPFILE"
(cd "$TESTDIR" && "$SCRIPT_DIR/target/release/goose" run --text "please list files in the current directory" --with-builtin "$BUILTINS" 2>&1) | tee "$TMPFILE"
echo ""
if grep -q "shell | developer" "$TMPFILE"; then
echo "✓ SUCCESS: Test passed - developer tool called"
if grep -qE "$SUCCESS_PATTERN" "$TMPFILE"; then
echo "✓ SUCCESS: Test passed - $SUCCESS_MSG"
RESULTS+=("✓ ${PROVIDER}: ${MODEL}")
else
echo "✗ FAILED: Test failed - no developer tools called"
echo "✗ FAILED: Test failed - $FAILURE_MSG"
RESULTS+=("✗ ${PROVIDER}: ${MODEL}")
fi
rm "$TMPFILE"
Expand Down
Loading