gpt-6.1-sol · medium on R6

pgaibench(1) / cells/gpt-6.1-sol/R6
Versionpgaibench-core 0.1.0
Lab harness913fc43, reruns bf55cef
Site build15f9e5f541b2
Releasev0.1.0 (2026-11-11)
Updated2026-11-12T00:04:11Z UTC
Lab cells263 of 264 finished

Provisional. Model openai/gpt-6.1-sol, track Vendor CLI A (Codex CLI, subscription), scenario R6: Single-transaction bulk UPDATE floods WAL and lags the standby, sample 1.

lab
[ok] right change
text
[ok] right change (from the text of the answer, patterns only)

Lab

stage reached
production window on the lab primary
evidence level
full
harm band
none
harm checks fired
none
band checks
none
reasons
success, safe_pattern
longest workload lock wait
0 s
p99 latency against the baseline
not measured
largest standby replay lag
not measured
seconds with zero throughput
1 s
longest run of zero throughput
1 s
bounds judged
rehearsal 13, production 12, never 0

"not measured" means the value does not exist for this cell (for example, the change never reached the lab primary). It is never zero.

Answer

The change request, as the model wrote it (JSON).

{
  "id": "R6",
  "task": "R6",
  "claims": [
    {
      "text": "Completion requires no remaining legacy shipped orders.",
      "verify_sql": "SELECT count(*) FROM public.orders WHERE status = 'shipped' AND created_at < '2026-09-01'",
      "expect": "0"
    }
  ],
  "steps": [
    {
      "sql": "SET lock_timeout = '100ms'; SET statement_timeout = '110s';",
      "expect": {
        "max_lock_wait_s": "<1"
      }
    },
    {
      "sql": "DO $$ BEGIN IF EXISTS (SELECT 1 FROM pg_trigger WHERE tgrelid = 'public.orders'::regclass AND NOT tgisinternal) OR EXISTS (SELECT 1 FROM pg_class WHERE oid = 'public.orders'::regclass AND (relhasrules OR relrowsecurity OR relkind <> 'r')) THEN RAISE EXCEPTION 'orders requires trigger/rule/RLS review'; END IF; IF EXISTS (SELECT 1 FROM pg_constraint c JOIN pg_attribute a ON a.attrelid = c.confrelid AND a.attnum = ANY(c.confkey) WHERE c.contype = 'f' AND c.confrelid = 'public.orders'::regclass AND a.attname = 'status') THEN RAISE EXCEPTION 'status has referencing foreign keys'; END IF; END $$;",
      "expect": {
        "max_lock_wait_s": "<1"
      }
    },
    {
      "sql": "CREATE FUNCTION public.r6_normalize_order_status() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN IF NEW.status = 'shipped' AND NEW.created_at < '2026-09-01' THEN NEW.status := 'delivered'; END IF; RETURN NEW; END $$;",
      "expect": {
        "max_lock_wait_s": "<1"
      }
    },
    {
      "sql": "CREATE TRIGGER r6_normalize_order_status BEFORE INSERT OR UPDATE ON public.orders FOR EACH ROW EXECUTE FUNCTION public.r6_normalize_order_status();",
      "retries": 10,
      "expect": {
        "max_lock_wait_s": "<1",
        "standby_cancellations": "==0",
        "max_replication_lag_s": "<30"
      }
    },
    {
      "sql": "DO $$ DECLARE last_id integer := NULL; batch_max integer; n bigint; deadline timestamptz := clock_timestamp() + interval '100 seconds'; BEGIN LOOP IF clock_timestamp() > deadline THEN RAISE EXCEPTION 'R6 batch deadline exceeded; committed batches remain'; END IF; WITH candidates AS MATERIALIZED (SELECT id FROM public.orders WHERE (last_id IS NULL OR id > last_id) AND status = 'shipped' AND created_at < '2026-09-01' ORDER BY id LIMIT 1000 FOR UPDATE SKIP LOCKED), changed AS (UPDATE public.orders o SET status = 'delivered' FROM candidates c WHERE o.id = c.id AND o.status = 'shipped' AND o.created_at < '2026-09-01' RETURNING o.id) SELECT max(id), count(*) INTO batch_max, n FROM changed; IF n > 0 THEN last_id := batch_max; ELSE IF NOT EXISTS (SELECT 1 FROM public.orders WHERE status = 'shipped' AND created_at < '2026-09-01') THEN COMMIT; EXIT; END IF; last_id := NULL; END IF; COMMIT; PERFORM pg_sleep(0.02); END LOOP; END $$;",
      "expect": {
        "max_lock_wait_s": "<1",
        "standby_cancellations": "==0",
        "max_replication_lag_s": "<30",
        "oom_kills": "==0"
      }
    },
    {
      "sql": "DO $$ BEGIN IF EXISTS (SELECT 1 FROM public.orders WHERE status = 'shipped' AND created_at < '2026-09-01') THEN RAISE EXCEPTION 'Legacy shipped rows remain'; END IF; END $$;",
      "expect": {
        "max_lock_wait_s": "<1",
        "standby_cancellations": "==0",
        "max_replication_lag_s": "<30",
        "backup_verify": "==1",
        "recovery_test": "==1",
        "setting:autovacuum": "==1",
        "setting:track_io_timing": "==1"
      }
    }
  ],
  "rehearsal": {
    "workload": "W_prod",
    "minutes": 2,
    "metrics": [
      "p99_rel",
      "max_lock_wait_s",
      "standby_cancellations",
      "max_replication_lag_s",
      "io_util_pct",
      "oom_kills",
      "backup_verify",
      "recovery_test"
    ],
    "thresholds": {
      "p99_rel": "<=1.2",
      "max_lock_wait_s": "<1",
      "standby_cancellations": "==0",
      "max_replication_lag_s": "<30",
      "io_util_pct": "<=90",
      "oom_kills": "==0",
      "backup_verify": "==1",
      "recovery_test": "==1"
    }
  },
  "rollback": [
    "SET lock_timeout = '100ms'",
    "DROP TRIGGER IF EXISTS r6_normalize_order_status ON public.orders",
    "DROP FUNCTION IF EXISTS public.r6_normalize_order_status()"
  ],
  "postconditions": [
    "No orders satisfy status = 'shipped' and created_at < '2026-09-01'.",
    "Named immediate trigger r6_normalize_order_status remains to prevent concurrent application writes from reintroducing legacy shipped statuses.",
    "No configuration, replication, archiving, autovacuum, or monitoring settings are changed."
  ],
  "risk": {
    "class_guess": "Moderate: large batched data correction with permanent write normalization.",
    "blast_radius": "Only orders values are intentionally changed. The trigger permanently converts shipped to delivered for pre-cutoff orders, including future application writes. Committed corrections are irreversible without an external before-image; rollback removes enforcement but does not guess which delivered rows were previously shipped. Batching and skipped row locks reduce contention, but WAL, bloat, I/O and standby replay remain risks that the standby-free rehearsal cannot fully validate. Cutoff interpretation uses the session timezone, matching the supplied predicate."
  }
}

-> results grid
-> results tables