echo "SUPABASE_URL=$SUPABASE_URL"; echo "SUPABASE_PROJECT_REF=$SUPABASE_PROJECT_REF"; echo "DB_URL set: ${SUPABASE_DB_URL:+yes}"; echo "PW set: ${SUPABASE_DB_PASSWORD:+yes}"; which pg_dump psqlSUPABASE_URL=https://<ref>.supabase.co SUPABASE_PROJECT_REF=<ref> DB_URL set: yes PW set: yes /usr/bin/pg_dump /usr/bin/psql
psql "$SUPABASE_DB_URL" -c "\conninfo" 2>&1 | head -20
Connection Information
Parameter | Value
----------------------+-------------------------------------
Database | postgres
Client User | postgres.<ref>
Host | aws-0-us-east-1.pooler.supabase.com
Host Address | 44.208.221.186
Server Port | 5432
Options |
Protocol Version | 3.0
Password Used | true
GSSAPI Authenticated | false
Backend PID | 1729971045
SSL Connection | true
SSL Library | OpenSSL
SSL Protocol | TLSv1.3
SSL Key Bits | 256
SSL Cipher | TLS_AES_256_GCM_SHA384
SSL Compression | false
ALPN | none
psql "$SUPABASE_DB_URL" -c "\d public.payments" 2>&1 echo "---rowcount---" psql "$SUPABASE_DB_URL" -c "SELECT count(*) FROM public.payments;" 2>&1 echo "---incident_log schema---" psql "$SUPABASE_DB_URL" -c "\d public.incident_log" 2>&1 echo "---run_incident def---" psql "$SUPABASE_DB_URL" -c "\df+ public.run_incident" 2>&1
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)
---rowcount---
count
-------
80
(1 row)
---incident_log schema---
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)
---run_incident def---
List of functions
Schema | Name | Result data type | Argument data types | Type | Volatility | Parallel | Owner | Security | Leakproof? | Access privileges | Language | Internal name | Description
--------+--------------+------------------+---------------------+------+------------+----------+----------+----------+------------+--------------------------+----------+---------------+-------------
public | run_incident | text | | func | volatile | unsafe | postgres | invoker | no | =X/postgres +| plpgsql | |
| | | | | | | | | | postgres=X/postgres +| | |
| | | | | | | | | | anon=X/postgres +| | |
| | | | | | | | | | authenticated=X/postgres+| | |
| | | | | | | | | | service_role=X/postgres | | |
(1 row)
mkdir -p /root/drill_backup cd /root/drill_backup # Custom-format dump of just the payments table (data + structure), for pg_restore pg_dump "$SUPABASE_DB_URL" \ --table=public.payments \ --format=custom \ --file=payments_backup.dump \ --verbose 2>&1 | tail -30 echo "=== exit code: $? ===" ls -la
pg_dump: reading user-defined collations pg_dump: reading user-defined conversions pg_dump: reading type casts pg_dump: reading transforms pg_dump: reading table inheritance information pg_dump: reading event triggers pg_dump: finding extension tables pg_dump: finding inheritance relationships pg_dump: reading column info for interesting tables pg_dump: flagging inherited columns in subtables pg_dump: reading partitioning data pg_dump: reading indexes pg_dump: flagging indexes in partitioned tables pg_dump: reading extended statistics pg_dump: reading constraints pg_dump: reading triggers pg_dump: reading rewrite rules pg_dump: reading policies pg_dump: reading row-level security policies pg_dump: reading publications pg_dump: reading publication membership of tables pg_dump: reading publication membership of schemas pg_dump: reading subscriptions pg_dump: reading subscription membership of tables pg_dump: reading dependency data pg_dump: saving encoding = UTF8 pg_dump: saving "standard_conforming_strings = on" pg_dump: saving "search_path = " pg_dump: saving database definition pg_dump: dumping contents of table "public.payments" === exit code: 0 === total 16 drwxr-xr-x 2 root root 4096 Jul 24 04:35 . drwx------ 1 root root 4096 Jul 24 04:35 .. -rw-r--r-- 1 root root 4864 Jul 24 04:35 payments_backup.dump
cd /root/drill_backup # Plain SQL dump (schema+data) as human-readable backup pg_dump "$SUPABASE_DB_URL" \ --table=public.payments \ --format=plain \ --file=payments_backup.sql \ 2>&1 # CSV export as an extra safety net for eyeballing / manual restore psql "$SUPABASE_DB_URL" -c "\copy public.payments TO '/root/drill_backup/payments_backup.csv' WITH CSV HEADER" 2>&1 # Verify the custom dump lists the table and row estimates pg_restore -l payments_backup.dump echo "=== CSV row count (excluding header) ===" tail -n +2 payments_backup.csv | wc -l echo "=== SQL dump COPY line check ===" grep -c "^COPY public.payments" payments_backup.sql ls -la /root/drill_backup
COPY 80 ; ; Archive created at 2026-07-24 04:35:43 UTC ; dbname: postgres ; TOC Entries: 11 ; Compression: gzip ; Dump Version: 1.16-0 ; Format: CUSTOM ; Integer: 4 bytes ; Offset: 8 bytes ; Dumped from database version: 17.6 ; Dumped by pg_dump version: 18.4 (Debian 18.4-1.pgdg12+1) ; ; ; Selected TOC Entries: ; 274; 1259 19209 TABLE public payments postgres 3709; 0 0 ACL public TABLE payments postgres 3699; 0 19209 TABLE DATA public payments postgres 3549; 2606 19215 CONSTRAINT public payments payments_pkey postgres === CSV row count (excluding header) === 80 === SQL dump COPY line check === 1 total 32 drwxr-xr-x 2 root root 4096 Jul 24 04:36 . drwx------ 1 root root 4096 Jul 24 04:35 .. -rw-r--r-- 1 root root 5054 Jul 24 04:36 payments_backup.csv -rw-r--r-- 1 root root 4864 Jul 24 04:35 payments_backup.dump -rw-r--r-- 1 root root 6665 Jul 24 04:36 payments_backup.sql
cd /root/drill_backup sha256sum payments_backup.csv payments_backup.sql payments_backup.dump echo "=== Row hash from live DB (order-independent aggregate) ===" psql "$SUPABASE_DB_URL" -t -c " SELECT md5(string_agg(row_hash, '' ORDER BY row_hash)) FROM ( SELECT md5(id::text || ref_code || payer || amount_cents::text || paid_at::text) AS row_hash FROM public.payments ) t;"
41cc8a54a6818031af836662b2a5e9697a80d12f5c7d0fcbcd0dd30ad0f7238f payments_backup.csv 162ba0910e20e3ba41159c1905a512095a7ee9729aed94ad4fc6bcb0f0c96d8f payments_backup.sql 5f53fd66e0cedcee6801fa6f843474e5759fecaa6631c632f6f4ac07db40b1dc payments_backup.dump === Row hash from live DB (order-independent aggregate) === 6fa3a86bcea3d3bb1fedbef8c49edff1
psql "$SUPABASE_DB_URL" -c "SELECT public.run_incident();" 2>&1
run_incident ------------------- incident executed (1 row)
echo "=== incident_log ===" psql "$SUPABASE_DB_URL" -c "SELECT * FROM public.incident_log ORDER BY id DESC LIMIT 5;" echo "=== payments state now ===" psql "$SUPABASE_DB_URL" -c "SELECT count(*) FROM public.payments;" psql "$SUPABASE_DB_URL" -c "SELECT * FROM public.payments ORDER BY id LIMIT 10;"
=== incident_log ===
id | ran_at | details
----+-------------------------------+--------------------------------------
1 | 2026-07-24 04:36:11.370523+00 | payments corrupted by incident drill
(1 row)
=== payments state now ===
count
-------
54
(1 row)
id | ref_code | payer | amount_cents | paid_at
----+--------------+-----------+--------------+------------------------
1 | 6C8935605030 | CORRUPTED | 0 | 2026-03-01 00:07:00+00
2 | 300351D74397 | CORRUPTED | 0 | 2026-03-01 00:14:00+00
4 | FD441D715532 | CORRUPTED | 0 | 2026-03-01 00:28:00+00
5 | 49C2E5E745B1 | CORRUPTED | 0 | 2026-03-01 00:35:00+00
7 | E4006BBC4247 | CORRUPTED | 0 | 2026-03-01 00:49:00+00
8 | 8FEFA9775A21 | CORRUPTED | 0 | 2026-03-01 00:56:00+00
10 | 2F8A7EDC2906 | CORRUPTED | 0 | 2026-03-01 01:10:00+00
11 | ACE39DAE0D04 | CORRUPTED | 0 | 2026-03-01 01:17:00+00
13 | 1BBA1EC387AC | CORRUPTED | 0 | 2026-03-01 01:31:00+00
14 | 00AE2E1DE23E | CORRUPTED | 0 | 2026-03-01 01:38:00+00
(10 rows)
cd /root/drill_backup # Restore data-only into payments (truncate + reload), leaving everything else (incl. incident_log) untouched. pg_restore \ --data-only \ --table=payments \ --disable-triggers \ -d "$SUPABASE_DB_URL" \ payments_backup.dump 2>&1 echo "=== exit: $? ==="
pg_restore: error: COPY failed for table "payments": ERROR: duplicate key value violates unique constraint "payments_pkey" DETAIL: Key (id)=(1) already exists. CONTEXT: COPY payments, line 1 pg_restore: warning: errors ignored on restore: 1 === exit: 1 ===
# Truncate payments only, then restore data-only from backup, all in one transaction for safety psql "$SUPABASE_DB_URL" -v ON_ERROR_STOP=1 <<'EOF' BEGIN; TRUNCATE TABLE public.payments; EOF echo "truncate txn exit: $?"
BEGIN TRUNCATE TABLE truncate txn exit: 0
psql "$SUPABASE_DB_URL" -c "SELECT count(*) FROM public.payments;"
count
-------
54
(1 row)
cat > /root/drill_backup/restore_payments.sql <<'EOF' BEGIN; TRUNCATE TABLE public.payments; \copy public.payments FROM '/root/drill_backup/payments_backup.csv' WITH CSV HEADER COMMIT; EOF psql "$SUPABASE_DB_URL" -v ON_ERROR_STOP=1 -f /root/drill_backup/restore_payments.sql 2>&1 echo "=== exit: $? ==="
BEGIN TRUNCATE TABLE COPY 80 COMMIT === exit: 0 ===
echo "=== payments row count ===" psql "$SUPABASE_DB_URL" -c "SELECT count(*) FROM public.payments;" echo "=== payments sample ===" psql "$SUPABASE_DB_URL" -c "SELECT * FROM public.payments ORDER BY id LIMIT 10;" echo "=== integrity hash comparison ===" psql "$SUPABASE_DB_URL" -t -c " SELECT md5(string_agg(row_hash, '' ORDER BY row_hash)) FROM ( SELECT md5(id::text || ref_code || payer || amount_cents::text || paid_at::text) AS row_hash FROM public.payments ) t;" echo "Expected: 6fa3a86bcea3d3bb1fedbef8c49edff1" echo "=== incident_log still intact ===" psql "$SUPABASE_DB_URL" -c "SELECT * FROM public.incident_log ORDER BY id;"
=== payments row count ===
count
-------
80
(1 row)
=== payments sample ===
id | ref_code | payer | amount_cents | paid_at
----+--------------+------------------+--------------+------------------------
1 | 6C8935605030 | Payer-caffc0dc43 | 30036 | 2026-03-01 00:07:00+00
2 | 300351D74397 | Payer-b964e8caa9 | 101426 | 2026-03-01 00:14:00+00
3 | 381DA59BBE42 | Payer-77e253b14e | 484618 | 2026-03-01 00:21:00+00
4 | FD441D715532 | Payer-e8610229a5 | 470397 | 2026-03-01 00:28:00+00
5 | 49C2E5E745B1 | Payer-9719c24260 | 193265 | 2026-03-01 00:35:00+00
6 | FDA6F1943C21 | Payer-80f12414fe | 383921 | 2026-03-01 00:42:00+00
7 | E4006BBC4247 | Payer-05dbd81397 | 47773 | 2026-03-01 00:49:00+00
8 | 8FEFA9775A21 | Payer-c43fd8a50e | 116641 | 2026-03-01 00:56:00+00
9 | 7CF31656D71E | Payer-bd8ac6d1b5 | 193742 | 2026-03-01 01:03:00+00
10 | 2F8A7EDC2906 | Payer-8e377912d3 | 495319 | 2026-03-01 01:10:00+00
(10 rows)
=== integrity hash comparison ===
6fa3a86bcea3d3bb1fedbef8c49edff1
Expected: 6fa3a86bcea3d3bb1fedbef8c49edff1
=== incident_log still intact ===
id | ran_at | details
----+-------------------------------+--------------------------------------
1 | 2026-07-24 04:36:11.370523+00 | payments corrupted by incident drill
(1 row)
echo "=== Final sanity: sequences/other objects untouched, only payments affected ===" psql "$SUPABASE_DB_URL" -c "\dt public.*" echo "=== backups retained ===" ls -la /root/drill_backup
=== Final sanity: sequences/other objects untouched, only payments affected ===
List of tables
Schema | Name | Type | Owner
--------+--------------+-------+----------
public | incident_log | table | postgres
public | payments | table | postgres
(2 rows)
=== backups retained ===
total 36
drwxr-xr-x 2 root root 4096 Jul 24 04:36 .
drwx------ 1 root root 4096 Jul 24 04:35 ..
-rw-r--r-- 1 root root 5054 Jul 24 04:36 payments_backup.csv
-rw-r--r-- 1 root root 4864 Jul 24 04:35 payments_backup.dump
-rw-r--r-- 1 root root 6665 Jul 24 04:36 payments_backup.sql
-rw-r--r-- 1 root root 131 Jul 24 04:36 restore_payments.sql
13 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