fix(eval): improve compare script error handling

This commit is contained in:
ZanzyTHEbar 2026-02-18 13:22:15 +00:00
parent 01a9068494
commit 3ea30372aa

View file

@ -19,26 +19,29 @@ echo ""
cd "$PROJECT_ROOT" cd "$PROJECT_ROOT"
# 1. Build current branch # 1. Build current branch eval-runner (instrumented wrapper)
echo "[1/4] Building current branch..." echo "[1/4] Building eval-runner from current branch..."
make build 2>&1 | tail -1 make eval-build 2>&1 | tail -1
cp build/picoclaw "$EVAL_DIR/bin/eval-runner" cp "$EVAL_DIR/bin/eval-runner" "$EVAL_DIR/bin/eval-runner-branch"
# 2. Build main branch # 2. Build main branch eval-runner
CURRENT_BRANCH=$(git branch --show-current) CURRENT_BRANCH=$(git branch --show-current)
STASH_RESULT=$(git stash 2>&1) STASH_RESULT=$(git stash 2>&1)
echo "[2/4] Building main branch..." echo "[2/4] Building eval-runner from main branch..."
git checkout main 2>/dev/null git checkout main 2>/dev/null
make build 2>&1 | tail -1 make eval-build 2>&1 | tail -1
cp build/picoclaw "$EVAL_DIR/bin/eval-runner-main" cp "$EVAL_DIR/bin/eval-runner" "$EVAL_DIR/bin/eval-runner-main"
# Restore # Restore working branch
git checkout "$CURRENT_BRANCH" 2>/dev/null git checkout "$CURRENT_BRANCH" 2>/dev/null
if [[ "$STASH_RESULT" != "No local changes to save" ]]; then if [[ "$STASH_RESULT" != "No local changes to save" ]]; then
git stash pop 2>/dev/null || true git stash pop 2>/dev/null || true
fi fi
# Put branch binary back as the default eval-runner
cp "$EVAL_DIR/bin/eval-runner-branch" "$EVAL_DIR/bin/eval-runner"
# 3. Update promptfoo config to enable comparison # 3. Update promptfoo config to enable comparison
cd "$EVAL_DIR" cd "$EVAL_DIR"