set -eu
printf 'cwd=%s\n' "$PWD"
command -v psql || true
python3 - <<'PY'
import os
from urllib.parse import urlsplit
for k in ['SUPABASE_URL','SUPABASE_PROJECT_REF','SUPABASE_DB_URL']:
v=os.environ.get(k,'')
if k=='SUPABASE_DB_URL' and v:
u=urlsplit(v)
print(k, {'scheme':u.scheme,'host':u.hostname,'port':u.port,'user':u.username,'path':u.path,'query':u.query})
else: print(k, bool(v), v if k=='SUPABASE_PROJECT_REF' else '')
PYcwd=/work
/usr/bin/psql
SUPABASE_URL True
SUPABASE_PROJECT_REF True <ref>
SUPABASE_DB_URL {'scheme': 'postgresql', 'host': 'aws-0-us-east-1.pooler.supabase.com', 'port': 5432, 'user': 'postgres.<ref>', 'path': '/postgres', 'query': ''}
cat > pool_smoke.sh <<'EOF'
#!/usr/bin/env bash
# Smoke-test Supabase's transaction-mode (Supavisor) pooler with concurrent clients.
set -u
: "${SUPABASE_PROJECT_REF:?SUPABASE_PROJECT_REF is required}"
: "${SUPABASE_DB_URL:?SUPABASE_DB_URL is required (used to discover the pooler host)}"
: "${SUPABASE_DB_PASSWORD:?SUPABASE_DB_PASSWORD is required}"
command -v psql >/dev/null 2>&1 || { echo "psql is required" >&2; exit 2; }
command -v python3 >/dev/null 2>&1 || { echo "python3 is required" >&2; exit 2; }
# SUPABASE_DB_URL is the documented session-mode URL (port 5432). The same
# regional Supavisor endpoint exposes transaction mode exclusively on 6543.
POOL_HOST="$({ python3 - "$SUPABASE_DB_URL" <<'PY'
import sys
from urllib.parse import urlsplit
u = urlsplit(sys.argv[1])
if u.scheme not in ("postgres", "postgresql") or not u.hostname:
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 name a Supabase pooler")
print(u.hostname)
PY
} 2>/dev/null)" || { echo "Could not discover Supabase pooler host" >&2; exit 2; }
export PGPASSWORD="$SUPABASE_DB_PASSWORD"
export PGCONNECT_TIMEOUT=15
workdir="$(mktemp -d)" || exit 2
trap 'rm -rf "$workdir"' EXIT HUP INT TERM
# Do not use SUPABASE_DB_URL for the connections: it points to session mode.
# Explicit port 6543 guarantees transaction-mode pooling.
for i in $(seq 1 20); do
(
psql \
--host="$POOL_HOST" \
--port=6543 \
--username="postgres.${SUPABASE_PROJECT_REF}" \
--dbname=postgres \
--set=sslmode=require \
--no-psqlrc --quiet --tuples-only --no-align \
--command='SELECT pg_backend_pid();' \
>"$workdir/$i.out" 2>"$workdir/$i.err"
) &
done
ok=0
# wait with no arguments waits for every concurrent one-shot query.
wait
for i in $(seq 1 20); do
if [[ -s "$workdir/$i.out" ]] && [[ "$(tr -d '[:space:]' < "$workdir/$i.out")" =~ ^[0-9]+$ ]] && [[ ! -s "$workdir/$i.err" ]]; then
((ok += 1))
else
printf 'query %d failed: %s\n' "$i" "$(cat "$workdir/$i.err")" >&2
fi
done
if [[ "$ok" -eq 20 ]]; then
echo 'POOL OK 20/20'
exit 0
fi
printf 'POOL FAILED %d/20\n' "$ok" >&2
exit 1
EOF
chmod 700 pool_smoke.sh
./pool_smoke.sh
printf 'exit=%s mode=%s\n' "$?" "$(stat -c %A pool_smoke.sh)"POOL OK 20/20 exit=0 mode=-rwx------
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