Skip to content

Commit 665264b

Browse files
Copilotkdinev
andcommitted
fix: use read -ra for safe array parsing, add TRIALS guard
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
1 parent b181ca0 commit 665264b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

evals/run-eval.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,15 @@ run_agent_task() {
138138

139139
# Add prompt args (e.g., -p)
140140
if [ -n "$AGENT_PROMPT_ARGS" ]; then
141-
# shellcheck disable=SC2206
142-
CMD_ARGS+=($AGENT_PROMPT_ARGS)
141+
read -ra _PROMPT_PARTS <<< "$AGENT_PROMPT_ARGS"
142+
CMD_ARGS+=("${_PROMPT_PARTS[@]}")
143143
fi
144144
CMD_ARGS+=("$FULL_PROMPT")
145145

146146
# Add auto-approve args (e.g., --yes, --sandbox)
147147
if [ -n "$AGENT_APPROVE_ARGS" ]; then
148-
# shellcheck disable=SC2206
149-
CMD_ARGS+=($AGENT_APPROVE_ARGS)
148+
read -ra _APPROVE_PARTS <<< "$AGENT_APPROVE_ARGS"
149+
CMD_ARGS+=("${_APPROVE_PARTS[@]}")
150150
fi
151151

152152
# Run the agent in the work directory with a timeout
@@ -304,6 +304,10 @@ run_task_trials() {
304304
done
305305

306306
# Calculate aggregate metrics
307+
if [ "$TRIALS" -le 0 ]; then
308+
echo "ERROR: TRIALS must be > 0" >&2
309+
return 1
310+
fi
307311
local PASS_RATE
308312
PASS_RATE=$(echo "scale=2; $PASS_COUNT / $TRIALS" | bc)
309313
# pass@k = 1 if at least one trial passed, else 0

0 commit comments

Comments
 (0)