Skip to content

Commit 1a6c124

Browse files
hyperpolymathclaude
andcommitted
feat(echidnabot): wire batch_driver to deployed nesy-solver-api /ingest
Adds remote-target support so batch_driver can record proof attempts into the deployed verisimdb (on fly.io) via nesy-solver-api's authed /ingest passthrough. Previously batch_driver could only POST to a local verisim-api (http://127.0.0.1:8080). New env var: VERISIM_TOKEN Bearer token. When set, VERISIM_URL is treated as the nesy-solver-api ingress and POSTs go to /ingest with Authorization: Bearer $VERISIM_TOKEN. When unset, behaviour is unchanged (direct POST to /api/v1/proof_attempts). Usage (deployed): VERISIM_URL=https://nesy-solver-api.fly.dev \\ VERISIM_TOKEN=$(cat ~/.config/nesy-solver/nesy-ingest-token) \\ ./batch_driver.sh Usage (local, unchanged): VERISIM_URL=http://127.0.0.1:8080 ./batch_driver.sh Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 82fead8 commit 1a6c124

1 file changed

Lines changed: 64 additions & 5 deletions

File tree

bots/echidnabot/scripts/batch_driver.sh

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
#
1313
# Environment:
1414
# VERISIM_URL (default http://127.0.0.1:8080)
15+
# VERISIM_TOKEN (Bearer token; required when VERISIM_URL points at a
16+
# deployed endpoint like nesy-solver-api.fly.dev with
17+
# /ingest — the URL should then be the full ingest path)
1518
# NOTIFY (1=notify-send on each result, 0=silent; default 1)
1619
# DRY_RUN (1=print only, no HTTP; default 0)
1720
# MAX_FILES (cap per target, default 10)
@@ -22,6 +25,7 @@
2225
set -euo pipefail
2326

2427
VERISIM_URL="${VERISIM_URL:-http://127.0.0.1:8080}"
28+
VERISIM_TOKEN="${VERISIM_TOKEN:-}"
2529
NOTIFY="${NOTIFY:-1}"
2630
DRY_RUN="${DRY_RUN:-0}"
2731
MAX_FILES="${MAX_FILES:-10}"
@@ -47,6 +51,8 @@ TARGETS=(
4751
"echidna|model-check|cadical|proofs/dimacs|cnf"
4852
"echidna|correctness|z3|proofs/smt-lib-mined|smt2"
4953
"echidna|correctness|cvc5|proofs/smt-lib-mined|smt2"
54+
"echidna|model-check|kissat|proofs/dimacs|cnf"
55+
"echidna|safety|eprover|proofs/tptp|p"
5056
"echidna|equiv|coq|proofs/coq|v"
5157
"echidna|equiv|lean|proofs/lean|lean"
5258
"echidna|equiv|agda|proofs/agda|agda"
@@ -204,6 +210,45 @@ exit" | timeout "${TIMEOUT_SEC}s" metamath 2>&1)
204210
fi
205211
}
206212

213+
run_kissat() {
214+
local file="$1"
215+
local t0 t1 rc
216+
t0=$(date +%s%3N)
217+
timeout "${TIMEOUT_SEC}s" kissat -q "$file" >/dev/null 2>&1
218+
rc=$?
219+
t1=$(date +%s%3N)
220+
echo $((t1 - t0))
221+
[ $rc -eq 124 ] && { echo timeout; return; }
222+
# kissat shares cadical's exit code convention: 10=SAT, 20=UNSAT.
223+
case $rc in
224+
10|20) echo success ;;
225+
0) echo unknown ;;
226+
*) echo failure ;;
227+
esac
228+
}
229+
230+
run_eprover() {
231+
local file="$1"
232+
local t0 t1 output rc
233+
t0=$(date +%s%3N)
234+
output=$(timeout "${TIMEOUT_SEC}s" eprover --auto-schedule "$file" 2>&1)
235+
rc=$?
236+
t1=$(date +%s%3N)
237+
echo $((t1 - t0))
238+
[ $rc -eq 124 ] && { echo timeout; return; }
239+
# E parses SZS status from its banner. "Theorem" or "ContradictoryAxioms"
240+
# both count as successful termination.
241+
if echo "$output" | grep -qE "SZS status (Theorem|Unsatisfiable|ContradictoryAxioms)"; then
242+
echo success
243+
elif echo "$output" | grep -qE "SZS status (CounterSatisfiable|Satisfiable)"; then
244+
echo failure
245+
elif echo "$output" | grep -qE "SZS status (Timeout|GaveUp|ResourceOut)"; then
246+
echo timeout
247+
else
248+
echo unknown
249+
fi
250+
}
251+
207252
run_cadical() {
208253
local file="$1"
209254
local t0 t1 rc
@@ -360,6 +405,8 @@ run_prover() {
360405
why3) run_why3 "$file" ;;
361406
metamath) run_metamath "$file" ;;
362407
cadical) run_cadical "$file" ;;
408+
kissat) run_kissat "$file" ;;
409+
eprover) run_eprover "$file" ;;
363410
*) echo 0; echo unknown ;;
364411
esac
365412
}
@@ -407,11 +454,23 @@ verify_one() {
407454
prover_output:$prover_output, error_message:null}')
408455

409456
if [ "$DRY_RUN" != "1" ]; then
410-
local resp
411-
resp=$(curl -sS -X POST "$VERISIM_URL/api/v1/proof_attempts" \
412-
-H 'Content-Type: application/json' -d "$insert_body" \
413-
--max-time 10 -w '\n%{http_code}')
414-
local http_code="${resp##*$'\n'}"
457+
local resp http_code
458+
# Route choice:
459+
# - local verisim-api: POST direct to /api/v1/proof_attempts (no auth)
460+
# - deployed nesy-solver-api: POST to /ingest with bearer token
461+
# Detection: VERISIM_TOKEN set ⇒ assume VERISIM_URL points at the
462+
# nesy-solver-api ingress and use its /ingest endpoint.
463+
if [ -n "$VERISIM_TOKEN" ]; then
464+
resp=$(curl -sS -X POST "$VERISIM_URL/ingest" \
465+
-H 'Content-Type: application/json' \
466+
-H "Authorization: Bearer $VERISIM_TOKEN" \
467+
-d "$insert_body" --max-time 10 -w '\n%{http_code}')
468+
else
469+
resp=$(curl -sS -X POST "$VERISIM_URL/api/v1/proof_attempts" \
470+
-H 'Content-Type: application/json' -d "$insert_body" \
471+
--max-time 10 -w '\n%{http_code}')
472+
fi
473+
http_code="${resp##*$'\n'}"
415474
if [ "$http_code" != "200" ] && [ "$http_code" != "201" ]; then
416475
echo " insert failed (HTTP $http_code): ${resp%$'\n'*}" >&2
417476
fi

0 commit comments

Comments
 (0)