Repository navigation
Conversation
…ses in resolve-database-006 (CLI-2733)
…rtions in resolve-database-006 (CLI-2733)
…e-database-006 (CLI-2733)
… inserts in resolve-database-006 (CLI-2733)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…abase-006 report ground truth (CLI-2733)
…val-fix-a-failing-pgtap-suite-by-iterating-db-reset-and # Conflicts: # evals/cli/lib/README.md
…olve-database-006 (CLI-2733)
Coly010
marked this pull request as ready for review
October 26, 2026 13:10
…-2733) The harness now runs supabase start before the agent (projectRunning: true), so the seeded suite is red on the first test db and the agent has to fix the migration, re-apply it through the CLI and re-run the suite. nodaemon and absent skip the eval. Adds a testDbFailedFirst metric, tells the report judge the harness started the stack, and renames project_id to sandbox-invoices-app so the harness's leftover sweep covers it.
…-006 (CLI-2733) Both arms now skip the eval, so merge refreshes never replace their old rows.
avallete
reviewed
Oct 26, 2026
avallete
left a comment
Member
There was a problem hiding this comment.
Cross-review (Codex gpt-6-sol, verified by Claude): grader false-pass/false-fail findings inline.
…database-006 test additions (CLI-2733)
An added assertion whose description mentions a state-changing word
("cannot delete a paid invoice") was rejected. The guard now scans the
statement with literals masked, plus the raw body of any literal that
starts with a Postgres command word, since pgTAP runs those as SQL.
findTestDbRuns kept only the last summary per tool call, so a whole-suite pass followed by a single-file rerun in one call read as a one-file run. It now also returns every summary in order (readPgProveSummaries), and resolve-database-006's test db check, testDbFailedFirst metric and report ground truth walk them in order.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current Behavior
There's no eval for the loop agents spend most of their time in with database tests: the suite fails, find the cause, fix the migration, re-apply, re-run
supabase test db. In a 1% PostHog device sample over Sep 15 to Oct 14,test db → db reset → test dbappears in about 2,100 sessions, and 78% of them hit a non-zero exit. CLI-2710 covers writing tests; nothing covers fixing a red suite.Expected Behavior
Adds
evals/cli/resolve-database-006-fix-failing-pgtap-suite(CLI-2733). The prompt says the database tests broke after yesterday's discounts change and asks the agent to get them passing again and leave the database running. It names no command, file, column or function, and it's the same under everycodex-gpt-6-luna-cli-*experiment that runs it.The seeded project (
local/) has two migrations and a two-file pgTAP suite. The second migration, yesterday's change, has two bugs that mask each other: anot nulldiscount column with no default (one test file stops at its first insert), and a total that sums the discount instead of what's left (three totals wrong). Fixing only the first turns the insert error into a wrong total. Valid fixes are an in-place edit plusdb reset, or a new fix migration plusmigration up, with either a default of 0 or a nullable column andcoalesce.The harness pre-starts the stack (
projectRunning: true), so both bugs are live when the agent starts and its firstsupabase test dbprintsFiles=2, Tests=6, Result: FAIL. The agent has to fix the migration, get it into the database through the CLI and re-run the suite. An earlier revision started with the stack stopped; agents then fixed the migration by reading it before the firstsupabase start, and only 5 of 36 Docker runs ever saw a red suite (see Results).select 1; a guard that the agent left it running, since the harness started ittest dbsummary (every one a call printed, in order) wasResult: PASSfor the whole suite (Files=of at least 2, or a run with no path or--db-urlargument), and any laterResult: FAILwas cleared by a later whole-suitePASSschema_migrationsstatements equal each file now, so the fix reached the DB through the CLI (not left unapplied or run withpsql -f)test dbruns and results,testDbFailedFirst(did the agent see the suite red before fixing it), reset /migration upcounts, migration file changes,pgProveDirect,cliDetourstest dbsummary; it fails false claims, not omissionsNotes
evals/cli/lib/pgtap.ts(TAP parsing, pg_prove summary,supabase test dbrun detection), generalised frominvestigate-database-002-rls-policy-tests, with its own tests and a line inevals/cli/lib/README.md. That eval's folder is untouched; moving it onto the shared module is a follow-up.todo/skip, DDL,set,update,do, inserts into pgTAP's own tables or for the seeded invoices) is counted as a modification. The scan covers the code outside literals and any literal pgTAP could run as SQL (one that starts with a command word), solives_ok($$alter table …$$)is caught and a description like'cannot delete a paid invoice'isn't. A description that itself starts with a command word is still a false positive; the README lists that and the residual (SQL assembled at run time or hidden behindE''escapes).test db, live and rebuilt-database. nodaemon and absent skip the eval, since they can't pre-start a stack.project_idissandbox-invoices-app, so the harness's leftover sweep (which matches thesandbox-prefix) cleans up a crashed run's stack.auth/storage), so the seed uses none. The history check can't tell a fix migration applied by hand and then marked applied withmigration repairfrommigration up; the end state is the same. Both are in the README's known limitations.Verified locally
supabase/pg_prove:3.36image andsupabase/postgres17: seededFiles=2, Tests=6, Result: FAIL; default only fixedFiles=2, Tests=9, Result: FAIL; both fixedFiles=2, Tests=9, Result: PASS.migration up, a hand-patched DB, and a new fix migration applied withpsql -feach pass or fail the expected checks. Re-applying the in-place fixed file withpsql -fon the pre-started database errors on the existing column, so that path fails the live check as well as history.schema_migrations.statementsformat is identical on 2.117.0 and 3.0.0-next.23; next'stest dbprints the same plain pg_prove summary in agent mode.pnpm format:check,pnpm typecheckand the eval's tests pass.pnpm teststops attest:frameworklocally for lack of a judge key.evals/cli/lib); the only conflict wasevals/cli/lib/README.md, where both additions are kept.Results
Three refreshes on the pre-started stack, 3 runs per environment each: 40332677144 at 4a35927 (the switch), 40334537287 at e609c87 (the stale results cleanup) and 40354332826 at 65e1fe5 (the review fixes).
In 33 of 36 runs the agent saw the suite red under
supabase test db(testDbFailedFirst), fixed the migration, and ran it again until it printedFiles=2, Tests=9, Result: PASS. On the stopped stack, 5 of 36 Docker runs did that.I checked the commands and check notes of all 36 runs, and read every failing transcript. No false fails or false passes. All 15 failures are the history check, and in each one the agent put the fix into the database by hand:
psqlorsupabase db query, so the history still records the old statements.migration upon the empty filemigration newhad just created, then applied the fix withpsql, so the new migration is recorded with no statements.The 21 passes all have a new fix migration whose recorded statements match the file, and the rebuilt database passes. 20 applied it with
migration up. One (stable, e609c87 run 3) ran it withsupabase db query --fileand thenmigration repair --status applied, which ends in the same state; that path is listed in the README's known limitations. No run useddb reset.The stale nodaemon and absent rows for this eval are dropped from
apps/web/src/data/cli-eval-results.jsonin e609c87. Merge refreshes only replace experiment/eval pairs that ran, so they would otherwise have stayed at 0/3.Earlier refreshes on the stopped stack
Three refreshes at 4575eb4, 12dcdef and c4ba12d (nodaemon and absent were red by design then). They surfaced two scorer false fails, both fixed with a regression test built from the transcript:
The last of those rounds was 12/12 on the four Docker arms, but only 5 of the 36 Docker runs across the three rounds saw a red
test db: agents fixed the migration by reading it and letsupabase startapply it. That's why the eval now starts with the stack running.Braintrust (65e1fe5): pinned · stable · beta · next
Braintrust (e609c87): pinned · stable · beta · next
Braintrust (4a35927): pinned · stable · beta · next
Related Issue(s)
Closes CLI-2733
🤖 Generated with Claude Code