env | grep -E "^SUPABASE_" | sed 's/=.*/=***/'
SUPABASE_DB_PASSWORD=*** SUPABASE_DB_URL=*** SUPABASE_URL=*** SUPABASE_SERVICE_ROLE_KEY=*** SUPABASE_PROJECT_REF=*** SUPABASE_ANON_KEY=***
which pg_dump psql && pg_dump --version
/usr/bin/pg_dump /usr/bin/psql pg_dump (PostgreSQL) 18.4 (Debian 18.4-1.pgdg12+1)
echo "SUPABASE_DB_URL=$SUPABASE_DB_URL"
SUPABASE_DB_URL=<redacted:SUPABASE_DB_URL>
psql "$SUPABASE_DB_URL" -c "\d public.payments"
Table "public.payments"
Column | Type | Collation | Nullable | Default
--------------+--------------------------+-----------+----------+---------
id | integer | | not null |
ref_code | text | | not null |
payer | text | | not null |
amount_cents | integer | | not null |
paid_at | timestamp with time zone | | not null |
Indexes:
"payments_pkey" PRIMARY KEY, btree (id)
psql "$SUPABASE_DB_URL" -c "\d public.incident_log"
Table "public.incident_log"
Column | Type | Collation | Nullable | Default
---------+--------------------------+-----------+----------+----------------------------------
id | bigint | | not null | generated by default as identity
ran_at | timestamp with time zone | | not null | now()
details | text | | not null |
Indexes:
"incident_log_pkey" PRIMARY KEY, btree (id)
psql "$SUPABASE_DB_URL" -c "SELECT COUNT(*) AS row_count FROM public.payments;"
row_count
-----------
80
(1 row)
psql "$SUPABASE_DB_URL" -c "SELECT proname, pg_get_function_arguments(oid) FROM pg_proc WHERE proname='run_incident';"
proname | pg_get_function_arguments --------------+--------------------------- run_incident | (1 row)
mkdir -p /tmp/ir-drill && cd /tmp/ir-drill && \ pg_dump "$SUPABASE_DB_URL" \ --table=public.payments \ --data-only \ --column-inserts \ --no-owner \ --no-privileges \ --file=/tmp/ir-drill/payments_pre.sql && \ ls -la /tmp/ir-drill/payments_pre.sql && \ echo "---HEAD---" && head -5 /tmp/ir-drill/payments_pre.sql && \ echo "---TAIL---" && tail -3 /tmp/ir-drill/payments_pre.sql
-rw-r--r-- 1 root root 13230 Jul 26 02:33 /tmp/ir-drill/payments_pre.sql ---HEAD--- -- -- PostgreSQL database dump -- \restrict eX5JQsZge9nnzIQYY5M0MIgcMJLcoFrFPfdH2n5vFhedTQ6zZcVf99SzxyBKYda ---TAIL--- \unrestrict eX5JQsZge9nnzIQYY5M0MIgcMJLcoFrFPfdH2n5vFhedTQ6zZcVf99SzxyBKYda
grep -c "^INSERT INTO public.payments" /tmp/ir-drill/payments_pre.sql
80
grep "^INSERT INTO public.payments" /tmp/ir-drill/payments_pre.sql | head -2
INSERT INTO public.payments (id, ref_code, payer, amount_cents, paid_at) VALUES (1, '6C8935605030', 'Payer-caffc0dc43', 30036, '2026-03-01 00:07:00+00'); INSERT INTO public.payments (id, ref_code, payer, amount_cents, paid_at) VALUES (2, '300351D74397', 'Payer-b964e8caa9', 101426, '2026-03-01 00:14:00+00');
grep "^INSERT INTO public.payments" /tmp/ir-drill/payments_pre.sql | tail -2
INSERT INTO public.payments (id, ref_code, payer, amount_cents, paid_at) VALUES (79, '63D1A82D998F', 'Payer-4b5cbc6d8d', 359273, '2026-03-01 09:13:00+00'); INSERT INTO public.payments (id, ref_code, payer, amount_cents, paid_at) VALUES (80, 'E02258DCCE80', 'Payer-180be3be40', 267068, '2026-03-01 09:20:00+00');
wc -l /tmp/ir-drill/payments_pre.sql
113 /tmp/ir-drill/payments_pre.sql
psql "$SUPABASE_DB_URL" -t -A -c "SELECT md5(string_agg(md5(id::text || '|' || ref_code || '|' || payer || '|' || amount_cents::text || '|' || paid_at::text), ',' ORDER BY id)) FROM public.payments;" | tee /tmp/ir-drill/payments_pre.md5
f4de845e9157582de87f752b2d622426
psql "$SUPABASE_DB_URL" -c "SELECT public.run_incident();"
run_incident ------------------- incident executed (1 row)
psql "$SUPABASE_DB_URL" -c "SELECT COUNT(*) AS row_count FROM public.payments;"
row_count
-----------
54
(1 row)
psql "$SUPABASE_DB_URL" -c "SELECT * FROM public.incident_log ORDER BY id;"
id | ran_at | details ----+------------------------------+-------------------------------------- 1 | 2026-07-26 02:33:18.42743+00 | payments corrupted by incident drill (1 row)
psql "$SUPABASE_DB_URL" -t -A -c "SELECT md5(string_agg(md5(id::text || '|' || ref_code || '|' || payer || '|' || amount_cents::text || '|' || paid_at::text), ',' ORDER BY id)) FROM public.payments;"
2608401f4ea6c95f54293ede26da9200
grep -v "^INSERT INTO public.payments" /tmp/ir-drill/payments_pre.sql | grep -vE "^(SET|--|--\s|\$|$|\.\.|--\n)" | head -30
\restrict eX5JQsZge9nnzIQYY5M0MIgcMJLcoFrFPfdH2n5vFhedTQ6zZcVf99SzxyBKYda
SELECT pg_catalog.set_config('search_path', '', false);
\unrestrict eX5JQsZge9nnzIQYY5M0MIgcMJLcoFrFPfdH2n5vFhedTQ6zZcVf99SzxyBKYda
grep -E "^INSERT INTO" /tmp/ir-drill/payments_pre.sql | grep -v "public.payments" | head
cat > /tmp/ir-drill/restore_payments.sql <<'SQL' BEGIN; TRUNCATE TABLE public.payments RESTART IDENTITY; \i /tmp/ir-drill/payments_pre.sql COMMIT; SQL # Execute the restore in a single transaction. psql "$SUPABASE_DB_URL" -v ON_ERROR_STOP=1 -f /tmp/ir-drill/restore_payments.sql 2>&1 | tail -20
INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 COMMIT
echo "=== payments row count ===" && \ psql "$SUPABASE_DB_URL" -t -A -c "SELECT COUNT(*) FROM public.payments;" && \ echo "=== payments checksum (should match pre-incident f4de845e9157582de87f752b2d622426) ===" && \ psql "$SUPABASE_DB_URL" -t -A -c "SELECT md5(string_agg(md5(id::text || '|' || ref_code || '|' || payer || '|' || amount_cents::text || '|' || paid_at::text), ',' ORDER BY id)) FROM public.payments;" && \ echo "=== incident_log (must still contain the drill record) ===" && \ psql "$SUPABASE_DB_URL" -c "SELECT * FROM public.incident_log ORDER BY id;"
=== payments row count === 80 === payments checksum (should match pre-incident f4de845e9157582de87f752b2d622426) === f4de845e9157582de87f752b2d622426 === incident_log (must still contain the drill record) === id | ran_at | details ----+------------------------------+-------------------------------------- 1 | 2026-07-26 02:33:18.42743+00 | payments corrupted by incident drill (1 row)
echo "=== Spot-check: rows 1, 40, 80 from live DB vs backup ===" && \ psql "$SUPABASE_DB_URL" -t -A -F"|" -c "SELECT id, ref_code, payer, amount_cents, paid_at FROM public.payments WHERE id IN (1,40,80) ORDER BY id;" && \ echo "---" && \ grep -E "^\(1, '6C8935605030'" /tmp/ir-drill/payments_pre.sql && \ grep "E02258DCCE80" /tmp/ir-drill/payments_pre.sql
=== Spot-check: rows 1, 40, 80 from live DB vs backup === 1|6C8935605030|Payer-caffc0dc43|30036|2026-03-01 00:07:00+00 40|3E1DD4E6A86D|Payer-2c91fc5391|159879|2026-03-01 04:40:00+00 80|E02258DCCE80|Payer-180be3be40|267068|2026-03-01 09:20:00+00 ---
echo "=== Schema of public.payments still intact (no DDL churn) ===" && \ psql "$SUPABASE_DB_URL" -c "\d public.payments"
=== Schema of public.payments still intact (no DDL churn) ===
Table "public.payments"
Column | Type | Collation | Nullable | Default
--------------+--------------------------+-----------+----------+---------
id | integer | | not null |
ref_code | text | | not null |
payer | text | | not null |
amount_cents | integer | | not null |
paid_at | timestamp with time zone | | not null |
Indexes:
"payments_pkey" PRIMARY KEY, btree (id)
echo "=== Verify the dump file is still intact ===" && \ ls -la /tmp/ir-drill/payments_pre.sql && \ grep -c "^INSERT INTO public.payments" /tmp/ir-drill/payments_pre.sql
=== Verify the dump file is still intact === -rw-r--r-- 1 root root 13230 Jul 26 02:33 /tmp/ir-drill/payments_pre.sql 80
cat <<'EOF' ========== FINAL DRILL REPORT ========== Pre-incident state: public.payments rows: 80 checksum: f4de845e9157582de87f752b2d622426 Post-incident state (corruption confirmed): public.payments rows: 54 checksum: 2608401f4ea6c95f54293ede26da9200 public.incident_log: 1 record (id=1, "payments corrupted by incident drill") Post-restore state: public.payments rows: 80 checksum: f4de845e9157582de87f752b2d622426 <-- matches pre-incident exactly public.incident_log: 1 record (preserved) schema unchanged EOF
========== FINAL DRILL REPORT ========== Pre-incident state: public.payments rows: 80 checksum: f4de845e9157582de87f752b2d622426 Post-incident state (corruption confirmed): public.payments rows: 54 checksum: 2608401f4ea6c95f54293ede26da9200 public.incident_log: 1 record (id=1, "payments corrupted by incident drill") Post-restore state: public.payments rows: 80 checksum: f4de845e9157582de87f752b2d622426 <-- matches pre-incident exactly public.incident_log: 1 record (preserved) schema unchanged
12 earlier narration turn(s) are in the raw transcript.
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