printf 'psql='; command -v psql || true; printf 'python='; command -v python3 || true; printf 'dburl_present='; [ -n "$SUPABASE_DB_URL" ] && echo yes || echo no; printf 'url_host='; python3 - <<'PY'
import os, urllib.parse
u=os.environ.get('SUPABASE_DB_URL','')
try:
p=urllib.parse.urlsplit(u); print(p.hostname or '')
except: print('')
PY
printf 'url_port='; python3 - <<'PY'
import os, urllib.parse
u=os.environ.get('SUPABASE_DB_URL','')
try: print(urllib.parse.urlsplit(u).port or '')
except: print('')
PYpsql=/usr/bin/psql python=/usr/bin/python3 dburl_present=yes url_host=aws-0-us-east-1.pooler.supabase.com url_port=5432
cat > pool_smoke.sh <<'EOF'
#!/usr/bin/env bash
# Verify that the Supabase transaction-mode pooler can handle concurrent one-shot queries.
set -u
: "${SUPABASE_DB_URL:?SUPABASE_DB_URL is required}"
: "${SUPABASE_DB_PASSWORD:?SUPABASE_DB_PASSWORD is required}"
# Read only connection metadata from the supplied session-mode URL. The password is
# deliberately not read from or placed in the command line; psql gets it via PGPASSWORD.
if ! IFS=$'\t' read -r DB_HOST DB_USER DB_NAME < <(python3 - "$SUPABASE_DB_URL" <<'PY'
import sys
from urllib.parse import unquote, urlsplit
p = urlsplit(sys.argv[1])
if p.scheme not in ("postgres", "postgresql") or not p.hostname or not p.username:
raise SystemExit("SUPABASE_DB_URL is not a PostgreSQL URL")
if not p.path or p.path == "/":
raise SystemExit("SUPABASE_DB_URL has no database name")
host = p.hostname.lower()
# A pooler hostname plus the transaction port is required. In particular, this
# prevents accidentally testing the direct/session database endpoint.
if not host.endswith(".pooler.supabase.com"):
raise SystemExit("SUPABASE_DB_URL does not name a Supabase pooler host")
print("\t".join((host, unquote(p.username), unquote(p.path[1:]))))
PY
); then
echo "could not parse SUPABASE_DB_URL" >&2
exit 1
fi
if [[ -z "$DB_HOST" || -z "$DB_USER" || -z "$DB_NAME" ]]; then
echo "incomplete database connection details" >&2
exit 1
fi
# 6543 is Supabase's transaction-mode pooler port (5432 is session mode).
POOL_PORT=6543
WORKDIR=$(mktemp -d "${TMPDIR:-/tmp}/pool-smoke.XXXXXX")
trap 'rm -rf "$WORKDIR"' EXIT
pids=()
for i in $(seq 1 20); do
PGPASSWORD=$SUPABASE_DB_PASSWORD psql \
"host=$DB_HOST port=$POOL_PORT user=$DB_USER dbname=$DB_NAME sslmode=require connect_timeout=10" \
--no-psqlrc --quiet --tuples-only --no-align \
-c 'SELECT pg_backend_pid();' \
>"$WORKDIR/$i.out" 2>"$WORKDIR/$i.err" &
pids+=("$!")
done
failed=0
for pid in "${pids[@]}"; do
if ! wait "$pid"; then
failed=1
fi
done
if (( failed == 0 )); then
echo 'POOL OK 20/20'
exit 0
fi
echo "POOL FAILED: one or more transaction-pooler queries failed" >&2
exit 1
EOF
chmod +x pool_smoke.sh
./pool_smoke.sh; rc=$?; echo "exit=$rc"; exit $rcPOOL OK 20/20 exit=0
A shell script executed against the live project and asserted on the state the agent left behind. No model judged another model.
Raw transcript · Task definition and verifier · Every attempt