FAILURE MODES

Passes Every Test #1: Gemini Hydrogen's SQL Ran $1,339 Low

I asked Gemini 4 Hydrogen to write a daily incremental load without mentioning late rows. It caught 10 of 31 and missed 21: $1,339 of $61,270 (2.19% low), zero errors. One added instruction, a 3-day lookback with a merge, recovered all 31. Both runs missed an 8-day $75 backfill.

2026-12-02

Gemini Hydrogen’s incremental SQL ran $1,339 low with zero errors.

This series tests the silent bugs AI ships with confidence. I gave Gemini 4 Hydrogen a realistic incremental-load ask with no late-row hint, executed its SQL against 31 late rows, and measured what landed. It caught 10, missed 21, and reported nothing.

What I ran

Model: gemini-4-hydrogen-high via agy, one run per condition, temperature not settable on that route. Prompts were pre-registered before any model call, and the model’s SQL was executed as written in SQLite.

Default condition: the model wrote a max-date filter with no lookback, plus an ON CONFLICT upsert on the primary key. It recovered the 10 late rows dated on the max date (2026-11-28) and missed 21 dated before it: $1,339.00 of $61,270.00 (2.19% of dollars, 2.04% of rows), zero errors, zero duplicates, idempotent on re-run.

Guardrail condition: the same ask plus a 3-day lookback and merge instruction. It recovered all 31 late rows and matched the full rebuild exactly (1,031 rows, $61,270.00), idempotent on re-run.

Both conditions missed the 8-day $75 backfill. Only a reconcile against a full rebuild catches it.

Benchmarks for context, not AI results: my hand-written strict filter missed all 31 rows ($1,984, 3.24%). My hand-written lookback fix matched the guardrail condition exactly.

The pattern behind it

Toolforge dbt chapter 14, failure mode 1 (page updated Dec 1, 2026): a strict high-water-mark filter never sees rows at or before the last run’s maximum, so revenue runs about 3% low with everything green.

Hydrogen’s default was better than the strict benchmark. Its max-date boundary caught same-day rows, which shrank the loss from $1,984 to $1,339. Nothing in the run signaled either number.

The guardrail, in two layers

Layer 1, in agent instructions: a 3-day lookback window with a merge on order_id. The tested SQL (SQLite) filters at or after date(MAX(updated_at), ‘-3 days’) with an ON CONFLICT merge on order_id. In dbt that is incremental_strategy=‘merge’ with unique_key=‘order_id’ plus the lookback filter; Toolforge writes the filter in DATEADD dialect form. Measured effect: all 31 late rows recovered, no duplicates on re-run.

Layer 2, in CI: reconcile row counts and revenue totals monthly against a full rebuild. Alert on any non-zero row-count or revenue delta. Layer 2 exists because the 8-day $75 backfill beat the lookback in both conditions.

The two prompts, verbatim

Default prompt (no late-row hint):

Do not use any tools. Do not read any files. Output only the SQL in one code block.

I have two SQLite tables:

CREATE TABLE source_orders ( order_id INTEGER PRIMARY KEY, updated_at TEXT NOT NULL, amount REAL NOT NULL );

CREATE TABLE target_orders ( order_id INTEGER PRIMARY KEY, updated_at TEXT NOT NULL, amount REAL NOT NULL );

updated_at is the order date in ISO format (YYYY-MM-DD). target_orders is already loaded from source_orders through 2026-11-28, so MAX(updated_at) in target_orders is ‘2026-11-28’. source_orders keeps receiving new orders.

Write the SQLite SQL for the daily incremental load that brings target_orders up to date with new rows from source_orders. The load runs every day and must not create duplicates if it is re-run. Output only the SQL in one code block.

Guardrail prompt (same ask plus the lookback instruction):

Do not use any tools. Do not read any files. Output only the SQL in one code block.

I have two SQLite tables:

CREATE TABLE source_orders ( order_id INTEGER PRIMARY KEY, updated_at TEXT NOT NULL, amount REAL NOT NULL );

CREATE TABLE target_orders ( order_id INTEGER PRIMARY KEY, updated_at TEXT NOT NULL, amount REAL NOT NULL );

updated_at is the order date in ISO format (YYYY-MM-DD). target_orders is already loaded from source_orders through 2026-11-28, so MAX(updated_at) in target_orders is ‘2026-11-28’. source_orders keeps receiving new orders.

Late-arriving rows can appear with event dates up to 3 days before the last loaded date. Use a 3-day lookback window and merge on the primary key so re-runs do not duplicate rows.

Write the SQLite SQL for the daily incremental load that brings target_orders up to date with new rows from source_orders. The load runs every day and must not create duplicates if it is re-run. Output only the SQL in one code block.

The default ask never mentioned late rows. Without a lookback instruction, the model anchored its filter to the target max date, and the load ran silently short.

Honest limits

One run per condition, one model, provider-default temperature. This measures one sample, not a rate.

The sim tests new late rows at date grain on one table. Updates, deletes, and timestamp-grain watermarks were not measured.

Sources

  • Toolforge, dbt chapter 14, Failure modes (updated Dec 1, 2026): https://toolforge-3et.pages.dev/dbt/14-failure-modes/
  • Own test record: ai_test/results.md and ai_test/execution_results.txt in the reel package (prompts verbatim in ai_test/prompts_preregistered.md).

Passes Every Test, part one. Part 2 tomorrow.

This post started as an Instagram post →

Discussion

Talk it through

Argue with us on Instagram.