command -v psql || true; command -v python3 || true; printf 'REF=%s\n' "$SUPABASE_PROJECT_REF"; python3 - <<'PY'
import os,urllib.parse
for k in ('SUPABASE_DB_URL','SUPABASE_URL'):
u=urllib.parse.urlsplit(os.environ.get(k,''))
print(k, {'scheme':u.scheme,'host':u.hostname,'port':u.port,'user':u.username,'path':u.path})
PY/usr/bin/psql
/usr/bin/python3
REF=<ref>
SUPABASE_DB_URL {'scheme': 'postgresql', 'host': 'aws-0-us-east-1.pooler.supabase.com', 'port': 5432, 'user': 'postgres.<ref>', 'path': '/postgres'}
SUPABASE_URL {'scheme': 'https', 'host': '<ref>.supabase.co', 'port': None, 'user': None, 'path': ''}
pwd; ls -la
/work total 8 drwx------ 2 1000 1000 4096 Jul 24 05:50 . drwxr-xr-x 1 root root 4096 Jul 24 05:50 ..
cat > pool_smoke.sh <<'EOF'
#!/usr/bin/env bash
# Smoke-test Supabase's transaction-mode (PgBouncer) endpoint with 20
# simultaneous, short-lived clients.
set -u
: "${SUPABASE_DB_URL:?SUPABASE_DB_URL is required}"
: "${SUPABASE_DB_PASSWORD:?SUPABASE_DB_PASSWORD is required}"
# SUPABASE_DB_URL is the session-mode URL. Both pooler modes use the same
# pooler hostname and login, but transaction mode is specifically port 6543.
mapfile -d '' -t db_parts < <(python3 - "$SUPABASE_DB_URL" <<'PY'
import sys
from urllib.parse import unquote, urlsplit
u = urlsplit(sys.argv[1])
if u.scheme not in ("postgres", "postgresql") or not u.hostname or not u.username:
raise SystemExit("SUPABASE_DB_URL is not a valid PostgreSQL URL")
if not u.hostname.endswith(".pooler.supabase.com"):
raise SystemExit("SUPABASE_DB_URL does not identify a Supabase pooler")
dbname = unquote(u.path.lstrip("/")) or "postgres"
for value in (u.hostname, unquote(u.username), dbname):
sys.stdout.buffer.write(value.encode() + b"\0")
PY
) || exit 2
if (( ${#db_parts[@]} != 3 )); then
echo "Could not derive pooler settings from SUPABASE_DB_URL" >&2
exit 2
fi
export PGHOST="${db_parts[0]}"
export PGPORT=6543
export PGUSER="${db_parts[1]}"
export PGDATABASE="${db_parts[2]}"
export PGPASSWORD="$SUPABASE_DB_PASSWORD"
export PGSSLMODE=require
workdir=$(mktemp -d)
trap 'rm -rf "$workdir"' EXIT
pids=()
for i in $(seq 1 20); do
psql -X -qAt -v ON_ERROR_STOP=1 -c 'SELECT pg_backend_pid()' \
>"$workdir/$i.out" 2>"$workdir/$i.err" &
pids+=("$!")
done
succeeded=0
for i in $(seq 1 20); do
if wait "${pids[$((i-1))]}" && grep -Eq '^[0-9]+$' "$workdir/$i.out"; then
succeeded=$((succeeded + 1))
else
cat "$workdir/$i.err" >&2
fi
done
if (( succeeded == 20 )); then
echo 'POOL OK 20/20'
exit 0
fi
echo "POOL FAILED $succeeded/20" >&2
exit 1
EOF
chmod +x pool_smoke.sh
./pool_smoke.shPOOL OK 20/20
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