From 71c3f5f6744d39df8703d0dc794cdfc253d5b60b Mon Sep 17 00:00:00 2001 From: seyeong Date: Fri, 27 Nov 2026 08:06:21 +0900 Subject: [PATCH 1/3] Assert expected final benchmark case count before inference --- bench/accuracy/codex_mcp.py | 25 +++++++++++++++--- tests/test_codex_mcp_benchmark.py | 42 ++++++++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/bench/accuracy/codex_mcp.py b/bench/accuracy/codex_mcp.py index 0a095f9b..89fa7b54 100644 --- a/bench/accuracy/codex_mcp.py +++ b/bench/accuracy/codex_mcp.py @@ -166,6 +166,7 @@ async def run(args): raise ValueError("--exclude-passed-from requires --failures-from; never use exclusions for full accuracy") repo = Path(__file__).resolve().parents[2] manifest = json.loads(args.manifest.read_text()) + input_case_count = len(manifest["cases"]) validate_inputs(manifest, args.db_dir) if manifest["suite"] == "spider2": validate_manifest(manifest, args.root, args.db_dir) @@ -181,9 +182,19 @@ async def run(args): db_sha256=manifest["db_sha256"], ) logger.info("Failed-case selection source=%s selected=%d", args.failures_from, len(manifest["cases"])) - if not manifest["cases"]: - logger.info("No failed cases remain in the source run; no model calls made") - return + selected_case_count = len(manifest["cases"]) + logger.info("Case selection split=%s input=%d selected=%d expected=%s", + args.split, input_case_count, selected_case_count, args.expected_cases) + if args.expected_cases is not None and ( + args.expected_cases < 0 or selected_case_count != args.expected_cases + ): + raise ValueError( + f"Selected {selected_case_count} cases, expected {args.expected_cases}; " + "check --split and failure/pass exclusions before starting inference" + ) + if not manifest["cases"]: + logger.info("No cases remain after selection; no model calls made") + return if args.output.exists(): raise ValueError("Use a fresh output directory; never overwrite attempts") args.output.mkdir(parents=True) @@ -223,6 +234,12 @@ async def run(args): ] }, "schema_document_sha256": digest(args.schema_docs), + "case_selection": { + "split": args.split, + "input_cases": input_case_count, + "selected_cases": selected_case_count, + "expected_cases": args.expected_cases, + }, "review_source": str(args.review_source) if args.review_source else None, "failure_selection": { "source": str(args.failures_from), @@ -425,6 +442,8 @@ def main(): parser.add_argument( "--split", choices=["development", "all"], default="development" ) + parser.add_argument("--expected-cases", type=int, + help="Require this final selected count before any model call; includes split and failure/pass filtering") parser.add_argument("--review-source", type=Path, help="Prior run directory; pass only prior model answer/tool observations, never scores") parser.add_argument("--failures-from", type=Path, help="Run only score=0 cases from this completed run; grades select cases but never enter model prompts") parser.add_argument("--exclude-passed-from", type=Path, action="append", default=[], diff --git a/tests/test_codex_mcp_benchmark.py b/tests/test_codex_mcp_benchmark.py index c7af091f..40c183f1 100644 --- a/tests/test_codex_mcp_benchmark.py +++ b/tests/test_codex_mcp_benchmark.py @@ -192,6 +192,43 @@ async def test_pass_exclusion_cannot_filter_full_accuracy(): await run(SimpleNamespace(exclude_passed_from=['completed'], failures_from=None)) +@pytest.mark.asyncio +@pytest.mark.parametrize("split,failed_only,expected,raises", [ + ("development", False, 2, True), + ("all", True, 1, True), + ("all", True, 0, False), + ("all", False, -1, True), +]) +async def test_selection_contract_precedes_output_and_inference( + tmp_path, monkeypatch, split, failed_only, expected, raises +): + import json + from types import SimpleNamespace + + from bench.accuracy import codex_mcp as runner + + manifest = tmp_path / "manifest.json" + manifest.write_text(json.dumps({ + "suite": "bird", "development_ids": ["first"], "db_sha256": {}, + "cases": [{"instance_id": "first"}, {"instance_id": "second"}], + })) + monkeypatch.setattr(runner, "validate_inputs", lambda *a: None) + monkeypatch.setattr(runner, "load_schema_documents", lambda *a: {}) + monkeypatch.setattr(runner, "failed_cases", lambda *a, **k: []) + args = SimpleNamespace( + exclude_passed_from=[], failures_from=tmp_path if failed_only else None, + manifest=manifest, db_dir=tmp_path, schema_docs=None, split=split, + expected_cases=expected, output=tmp_path / "run", + ) + if raises: + with pytest.raises(ValueError, match="check --split"): + await runner.run(args) + else: + await runner.run(args) + # No output directory, subprocess metadata lookup or model process is created. + assert not args.output.exists() + + @pytest.mark.asyncio @pytest.mark.parametrize("timeout", [False, True]) async def test_runner_preserves_submitted_input_and_partial_trace(tmp_path, monkeypatch, timeout): @@ -246,10 +283,13 @@ async def spawn(*command, **kwargs): root=tmp_path, schema_docs=schema, split="all", output=tmp_path / "run", model="test-model", reasoning_effort="high", concurrency=1, case_timeout=0.01 if timeout else 1, sql_timeout=1, max_rows=100, - review_source=None, + review_source=None, expected_cases=1, ) await runner.run(args) root = args.output / "codex-mcp" + assert json.loads((args.output / "settings.json").read_text())["case_selection"] == { + "split": "all", "input_cases": 1, "selected_cases": 1, "expected_cases": 1, + } record = json.loads((root / "records/case1.json").read_text()) assert record["status"] == ("failed" if timeout else "predicted") assert len(record["mcp_calls"]) == 1 From bd16fa5b810e9d1bed09be028ad6915b03e763aa Mon Sep 17 00:00:00 2001 From: seyeong Date: Fri, 27 Nov 2026 08:10:20 +0900 Subject: [PATCH 2/3] Archive partial-selection incident and guarded two-case runtime validation --- .../selection-count-validation/analysis.json | 27 + .../codex-mcp/csv/bird467.csv | 2 + .../codex-mcp/csv/bird495.csv | 3 + .../codex-mcp/events/bird467.answer.txt | 11 + .../codex-mcp/events/bird467.jsonl | 17 + .../codex-mcp/events/bird467.prompt.txt | 541 ++++++++++++ .../codex-mcp/events/bird467.stderr | 0 .../codex-mcp/events/bird495.answer.txt | 25 + .../codex-mcp/events/bird495.jsonl | 21 + .../codex-mcp/events/bird495.prompt.txt | 133 +++ .../codex-mcp/events/bird495.stderr | 0 .../codex-mcp/records/bird467.json | 152 ++++ .../codex-mcp/records/bird495.json | 195 +++++ .../guarded-two-case/codex-mcp/scores.json | 12 + .../codex-mcp/sql/bird467.sql | 9 + .../codex-mcp/sql/bird495.sql | 23 + .../guarded-two-case/codex-mcp/status.json | 4 + .../comparison/comparison.json | 793 ++++++++++++++++++ .../guarded-two-case/comparison/index.html | 756 +++++++++++++++++ .../guarded-two-case/manifest.json | 449 ++++++++++ .../guarded-two-case/protocol.json | 17 + .../guarded-two-case/requested-manifest.json | 449 ++++++++++ .../guarded-two-case/settings.json | 32 + .../guarded-two-case/summary.json | 8 + .../codex-mcp/csv/bird146.csv | 2 + .../codex-mcp/events/bird146.answer.txt | 15 + .../codex-mcp/events/bird146.jsonl | 17 + .../codex-mcp/events/bird146.prompt.txt | 639 ++++++++++++++ .../codex-mcp/events/bird146.stderr | 0 .../codex-mcp/records/bird146.json | 152 ++++ .../partial-selection/codex-mcp/scores.json | 7 + .../codex-mcp/sql/bird146.sql | 13 + .../partial-selection/codex-mcp/status.json | 4 + .../partial-selection/manifest.json | 533 ++++++++++++ .../partial-selection/protocol.json | 82 ++ .../partial-selection/requested-manifest.json | 713 ++++++++++++++++ .../partial-selection/settings.json | 26 + .../partial-selection/summary.json | 8 + .../selection-count-validation/sha256.json | 40 + 39 files changed, 5930 insertions(+) create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/analysis.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/csv/bird467.csv create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/csv/bird495.csv create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird467.answer.txt create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird467.jsonl create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird467.prompt.txt create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird467.stderr create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird495.answer.txt create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird495.jsonl create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird495.prompt.txt create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird495.stderr create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/records/bird467.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/records/bird495.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/scores.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/sql/bird467.sql create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/sql/bird495.sql create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/status.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/comparison/comparison.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/comparison/index.html create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/manifest.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/protocol.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/requested-manifest.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/settings.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/summary.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/csv/bird146.csv create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/events/bird146.answer.txt create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/events/bird146.jsonl create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/events/bird146.prompt.txt create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/events/bird146.stderr create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/records/bird146.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/scores.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/sql/bird146.sql create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/status.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/manifest.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/protocol.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/requested-manifest.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/settings.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/summary.json create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/sha256.json diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/analysis.json b/bench/accuracy/mcp-review-results/selection-count-validation/analysis.json new file mode 100644 index 00000000..9b7f48eb --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/analysis.json @@ -0,0 +1,27 @@ +{ + "partial_selection": { + "requested": 31, + "actual": 1, + "official_correct": 0, + "id": "bird146", + "cause": "Operator omitted --splitall; defaultdevelopment selectedonlyoneof31cases. Thisrunwasnotrestarted." + }, + "guarded_run": { + "requested": 2, + "actual": 2, + "official_correct": 1, + "passed": [ + "bird495" + ], + "failed": [ + "bird467" + ], + "change": "Selectioncountassertion only relative tosameproduct/metadata candidate. Notacausalaccuracyimprovementclaimforguard." + }, + "remaining30": "SeparatefreshliverunwithactualmanifestIDsverified30/30; notpartofthisarchive.", + "limits": [ + "Failure-only probes,notfullaccuracy.", + "Officialdenominators/resultsretained; no overwrittenattempts.", + "No alreadyexecutedcaserepeated." + ] +} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/csv/bird467.csv b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/csv/bird467.csv new file mode 100644 index 00000000..6290d716 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/csv/bird467.csv @@ -0,0 +1,2 @@ +patient_count +71 diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/csv/bird495.csv b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/csv/bird495.csv new file mode 100644 index 00000000..74a7056b --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/csv/bird495.csv @@ -0,0 +1,3 @@ +bond_type,bond_count,element_pair_count,carcinogenicity_label +-,12,3,- +=,4,1,- diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird467.answer.txt b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird467.answer.txt new file mode 100644 index 00000000..39e1fbea --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird467.answer.txt @@ -0,0 +1,11 @@ +```sql +SELECT COUNT(DISTINCT l.ID) AS patient_count +FROM main.Laboratory AS l +JOIN main.Patient AS p ON p.ID = l.ID +WHERE l."Date" BETWEEN '1981-01-01' AND '1986-12-31' + AND l."Date" >= p.Birthday + AND l."Date" < date(p.Birthday, '+50 years') + AND l.PLT BETWEEN 100 AND 400 + AND (CAST(l."U-PRO" AS REAL) > 0 OR l."U-PRO" IN ('TR', '%%')) +LIMIT 1 +``` \ No newline at end of file diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird467.jsonl b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird467.jsonl new file mode 100644 index 00000000..b1ea5ada --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird467.jsonl @@ -0,0 +1,17 @@ +{"type":"thread.started","thread_id":"01a21a1e-21a8-7731-87c9-fdc8fd1c6086"} +{"type":"turn.started"} +{"type":"item.completed","item":{"id":"item_0","type":"agent_message","text":"I’ll check the schema and stored dipstick readings, then run the distinct-patient count using your criteria."}} +{"type":"item.started","item":{"id":"item_1","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"Laboratory"},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_1","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"Laboratory"},"result":{"content":[{"type":"text","text":"Laboratory (table)\n- ID: INTEGER NOT NULL\n- Date: DATE NOT NULL\n- GOT: INTEGER\n- GPT: INTEGER\n- LDH: INTEGER\n- ALP: INTEGER\n- TP: REAL\n- ALB: REAL\n- UA: REAL\n- UN: INTEGER\n- CRE: REAL\n- T-BIL: REAL\n- T-CHO: INTEGER\n- TG: INTEGER\n- CPK: INTEGER\n- GLU: INTEGER\n- WBC: REAL\n- RBC: REAL\n- HGB: REAL\n- HCT: REAL\n- PLT: INTEGER\n- PT: REAL\n- APTT: INTEGER\n- FG: REAL\n- PIC: INTEGER\n- TAT: INTEGER\n- TAT2: INTEGER\n- U-PRO: TEXT\n- IGG: INTEGER\n- IGA: INTEGER\n- IGM: INTEGER\n- CRP: TEXT\n- RA: TEXT\n- RF: TEXT\n- C3: INTEGER\n- C4: INTEGER\n- RNP: TEXT\n- SM: TEXT\n- SC170: TEXT\n- SSA: TEXT\n- SSB: TEXT\n- CENTROMEA: TEXT\n- DNA: TEXT\n- DNA-II: INTEGER\nPRIMARY KEY (ID, Date)\nFOREIGN KEY (ID) REFERENCES Patient (ID)"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_2","type":"mcp_tool_call","server":"lang2sql","tool":"resolve_business_terms","arguments":{"terms":[]},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_2","type":"mcp_tool_call","server":"lang2sql","tool":"resolve_business_terms","arguments":{"terms":[]},"result":{"content":[{"type":"text","text":"{\"definition_check_id\": \"GBFt8p4hba4Qw9YVnOYVTN7-sGepqWwpPzXRFgsqN80\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_3","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"Patient"},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_3","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"Patient"},"result":{"content":[{"type":"text","text":"Patient (table)\n- ID: INTEGER NOT NULL\n- SEX: TEXT\n- Birthday: DATE\n- Description: DATE\n- First Date: DATE\n- Admission: TEXT\n- Diagnosis: TEXT\nPRIMARY KEY (ID)"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_4","type":"mcp_tool_call","server":"lang2sql","tool":"run_sql","arguments":{"definition_check_id":"GBFt8p4hba4Qw9YVnOYVTN7-sGepqWwpPzXRFgsqN80","sql":"SELECT l.\"U-PRO\" AS reading, COUNT(*) AS tests, MIN(l.\"Date\") AS first_test, MIN(p.Birthday) AS first_birthday\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\nGROUP BY l.\"U-PRO\""},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_4","type":"mcp_tool_call","server":"lang2sql","tool":"run_sql","arguments":{"definition_check_id":"GBFt8p4hba4Qw9YVnOYVTN7-sGepqWwpPzXRFgsqN80","sql":"SELECT l.\"U-PRO\" AS reading, COUNT(*) AS tests, MIN(l.\"Date\") AS first_test, MIN(p.Birthday) AS first_birthday\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\nGROUP BY l.\"U-PRO\""},"result":{"content":[{"type":"text","text":"8 row(s):\nResult coverage: fetched_rows=8; displayed_rows=8; fetch_truncated=false; display_truncated=false; sql_rewritten=true; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): reading=NoneType,str; tests=int; first_test=str; first_birthday=str\nreading | tests | first_test | first_birthday\n--- | --- | --- | ---\nNone | 1920 | 1981-01-27 | 1917-04-18\n%% | 4 | 1982-09-06 | 1929-07-05\n0 | 2729 | 1981-01-27 | 1917-04-18\n1 | 318 | 1981-04-06 | 1926-08-01\n2 | 313 | 1981-03-30 | 1926-08-01\n3 | 147 | 1981-03-16 | 1935-04-19\n4 | 21 | 1981-03-23 | 1943-05-19\nTR | 499 | 1981-02-19 | 1919-12-30\nSQL: SELECT l.\"U-PRO\" AS reading, COUNT(*) AS tests, MIN(l.\"Date\") AS first_test, MIN(p.Birthday) AS first_birthday\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\nGROUP BY l.\"U-PRO\"\nLIMIT 1000"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_5","type":"mcp_tool_call","server":"lang2sql","tool":"resolve_business_terms","arguments":{"terms":[]},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_5","type":"mcp_tool_call","server":"lang2sql","tool":"resolve_business_terms","arguments":{"terms":[]},"result":{"content":[{"type":"text","text":"{\"definition_check_id\": \"ApYlbKxYtGKFx_rIgV3aQGXw0AT7SasD22mU_rP7f-M\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_6","type":"mcp_tool_call","server":"lang2sql","tool":"run_sql","arguments":{"definition_check_id":"ApYlbKxYtGKFx_rIgV3aQGXw0AT7SasD22mU_rP7f-M","expected_columns":["patient_count"],"expected_rows":1,"sql":"SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (CAST(l.\"U-PRO\" AS REAL) > 0 OR l.\"U-PRO\" IN ('TR', '%%'))\nLIMIT 1"},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_6","type":"mcp_tool_call","server":"lang2sql","tool":"run_sql","arguments":{"definition_check_id":"ApYlbKxYtGKFx_rIgV3aQGXw0AT7SasD22mU_rP7f-M","expected_columns":["patient_count"],"expected_rows":1,"sql":"SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (CAST(l.\"U-PRO\" AS REAL) > 0 OR l.\"U-PRO\" IN ('TR', '%%'))\nLIMIT 1"},"result":{"content":[{"type":"text","text":"1 row(s):\nOutput columns validated (projection only).\nOutput row count validated (executed SQL only).\nResult coverage: fetched_rows=1; displayed_rows=1; fetch_truncated=false; display_truncated=false; sql_rewritten=false; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): patient_count=int\npatient_count\n---\n71\nSQL: SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (CAST(l.\"U-PRO\" AS REAL) > 0 OR l.\"U-PRO\" IN ('TR', '%%'))\nLIMIT 1"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.completed","item":{"id":"item_7","type":"agent_message","text":"```sql\nSELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (CAST(l.\"U-PRO\" AS REAL) > 0 OR l.\"U-PRO\" IN ('TR', '%%'))\nLIMIT 1\n```"}} +{"type":"turn.completed","usage":{"input_tokens":195033,"cached_input_tokens":179456,"cache_write_input_tokens":0,"output_tokens":741,"reasoning_output_tokens":31}} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird467.prompt.txt b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird467.prompt.txt new file mode 100644 index 00000000..7b679341 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird467.prompt.txt @@ -0,0 +1,541 @@ +You must use lang2sql MCP to inspect the schema and execute your final answer query, not merely write SQL. Call resolve_business_terms before run_sql; use terms=[] only for literal diagnostics or fully specified request criteria. Inspect the returned result and return the exact successfully executed final SQL in one fenced sql block. A result table alone or SQL that you have not executed does not complete this task. Do not use shell, files, web, or other servers. Do not invent missing business definitions; if essential meaning remains unresolved, ask for clarification instead of inventing SQL or placeholders. +I'm preparing a case series on early renal involvement and need to size my cohort. How many patients were under age 50 on the day of a laboratory test performed between 1 January 1981 and 31 December 1986 inclusive, had a platelet count from 100 through 400 at that test, and showed proteinuria at that test? Age means completed years on the day of the test, so under 50 is strictly below 50. The platelet range is inclusive. I just need the number of patients satisfying all conditions. +Provided evidence: +A patient showed proteinuria at a test when that test's dipstick reading reports protein: a dash or zero means no protein was found, a number is the amount of protein found, TR stands for trace protein, and a reading written in percent signs is the dipstick saturated, the strongest reading. +Official schema metadata (examples are not exhaustive): +CREATE TABLE `Examination` ( + `ID` INTEGER, -- identification of the patient; example: [14872, 48473] + `Examination Date` DATE, -- Examination Date; example: ['1997-05-27', '1992-12-21'] + `aCL IgG` REAL, -- anti-Cardiolipin antibody (IgG) concentration; example: [1.3, 4.3] + `aCL IgM` REAL, -- anti-Cardiolipin antibody (IgM) concentration; example: [1.6, 4.6] + `ANA` INTEGER, -- anti-nucleus antibody concentration; example: [256, 0] + `ANA Pattern` TEXT, -- pattern observed in the sheet of ANA examination; example: ['P', 'P,S'] + `aCL IgA` INTEGER, -- anti-Cardiolipin antibody (IgA) concentration; example: [0, 3] + `Diagnosis` TEXT, -- disease names; example: ['MCTD, AMI', 'SLE'] + `KCT` TEXT, -- measure of degree of coagulation; example: ['-'] + `RVVT` TEXT, -- measure of degree of coagulation; example: ['-'] + `LAC` TEXT, -- measure of degree of coagulation; example: ['-'] + `Symptoms` TEXT, -- other symptoms observed; example: ['AMI'] + `Thrombosis` INTEGER, -- degree of thrombosis; example: [1, 0] + FOREIGN KEY (`ID`) REFERENCES `Patient` (`ID`) +); + +CREATE TABLE `Patient` ( + `ID` INTEGER, -- identification of the patient; example: [2110, 11408] + `SEX` TEXT, -- Sex; example: ['F'] + `Birthday` DATE, -- Birthday; example: ['1934-02-13', '1937-05-02'] + `Description` DATE, -- the first date when a patient data was recorded; example: ['1994-02-14', '1996-12-01'] + `First Date` DATE, -- the date when a patient came to the hospital; example: ['1993-02-10', '1973-01-01'] + `Admission` TEXT, -- patient was admitted to the hospital (+) or followed at the outpatient clinic (-); example: ['+'] + `Diagnosis` TEXT, -- disease names; example: ['RA susp.', 'PSS'] + PRIMARY KEY (`ID`) +); + +CREATE TABLE `Laboratory` ( + `ID` INTEGER, -- identification of the patient; example: [27654] + `Date` DATE, -- Date of the laboratory tests (YYMMDD); example: ['1991-09-11', '1991-09-17'] + `GOT` INTEGER, -- AST glutamic oxaloacetic transaminase; example: [34, 29] + `GPT` INTEGER, -- ALT glutamic pyruvic transaminase; example: [36, 31] + `LDH` INTEGER, -- lactate dehydrogenase; example: [567, 579] + `ALP` INTEGER, -- alkaliphophatase; example: [166, 154] + `TP` REAL, -- total protein; example: [4.5, 5.1] + `ALB` REAL, -- albumin; example: [3.3, 3.4] + `UA` REAL, -- uric acid; example: [3.8, 4.2] + `UN` INTEGER, -- urea nitrogen; example: [29, 36] + `CRE` REAL, -- creatinine; example: [0.8, 0.9] + `T-BIL` REAL, -- total bilirubin; example: [0.3, 0.2] + `T-CHO` INTEGER, -- total cholesterol; example: [165, 134] + `TG` INTEGER, -- triglyceride; example: [] + `CPK` INTEGER, -- creatinine phosphokinase; example: [9, 10] + `GLU` INTEGER, -- blood glucose; example: [88] + `WBC` REAL, -- White blood cell; example: [5.0, 10.4] + `RBC` REAL, -- Red blood cell; example: [2.6, 2.9] + `HGB` REAL, -- Hemoglobin; example: [6.4, 6.7] + `HCT` REAL, -- Hematoclit; example: [20.3, 21.6] + `PLT` INTEGER, -- platelet; example: [227, 242] + `PT` REAL, -- prothrombin time; example: [] + `APTT` INTEGER, -- activated partial prothrombin time; example: [] + `FG` REAL, -- fibrinogen; example: [] + `PIC` INTEGER, -- example: [] + `TAT` INTEGER, -- example: [] + `TAT2` INTEGER, -- example: [] + `U-PRO` TEXT, -- proteinuria; example: [] + `IGG` INTEGER, -- Ig G; example: [339, 771] + `IGA` INTEGER, -- Ig A; example: [145, 188] + `IGM` INTEGER, -- Ig M; example: [46, 132] + `CRP` TEXT, -- C-reactive protein; example: ['0.6', '2.7'] + `RA` TEXT, -- Rhuematoid Factor; example: [] + `RF` TEXT, -- RAHA; example: [] + `C3` INTEGER, -- complement 3; example: [] + `C4` INTEGER, -- complement 4; example: [] + `RNP` TEXT, -- anti-ribonuclear protein; example: [] + `SM` TEXT, -- anti-SM; example: [] + `SC170` TEXT, -- anti-scl70; example: [] + `SSA` TEXT, -- anti-SSA; example: [] + `SSB` TEXT, -- anti-SSB; example: [] + `CENTROMEA` TEXT, -- anti-centromere; example: [] + `DNA` TEXT, -- anti-DNA; example: [] + `DNA-II` INTEGER, -- anti-DNA; example: [] + PRIMARY KEY (`ID`, `Date`), + FOREIGN KEY (`ID`) REFERENCES `Patient` (`ID`) +); + + +Official column/value descriptions (2024 Dev release): +{ + "Examination": [ + { + "original_column_name": "ID", + "column_name": "", + "column_description": "identification of the patient", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "Examination Date", + "column_name": "", + "column_description": "Examination Date", + "data_format": "date ", + "value_description": "" + }, + { + "original_column_name": "aCL IgG", + "column_name": "anti-Cardiolipin antibody (IgG) ", + "column_description": "anti-Cardiolipin antibody (IgG) concentration", + "data_format": "real", + "value_description": "" + }, + { + "original_column_name": "aCL IgM", + "column_name": "anti-Cardiolipin antibody (IgM) ", + "column_description": "anti-Cardiolipin antibody (IgM) concentration", + "data_format": "real", + "value_description": "" + }, + { + "original_column_name": "ANA", + "column_name": "anti-nucleus antibody ", + "column_description": "anti-nucleus antibody concentration", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "ANA Pattern", + "column_name": "pattern observed in the sheet of ANA examination", + "column_description": "pattern observed in the sheet of ANA examination", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "aCL IgA", + "column_name": "anti-Cardiolipin antibody (IgA) concentration", + "column_description": "anti-Cardiolipin antibody (IgA) concentration", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "Diagnosis", + "column_name": "", + "column_description": "disease names", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "KCT", + "column_name": "measure of degree of coagulation", + "column_description": "measure of degree of coagulation", + "data_format": "text", + "value_description": "+: positive\n\n-: negative" + }, + { + "original_column_name": "RVVT", + "column_name": "measure of degree of coagulation", + "column_description": "measure of degree of coagulation", + "data_format": "text", + "value_description": "+: positive\n\n-: negative" + }, + { + "original_column_name": "LAC", + "column_name": "measure of degree of coagulation", + "column_description": "measure of degree of coagulation", + "data_format": "text", + "value_description": "+: positive\n\n-: negative" + }, + { + "original_column_name": "Symptoms", + "column_name": "", + "column_description": "other symptoms observed", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "Thrombosis", + "column_name": "", + "column_description": "degree of thrombosis", + "data_format": "integer", + "value_description": "0: negative (no thrombosis)\n1: positive (the most serious)\n2: positive (severe)3: positive (mild)" + } + ], + "Laboratory": [ + { + "original_column_name": "ID", + "column_name": "", + "column_description": "identification of the patient", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "Date", + "column_name": "", + "column_description": "Date of the laboratory tests (YYMMDD)", + "data_format": "date", + "value_description": "" + }, + { + "original_column_name": "GOT", + "column_name": "AST glutamic oxaloacetic transaminase", + "column_description": "AST glutamic oxaloacetic transaminase", + "data_format": "integer", + "value_description": "Commonsense evidence:\n\nNormal range: N < 60" + }, + { + "original_column_name": "GPT", + "column_name": "ALT glutamic pyruvic transaminase", + "column_description": "ALT glutamic pyruvic transaminase", + "data_format": "integer", + "value_description": "Commonsense evidence:\n\nNormal range: N < 60" + }, + { + "original_column_name": "LDH", + "column_name": "lactate dehydrogenase", + "column_description": "lactate dehydrogenase", + "data_format": "integer", + "value_description": "Commonsense evidence:\n\nNormal range: N < 500" + }, + { + "original_column_name": "ALP", + "column_name": "alkaliphophatase", + "column_description": "alkaliphophatase", + "data_format": "integer", + "value_description": "Commonsense evidence:\n\nNormal range: N < 300" + }, + { + "original_column_name": "TP", + "column_name": "total protein", + "column_description": "total protein", + "data_format": "real", + "value_description": "Commonsense evidence:\n\nNormal range: 6.0 < N < 8.5" + }, + { + "original_column_name": "ALB", + "column_name": "albumin", + "column_description": "albumin", + "data_format": "real", + "value_description": "Commonsense evidence:\n\nNormal range: 3.5 < N < 5.5" + }, + { + "original_column_name": "UA", + "column_name": "uric acid", + "column_description": "uric acid", + "data_format": "real", + "value_description": "Commonsense evidence:\n\nNormal range: N > 8.0 (Male)N > 6.5 (Female)" + }, + { + "original_column_name": "UN", + "column_name": "urea nitrogen", + "column_description": "urea nitrogen", + "data_format": "integer", + "value_description": "Commonsense evidence:\n\nNormal range: N < 30" + }, + { + "original_column_name": "CRE", + "column_name": "creatinine", + "column_description": "creatinine", + "data_format": "real", + "value_description": "Commonsense evidence:\n\nNormal range: N < 1.5" + }, + { + "original_column_name": "T-BIL", + "column_name": "total bilirubin", + "column_description": "total bilirubin", + "data_format": "real", + "value_description": "Commonsense evidence:\n\nNormal range: N < 2.0" + }, + { + "original_column_name": "T-CHO", + "column_name": "total cholesterol", + "column_description": "total cholesterol", + "data_format": "integer", + "value_description": "Commonsense evidence:\nNormal range: N < 250" + }, + { + "original_column_name": "TG", + "column_name": "triglyceride", + "column_description": "triglyceride", + "data_format": "integer", + "value_description": "Commonsense evidence:\n\nNormal range: N < 200" + }, + { + "original_column_name": "CPK", + "column_name": "creatinine phosphokinase", + "column_description": "creatinine phosphokinase", + "data_format": "integer", + "value_description": "Commonsense evidence:\nNormal range: N < 250" + }, + { + "original_column_name": "GLU", + "column_name": "blood glucose", + "column_description": "blood glucose", + "data_format": "integer", + "value_description": "Commonsense evidence:\nNormal range: N < 180" + }, + { + "original_column_name": "WBC", + "column_name": "White blood cell", + "column_description": "White blood cell", + "data_format": "real", + "value_description": "Commonsense evidence:\nNormal range: 3.5 < N < 9.0" + }, + { + "original_column_name": "RBC", + "column_name": "Red blood cell", + "column_description": "Red blood cell", + "data_format": "real", + "value_description": "Commonsense evidence:\n\nNormal range: 3.5 < N < 6.0" + }, + { + "original_column_name": "HGB", + "column_name": "Hemoglobin", + "column_description": "Hemoglobin", + "data_format": "real", + "value_description": "Commonsense evidence:\n\nNormal range: 10 < N < 17" + }, + { + "original_column_name": "HCT", + "column_name": "Hematoclit", + "column_description": "Hematoclit", + "data_format": "real", + "value_description": "Commonsense evidence:\nNormal range: 29 < N < 52" + }, + { + "original_column_name": "PLT", + "column_name": "platelet", + "column_description": "platelet", + "data_format": "integer", + "value_description": "Commonsense evidence:\n\nNormal range: 100 < N < 400" + }, + { + "original_column_name": "PT", + "column_name": "prothrombin time", + "column_description": "prothrombin time", + "data_format": "real", + "value_description": "Commonsense evidence:\n\nNormal range: N < 14" + }, + { + "original_column_name": "APTT", + "column_name": "activated partial prothrombin time", + "column_description": "activated partial prothrombin time", + "data_format": "integer", + "value_description": "Commonsense evidence:\n\nNormal range: N < 45" + }, + { + "original_column_name": "FG", + "column_name": "fibrinogen", + "column_description": "fibrinogen", + "data_format": "real", + "value_description": "Commonsense evidence:\n\nNormal range: 150 < N < 450" + }, + { + "original_column_name": "PIC", + "column_name": "", + "column_description": "", + "data_format": "", + "value_description": "" + }, + { + "original_column_name": "TAT", + "column_name": "", + "column_description": "", + "data_format": "", + "value_description": "" + }, + { + "original_column_name": "TAT2", + "column_name": "", + "column_description": "", + "data_format": "", + "value_description": "" + }, + { + "original_column_name": "U-PRO", + "column_name": "proteinuria", + "column_description": "proteinuria", + "data_format": "text", + "value_description": "Commonsense evidence:\n\nNormal range: 0 < N < 30" + }, + { + "original_column_name": "IGG", + "column_name": "Ig G", + "column_description": "Ig G", + "data_format": "integer", + "value_description": "Commonsense evidence:\n\nNormal range: 900 < N < 2000" + }, + { + "original_column_name": "IGA", + "column_name": "Ig A", + "column_description": "Ig A", + "data_format": "integer", + "value_description": "Commonsense evidence:\n\nNormal range: 80 < N < 500" + }, + { + "original_column_name": "IGM", + "column_name": "Ig M", + "column_description": "Ig M", + "data_format": "integer", + "value_description": "Commonsense evidence:\n\nNormal range: 40 < N < 400" + }, + { + "original_column_name": "CRP", + "column_name": "C-reactive protein", + "column_description": "C-reactive protein", + "data_format": "text", + "value_description": "Commonsense evidence:\n\nNormal range: N= -, +-, or N < 1.0" + }, + { + "original_column_name": "RA", + "column_name": "Rhuematoid Factor", + "column_description": "Rhuematoid Factor", + "data_format": "text", + "value_description": "Commonsense evidence:\n\nNormal range: N= -, +-" + }, + { + "original_column_name": "RF", + "column_name": "RAHA", + "column_description": "RAHA", + "data_format": "text", + "value_description": "Commonsense evidence:\n\nNormal range: N < 20" + }, + { + "original_column_name": "C3", + "column_name": "complement 3", + "column_description": "complement 3", + "data_format": "integer", + "value_description": "Commonsense evidence:\n\nNormal range: N > 35" + }, + { + "original_column_name": "C4", + "column_name": "complement 4", + "column_description": "complement 4", + "data_format": "integer", + "value_description": "Commonsense evidence:\n\nNormal range: N > 10" + }, + { + "original_column_name": "RNP", + "column_name": "anti-ribonuclear protein", + "column_description": "anti-ribonuclear protein", + "data_format": "text", + "value_description": "Commonsense evidence:\n\nNormal range: N= -, +-" + }, + { + "original_column_name": "SM", + "column_name": "anti-SM", + "column_description": "anti-SM", + "data_format": "text", + "value_description": "Commonsense evidence:\n\nNormal range: N= -, +-" + }, + { + "original_column_name": "SC170", + "column_name": "anti-scl70", + "column_description": "anti-scl70", + "data_format": "text", + "value_description": "Commonsense evidence:\n\nNormal range: N= -, +-" + }, + { + "original_column_name": "SSA", + "column_name": "anti-SSA", + "column_description": "anti-SSA", + "data_format": "text", + "value_description": "Commonsense evidence:\n\nNormal range: N= -, +-" + }, + { + "original_column_name": "SSB", + "column_name": "anti-SSB", + "column_description": "anti-SSB", + "data_format": "text", + "value_description": "Commonsense evidence:\n\nNormal range: N= -, +-" + }, + { + "original_column_name": "CENTROMEA", + "column_name": "anti-centromere", + "column_description": "anti-centromere", + "data_format": "text", + "value_description": "Commonsense evidence:\n\nNormal range: N= -, +-" + }, + { + "original_column_name": "DNA", + "column_name": "anti-DNA", + "column_description": "anti-DNA", + "data_format": "text", + "value_description": "Commonsense evidence:\n\nNormal range: N < 8" + }, + { + "original_column_name": "DNA-II", + "column_name": "anti-DNA", + "column_description": "anti-DNA", + "data_format": "integer", + "value_description": "Commonsense evidence:\n\nNormal range: N < 8" + } + ], + "Patient": [ + { + "original_column_name": "ID", + "column_name": "", + "column_description": "identification of the patient", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "SEX", + "column_name": "", + "column_description": "Sex", + "data_format": "text", + "value_description": "F: female; M: male" + }, + { + "original_column_name": "Birthday", + "column_name": "", + "column_description": "Birthday", + "data_format": "date", + "value_description": "" + }, + { + "original_column_name": "Description", + "column_name": "", + "column_description": "the first date when a patient data was recorded", + "data_format": "date", + "value_description": "null or empty: not recorded" + }, + { + "original_column_name": "First Date", + "column_name": "", + "column_description": "the date when a patient came to the hospital", + "data_format": "date", + "value_description": "" + }, + { + "original_column_name": "Admission", + "column_name": "", + "column_description": "patient was admitted to the hospital (+) or followed at the outpatient clinic (-)", + "data_format": "text", + "value_description": "patient was admitted to the hospital (+) or followed at the outpatient clinic (-)" + }, + { + "original_column_name": "Diagnosis", + "column_name": "", + "column_description": "disease names", + "data_format": "text", + "value_description": "" + } + ] +} +Return your final answer as exactly one fenced ```sql block containing the single read-only SQLite SELECT/WITH query that answers the question. Do not include exploratory SQL in the final answer. Use the supplied documentation; no user simulator is available. \ No newline at end of file diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird467.stderr b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird467.stderr new file mode 100644 index 00000000..e69de29b diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird495.answer.txt b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird495.answer.txt new file mode 100644 index 00000000..3ef39dab --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird495.answer.txt @@ -0,0 +1,25 @@ +```sql +WITH pair_counts AS ( + SELECT b.bond_type, + m.label, + MIN(a1.element, a2.element) AS element_lo, + MAX(a1.element, a2.element) AS element_hi, + COUNT(DISTINCT b.bond_id) AS bonds_in_pair + FROM main.bond AS b + JOIN main.molecule AS m ON m.molecule_id = b.molecule_id + JOIN main.connected AS c ON c.bond_id = b.bond_id + JOIN main.atom AS a1 ON a1.atom_id = c.atom_id + JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2 + WHERE b.molecule_id = 'TR377' + AND b.bond_type IN ('-', '=') + GROUP BY b.bond_type, m.label, element_lo, element_hi +) +SELECT bond_type, + SUM(bonds_in_pair) AS bond_count, + COUNT(*) AS element_pair_count, + label AS carcinogenicity_label +FROM pair_counts +GROUP BY bond_type, label +ORDER BY bond_count DESC, bond_type ASC +LIMIT 2 +``` \ No newline at end of file diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird495.jsonl b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird495.jsonl new file mode 100644 index 00000000..e7544bb2 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird495.jsonl @@ -0,0 +1,21 @@ +{"type":"thread.started","thread_id":"01a21a1e-21a8-7293-8146-be2b724ac45c"} +{"type":"turn.started"} +{"type":"item.completed","item":{"id":"item_0","type":"agent_message","text":"I’ll check how the database defines an element pair, inspect the relevant tables, and run the query for TR377."}} +{"type":"item.started","item":{"id":"item_1","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"molecule"},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_1","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"molecule"},"result":{"content":[{"type":"text","text":"molecule (table)\n- molecule_id: TEXT NOT NULL\n- label: TEXT\nPRIMARY KEY (molecule_id)"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_2","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"bond"},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_2","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"bond"},"result":{"content":[{"type":"text","text":"bond (table)\n- bond_id: TEXT NOT NULL\n- molecule_id: TEXT\n- bond_type: TEXT\nPRIMARY KEY (bond_id)\nFOREIGN KEY (molecule_id) REFERENCES molecule (molecule_id)"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_3","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"atom"},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_3","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"atom"},"result":{"content":[{"type":"text","text":"atom (table)\n- atom_id: TEXT NOT NULL\n- molecule_id: TEXT\n- element: TEXT\nPRIMARY KEY (atom_id)\nFOREIGN KEY (molecule_id) REFERENCES molecule (molecule_id)"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_4","type":"mcp_tool_call","server":"lang2sql","tool":"resolve_business_terms","arguments":{"terms":[]},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_4","type":"mcp_tool_call","server":"lang2sql","tool":"resolve_business_terms","arguments":{"terms":[]},"result":{"content":[{"type":"text","text":"{\"definition_check_id\": \"BM3HE_y240zFH_Rr2nASBNoaGHu5caJO__FiPtlx7Ek\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_5","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"connected"},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_5","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"connected"},"result":{"content":[{"type":"text","text":"connected (table)\n- atom_id: TEXT NOT NULL\n- atom_id2: TEXT NOT NULL\n- bond_id: TEXT\nPRIMARY KEY (atom_id, atom_id2)\nFOREIGN KEY (bond_id) REFERENCES bond (bond_id)\nFOREIGN KEY (atom_id2) REFERENCES atom (atom_id)\nFOREIGN KEY (atom_id) REFERENCES atom (atom_id)"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_6","type":"mcp_tool_call","server":"lang2sql","tool":"run_sql","arguments":{"definition_check_id":"BM3HE_y240zFH_Rr2nASBNoaGHu5caJO__FiPtlx7Ek","sql":"SELECT b.bond_type, COUNT(DISTINCT b.bond_id) AS bonds, COUNT(c.bond_id) AS connections, COUNT(a.element) AS first_elements, COUNT(z.element) AS second_elements\nFROM main.bond AS b\nLEFT JOIN main.connected AS c ON c.bond_id = b.bond_id\nLEFT JOIN main.atom AS a ON a.atom_id = c.atom_id\nLEFT JOIN main.atom AS z ON z.atom_id = c.atom_id2\nWHERE b.molecule_id = 'TR377'\nGROUP BY b.bond_type"},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_6","type":"mcp_tool_call","server":"lang2sql","tool":"run_sql","arguments":{"definition_check_id":"BM3HE_y240zFH_Rr2nASBNoaGHu5caJO__FiPtlx7Ek","sql":"SELECT b.bond_type, COUNT(DISTINCT b.bond_id) AS bonds, COUNT(c.bond_id) AS connections, COUNT(a.element) AS first_elements, COUNT(z.element) AS second_elements\nFROM main.bond AS b\nLEFT JOIN main.connected AS c ON c.bond_id = b.bond_id\nLEFT JOIN main.atom AS a ON a.atom_id = c.atom_id\nLEFT JOIN main.atom AS z ON z.atom_id = c.atom_id2\nWHERE b.molecule_id = 'TR377'\nGROUP BY b.bond_type"},"result":{"content":[{"type":"text","text":"3 row(s):\nResult coverage: fetched_rows=3; displayed_rows=3; fetch_truncated=false; display_truncated=false; sql_rewritten=true; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): bond_type=str; bonds=int; connections=int; first_elements=int; second_elements=int\nbond_type | bonds | connections | first_elements | second_elements\n--- | --- | --- | --- | ---\n# | 2 | 4 | 4 | 4\n- | 12 | 24 | 24 | 24\n= | 4 | 8 | 8 | 8\nSQL: SELECT b.bond_type, COUNT(DISTINCT b.bond_id) AS bonds, COUNT(c.bond_id) AS connections, COUNT(a.element) AS first_elements, COUNT(z.element) AS second_elements\nFROM main.bond AS b\nLEFT JOIN main.connected AS c ON c.bond_id = b.bond_id\nLEFT JOIN main.atom AS a ON a.atom_id = c.atom_id\nLEFT JOIN main.atom AS z ON z.atom_id = c.atom_id2\nWHERE b.molecule_id = 'TR377'\nGROUP BY b.bond_type\nLIMIT 1000"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_7","type":"mcp_tool_call","server":"lang2sql","tool":"resolve_business_terms","arguments":{"terms":[]},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_7","type":"mcp_tool_call","server":"lang2sql","tool":"resolve_business_terms","arguments":{"terms":[]},"result":{"content":[{"type":"text","text":"{\"definition_check_id\": \"SH8tHhKYFv7gvKWolr989r47sdfXX0QV47vLRtlORdA\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_8","type":"mcp_tool_call","server":"lang2sql","tool":"run_sql","arguments":{"definition_check_id":"SH8tHhKYFv7gvKWolr989r47sdfXX0QV47vLRtlORdA","expected_rows":2,"expected_columns":["bond_type","bond_count","element_pair_count","carcinogenicity_label"],"sql":"WITH pair_counts AS (\n SELECT b.bond_type,\n m.label,\n MIN(a1.element, a2.element) AS element_lo,\n MAX(a1.element, a2.element) AS element_hi,\n COUNT(DISTINCT b.bond_id) AS bonds_in_pair\n FROM main.bond AS b\n JOIN main.molecule AS m ON m.molecule_id = b.molecule_id\n JOIN main.connected AS c ON c.bond_id = b.bond_id\n JOIN main.atom AS a1 ON a1.atom_id = c.atom_id\n JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2\n WHERE b.molecule_id = 'TR377'\n AND b.bond_type IN ('-', '=')\n GROUP BY b.bond_type, m.label, element_lo, element_hi\n)\nSELECT bond_type,\n SUM(bonds_in_pair) AS bond_count,\n COUNT(*) AS element_pair_count,\n label AS carcinogenicity_label\nFROM pair_counts\nGROUP BY bond_type, label\nORDER BY bond_count DESC, bond_type ASC\nLIMIT 2"},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_8","type":"mcp_tool_call","server":"lang2sql","tool":"run_sql","arguments":{"definition_check_id":"SH8tHhKYFv7gvKWolr989r47sdfXX0QV47vLRtlORdA","expected_rows":2,"expected_columns":["bond_type","bond_count","element_pair_count","carcinogenicity_label"],"sql":"WITH pair_counts AS (\n SELECT b.bond_type,\n m.label,\n MIN(a1.element, a2.element) AS element_lo,\n MAX(a1.element, a2.element) AS element_hi,\n COUNT(DISTINCT b.bond_id) AS bonds_in_pair\n FROM main.bond AS b\n JOIN main.molecule AS m ON m.molecule_id = b.molecule_id\n JOIN main.connected AS c ON c.bond_id = b.bond_id\n JOIN main.atom AS a1 ON a1.atom_id = c.atom_id\n JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2\n WHERE b.molecule_id = 'TR377'\n AND b.bond_type IN ('-', '=')\n GROUP BY b.bond_type, m.label, element_lo, element_hi\n)\nSELECT bond_type,\n SUM(bonds_in_pair) AS bond_count,\n COUNT(*) AS element_pair_count,\n label AS carcinogenicity_label\nFROM pair_counts\nGROUP BY bond_type, label\nORDER BY bond_count DESC, bond_type ASC\nLIMIT 2"},"result":{"content":[{"type":"text","text":"2 row(s):\nOutput columns validated (projection only).\nOutput row count validated (executed SQL only).\nResult coverage: fetched_rows=2; displayed_rows=2; fetch_truncated=false; display_truncated=false; sql_rewritten=false; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): bond_type=str; bond_count=int; element_pair_count=int; carcinogenicity_label=str\nbond_type | bond_count | element_pair_count | carcinogenicity_label\n--- | --- | --- | ---\n- | 12 | 3 | -\n= | 4 | 1 | -\nSQL: WITH pair_counts AS (\n SELECT b.bond_type,\n m.label,\n MIN(a1.element, a2.element) AS element_lo,\n MAX(a1.element, a2.element) AS element_hi,\n COUNT(DISTINCT b.bond_id) AS bonds_in_pair\n FROM main.bond AS b\n JOIN main.molecule AS m ON m.molecule_id = b.molecule_id\n JOIN main.connected AS c ON c.bond_id = b.bond_id\n JOIN main.atom AS a1 ON a1.atom_id = c.atom_id\n JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2\n WHERE b.molecule_id = 'TR377'\n AND b.bond_type IN ('-', '=')\n GROUP BY b.bond_type, m.label, element_lo, element_hi\n)\nSELECT bond_type,\n SUM(bonds_in_pair) AS bond_count,\n COUNT(*) AS element_pair_count,\n label AS carcinogenicity_label\nFROM pair_counts\nGROUP BY bond_type, label\nORDER BY bond_count DESC, bond_type ASC\nLIMIT 2"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.completed","item":{"id":"item_9","type":"agent_message","text":"```sql\nWITH pair_counts AS (\n SELECT b.bond_type,\n m.label,\n MIN(a1.element, a2.element) AS element_lo,\n MAX(a1.element, a2.element) AS element_hi,\n COUNT(DISTINCT b.bond_id) AS bonds_in_pair\n FROM main.bond AS b\n JOIN main.molecule AS m ON m.molecule_id = b.molecule_id\n JOIN main.connected AS c ON c.bond_id = b.bond_id\n JOIN main.atom AS a1 ON a1.atom_id = c.atom_id\n JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2\n WHERE b.molecule_id = 'TR377'\n AND b.bond_type IN ('-', '=')\n GROUP BY b.bond_type, m.label, element_lo, element_hi\n)\nSELECT bond_type,\n SUM(bonds_in_pair) AS bond_count,\n COUNT(*) AS element_pair_count,\n label AS carcinogenicity_label\nFROM pair_counts\nGROUP BY bond_type, label\nORDER BY bond_count DESC, bond_type ASC\nLIMIT 2\n```"}} +{"type":"turn.completed","usage":{"input_tokens":165921,"cached_input_tokens":154368,"cache_write_input_tokens":0,"output_tokens":995,"reasoning_output_tokens":52}} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird495.prompt.txt b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird495.prompt.txt new file mode 100644 index 00000000..267bdc42 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird495.prompt.txt @@ -0,0 +1,133 @@ +You must use lang2sql MCP to inspect the schema and execute your final answer query, not merely write SQL. Call resolve_business_terms before run_sql; use terms=[] only for literal diagnostics or fully specified request criteria. Inspect the returned result and return the exact successfully executed final SQL in one fenced sql block. A result table alone or SQL that you have not executed does not complete this task. Do not use shell, files, web, or other servers. Do not invent missing business definitions; if essential meaning remains unresolved, ask for clarification instead of inventing SQL or placeholders. +For molecule TR377, I'd like a profile of its bond composition, covering single and double bonds only. For each bond kind, please give me: the bond kind symbol, the number of bonds of that kind in the molecule, and the number of element pairs that bond kind joins. Also include the molecule's carcinogenicity label. List the bond kinds from most frequent to least; if two kinds are equally frequent, list them alphabetically by symbol. +Provided evidence: +A single bond is shown as the symbol '-' and a double bond as '='; a molecule label '+' means carcinogenic and '-' means not carcinogenic. +Official schema metadata (examples are not exhaustive): +CREATE TABLE `atom` ( + `atom_id` TEXT, -- the unique id of atoms; example: ['TR000_1', 'TR000_2'] + `molecule_id` TEXT, -- identifying the molecule to which the atom belongs; example: ['TR000'] + `element` TEXT, -- the element of the toxicology; example: ['cl', 'c'] + PRIMARY KEY (`atom_id`), + FOREIGN KEY (`molecule_id`) REFERENCES `molecule` (`molecule_id`) +); + +CREATE TABLE `bond` ( + `bond_id` TEXT, -- unique id representing bonds; example: ['TR000_1_2', 'TR000_2_3'] + `molecule_id` TEXT, -- identifying the molecule in which the bond appears; example: ['TR000', 'TR001'] + `bond_type` TEXT, -- type of the bond; example: ['-', '='] + PRIMARY KEY (`bond_id`), + FOREIGN KEY (`molecule_id`) REFERENCES `molecule` (`molecule_id`) +); + +CREATE TABLE `connected` ( + `atom_id` TEXT, -- id of the first atom; example: ['TR000_1', 'TR000_2'] + `atom_id2` TEXT, -- id of the second atom; example: ['TR000_2', 'TR000_1'] + `bond_id` TEXT, -- bond id representing bond between two atoms; example: ['TR000_1_2', 'TR000_2_3'] + PRIMARY KEY (`atom_id`, `atom_id2`), + FOREIGN KEY (`bond_id`) REFERENCES `bond` (`bond_id`), + FOREIGN KEY (`atom_id2`) REFERENCES `atom` (`atom_id`), + FOREIGN KEY (`atom_id`) REFERENCES `atom` (`atom_id`) +); + +CREATE TABLE `molecule` ( + `molecule_id` TEXT, -- unique id of molecule; example: ['TR000', 'TR001'] + `label` TEXT, -- whether this molecule is carcinogenic or not; example: ['+', '-'] + PRIMARY KEY (`molecule_id`) +); + +CREATE TABLE `element` ( + `element_id` TEXT, -- example: [] + `element_name` TEXT, -- example: [] + PRIMARY KEY (`element_id`) +); + + +Official column/value descriptions (2024 Dev release): +{ + "atom": [ + { + "original_column_name": "atom_id", + "column_name": "atom id", + "column_description": "the unique id of atoms", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "molecule_id", + "column_name": "molecule id", + "column_description": "identifying the molecule to which the atom belongs", + "data_format": "text", + "value_description": "commonsense evidence:\nTRXXX_i represents ith atom of molecule TRXXX" + }, + { + "original_column_name": "element", + "column_name": "", + "column_description": "the element of the toxicology ", + "data_format": "text", + "value_description": "• cl: chlorine\n• c: carbon\n• h: hydrogen\n• o: oxygen\n• s: sulfur\n• n: nitrogen\n• p: phosphorus\n• na: sodium\n• br: bromine\n• f: fluorine\n• i: iodine\n• sn: Tin\n• pb: lead\n• te: tellurium\n• ca: Calcium" + } + ], + "bond": [ + { + "original_column_name": "bond_id", + "column_name": "", + "column_description": "unique id representing bonds", + "data_format": "text", + "value_description": "TRxxx_A1_A2:\nTRXXX refers to which molecule\nA1 and A2 refers to which atom" + }, + { + "original_column_name": "molecule_id", + "column_name": "", + "column_description": "identifying the molecule in which the bond appears", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "bond_type", + "column_name": "", + "column_description": "type of the bond", + "data_format": "text", + "value_description": "commonsense evidence:\n“-”: single bond\n'=': double bond\n'#': triple bond" + } + ], + "connected": [ + { + "original_column_name": "atom_id", + "column_name": "atom id", + "column_description": "id of the first atom", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "atom_id2", + "column_name": "atom id 2", + "column_description": "id of the second atom", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "bond_id", + "column_name": "bond id", + "column_description": "bond id representing bond between two atoms", + "data_format": "text", + "value_description": "" + } + ], + "molecule": [ + { + "original_column_name": "molecule_id", + "column_name": "molecule id", + "column_description": "unique id of molecule", + "data_format": "text", + "value_description": "\"+\" --> this molecule / compound is carcinogenic\n'-' this molecule is not / compound carcinogenic" + }, + { + "original_column_name": "label", + "column_name": "", + "column_description": "whether this molecule is carcinogenic or not", + "data_format": "text", + "value_description": "" + } + ] +} +Return your final answer as exactly one fenced ```sql block containing the single read-only SQLite SELECT/WITH query that answers the question. Do not include exploratory SQL in the final answer. Use the supplied documentation; no user simulator is available. \ No newline at end of file diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird495.stderr b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/events/bird495.stderr new file mode 100644 index 00000000..e69de29b diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/records/bird467.json b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/records/bird467.json new file mode 100644 index 00000000..e40465c8 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/records/bird467.json @@ -0,0 +1,152 @@ +{ + "instance_id": "bird467", + "profile": "codex-mcp", + "model": "gpt-6.2-astra", + "status": "predicted", + "calls": [], + "prompt_sha256": "f3edaf9e4dc49ac60e37e0a804dbda0947e6f058351c2e000d6e178d6ec7aa08", + "events_sha256": "ce1c1e772137a7c87670959bbe9934b80348ae7bce685e36ea1e3fcb90c356d1", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 195033, + "cached_input_tokens": 179456, + "cache_write_input_tokens": 0, + "output_tokens": 741, + "reasoning_output_tokens": 31 + } + ], + "mcp_calls": [ + { + "id": "item_1", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "Laboratory" + }, + "result": { + "content": [ + { + "type": "text", + "text": "Laboratory (table)\n- ID: INTEGER NOT NULL\n- Date: DATE NOT NULL\n- GOT: INTEGER\n- GPT: INTEGER\n- LDH: INTEGER\n- ALP: INTEGER\n- TP: REAL\n- ALB: REAL\n- UA: REAL\n- UN: INTEGER\n- CRE: REAL\n- T-BIL: REAL\n- T-CHO: INTEGER\n- TG: INTEGER\n- CPK: INTEGER\n- GLU: INTEGER\n- WBC: REAL\n- RBC: REAL\n- HGB: REAL\n- HCT: REAL\n- PLT: INTEGER\n- PT: REAL\n- APTT: INTEGER\n- FG: REAL\n- PIC: INTEGER\n- TAT: INTEGER\n- TAT2: INTEGER\n- U-PRO: TEXT\n- IGG: INTEGER\n- IGA: INTEGER\n- IGM: INTEGER\n- CRP: TEXT\n- RA: TEXT\n- RF: TEXT\n- C3: INTEGER\n- C4: INTEGER\n- RNP: TEXT\n- SM: TEXT\n- SC170: TEXT\n- SSA: TEXT\n- SSB: TEXT\n- CENTROMEA: TEXT\n- DNA: TEXT\n- DNA-II: INTEGER\nPRIMARY KEY (ID, Date)\nFOREIGN KEY (ID) REFERENCES Patient (ID)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_2", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"GBFt8p4hba4Qw9YVnOYVTN7-sGepqWwpPzXRFgsqN80\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_3", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "Patient" + }, + "result": { + "content": [ + { + "type": "text", + "text": "Patient (table)\n- ID: INTEGER NOT NULL\n- SEX: TEXT\n- Birthday: DATE\n- Description: DATE\n- First Date: DATE\n- Admission: TEXT\n- Diagnosis: TEXT\nPRIMARY KEY (ID)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_4", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "GBFt8p4hba4Qw9YVnOYVTN7-sGepqWwpPzXRFgsqN80", + "sql": "SELECT l.\"U-PRO\" AS reading, COUNT(*) AS tests, MIN(l.\"Date\") AS first_test, MIN(p.Birthday) AS first_birthday\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\nGROUP BY l.\"U-PRO\"" + }, + "result": { + "content": [ + { + "type": "text", + "text": "8 row(s):\nResult coverage: fetched_rows=8; displayed_rows=8; fetch_truncated=false; display_truncated=false; sql_rewritten=true; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): reading=NoneType,str; tests=int; first_test=str; first_birthday=str\nreading | tests | first_test | first_birthday\n--- | --- | --- | ---\nNone | 1920 | 1981-01-27 | 1917-04-18\n%% | 4 | 1982-09-06 | 1929-07-05\n0 | 2729 | 1981-01-27 | 1917-04-18\n1 | 318 | 1981-04-06 | 1926-08-01\n2 | 313 | 1981-03-30 | 1926-08-01\n3 | 147 | 1981-03-16 | 1935-04-19\n4 | 21 | 1981-03-23 | 1943-05-19\nTR | 499 | 1981-02-19 | 1919-12-30\nSQL: SELECT l.\"U-PRO\" AS reading, COUNT(*) AS tests, MIN(l.\"Date\") AS first_test, MIN(p.Birthday) AS first_birthday\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\nGROUP BY l.\"U-PRO\"\nLIMIT 1000" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_5", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"ApYlbKxYtGKFx_rIgV3aQGXw0AT7SasD22mU_rP7f-M\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_6", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "ApYlbKxYtGKFx_rIgV3aQGXw0AT7SasD22mU_rP7f-M", + "expected_columns": [ + "patient_count" + ], + "expected_rows": 1, + "sql": "SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (CAST(l.\"U-PRO\" AS REAL) > 0 OR l.\"U-PRO\" IN ('TR', '%%'))\nLIMIT 1" + }, + "result": { + "content": [ + { + "type": "text", + "text": "1 row(s):\nOutput columns validated (projection only).\nOutput row count validated (executed SQL only).\nResult coverage: fetched_rows=1; displayed_rows=1; fetch_truncated=false; display_truncated=false; sql_rewritten=false; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): patient_count=int\npatient_count\n---\n71\nSQL: SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (CAST(l.\"U-PRO\" AS REAL) > 0 OR l.\"U-PRO\" IN ('TR', '%%'))\nLIMIT 1" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "```sql\nSELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (CAST(l.\"U-PRO\" AS REAL) > 0 OR l.\"U-PRO\" IN ('TR', '%%'))\nLIMIT 1\n```", + "event_parse_errors": [], + "rows": 1, + "sql": "SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (CAST(l.\"U-PRO\" AS REAL) > 0 OR l.\"U-PRO\" IN ('TR', '%%'))\nLIMIT 1", + "seconds": 30.475414666929282 +} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/records/bird495.json b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/records/bird495.json new file mode 100644 index 00000000..6163d321 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/records/bird495.json @@ -0,0 +1,195 @@ +{ + "instance_id": "bird495", + "profile": "codex-mcp", + "model": "gpt-6.2-astra", + "status": "predicted", + "calls": [], + "prompt_sha256": "a8c14bf30100acafa9be3de43d5e9e0d606fc9ecbbaff611e29f06291e448800", + "events_sha256": "6b56f47ecfc4b2b1b3185035090a97e1692d6da1e76629768e3cf57559f1a377", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 165921, + "cached_input_tokens": 154368, + "cache_write_input_tokens": 0, + "output_tokens": 995, + "reasoning_output_tokens": 52 + } + ], + "mcp_calls": [ + { + "id": "item_1", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "molecule" + }, + "result": { + "content": [ + { + "type": "text", + "text": "molecule (table)\n- molecule_id: TEXT NOT NULL\n- label: TEXT\nPRIMARY KEY (molecule_id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_2", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "bond" + }, + "result": { + "content": [ + { + "type": "text", + "text": "bond (table)\n- bond_id: TEXT NOT NULL\n- molecule_id: TEXT\n- bond_type: TEXT\nPRIMARY KEY (bond_id)\nFOREIGN KEY (molecule_id) REFERENCES molecule (molecule_id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_3", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "atom" + }, + "result": { + "content": [ + { + "type": "text", + "text": "atom (table)\n- atom_id: TEXT NOT NULL\n- molecule_id: TEXT\n- element: TEXT\nPRIMARY KEY (atom_id)\nFOREIGN KEY (molecule_id) REFERENCES molecule (molecule_id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_4", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"BM3HE_y240zFH_Rr2nASBNoaGHu5caJO__FiPtlx7Ek\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_5", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "connected" + }, + "result": { + "content": [ + { + "type": "text", + "text": "connected (table)\n- atom_id: TEXT NOT NULL\n- atom_id2: TEXT NOT NULL\n- bond_id: TEXT\nPRIMARY KEY (atom_id, atom_id2)\nFOREIGN KEY (bond_id) REFERENCES bond (bond_id)\nFOREIGN KEY (atom_id2) REFERENCES atom (atom_id)\nFOREIGN KEY (atom_id) REFERENCES atom (atom_id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_6", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "BM3HE_y240zFH_Rr2nASBNoaGHu5caJO__FiPtlx7Ek", + "sql": "SELECT b.bond_type, COUNT(DISTINCT b.bond_id) AS bonds, COUNT(c.bond_id) AS connections, COUNT(a.element) AS first_elements, COUNT(z.element) AS second_elements\nFROM main.bond AS b\nLEFT JOIN main.connected AS c ON c.bond_id = b.bond_id\nLEFT JOIN main.atom AS a ON a.atom_id = c.atom_id\nLEFT JOIN main.atom AS z ON z.atom_id = c.atom_id2\nWHERE b.molecule_id = 'TR377'\nGROUP BY b.bond_type" + }, + "result": { + "content": [ + { + "type": "text", + "text": "3 row(s):\nResult coverage: fetched_rows=3; displayed_rows=3; fetch_truncated=false; display_truncated=false; sql_rewritten=true; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): bond_type=str; bonds=int; connections=int; first_elements=int; second_elements=int\nbond_type | bonds | connections | first_elements | second_elements\n--- | --- | --- | --- | ---\n# | 2 | 4 | 4 | 4\n- | 12 | 24 | 24 | 24\n= | 4 | 8 | 8 | 8\nSQL: SELECT b.bond_type, COUNT(DISTINCT b.bond_id) AS bonds, COUNT(c.bond_id) AS connections, COUNT(a.element) AS first_elements, COUNT(z.element) AS second_elements\nFROM main.bond AS b\nLEFT JOIN main.connected AS c ON c.bond_id = b.bond_id\nLEFT JOIN main.atom AS a ON a.atom_id = c.atom_id\nLEFT JOIN main.atom AS z ON z.atom_id = c.atom_id2\nWHERE b.molecule_id = 'TR377'\nGROUP BY b.bond_type\nLIMIT 1000" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_7", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"SH8tHhKYFv7gvKWolr989r47sdfXX0QV47vLRtlORdA\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_8", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "SH8tHhKYFv7gvKWolr989r47sdfXX0QV47vLRtlORdA", + "expected_rows": 2, + "expected_columns": [ + "bond_type", + "bond_count", + "element_pair_count", + "carcinogenicity_label" + ], + "sql": "WITH pair_counts AS (\n SELECT b.bond_type,\n m.label,\n MIN(a1.element, a2.element) AS element_lo,\n MAX(a1.element, a2.element) AS element_hi,\n COUNT(DISTINCT b.bond_id) AS bonds_in_pair\n FROM main.bond AS b\n JOIN main.molecule AS m ON m.molecule_id = b.molecule_id\n JOIN main.connected AS c ON c.bond_id = b.bond_id\n JOIN main.atom AS a1 ON a1.atom_id = c.atom_id\n JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2\n WHERE b.molecule_id = 'TR377'\n AND b.bond_type IN ('-', '=')\n GROUP BY b.bond_type, m.label, element_lo, element_hi\n)\nSELECT bond_type,\n SUM(bonds_in_pair) AS bond_count,\n COUNT(*) AS element_pair_count,\n label AS carcinogenicity_label\nFROM pair_counts\nGROUP BY bond_type, label\nORDER BY bond_count DESC, bond_type ASC\nLIMIT 2" + }, + "result": { + "content": [ + { + "type": "text", + "text": "2 row(s):\nOutput columns validated (projection only).\nOutput row count validated (executed SQL only).\nResult coverage: fetched_rows=2; displayed_rows=2; fetch_truncated=false; display_truncated=false; sql_rewritten=false; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): bond_type=str; bond_count=int; element_pair_count=int; carcinogenicity_label=str\nbond_type | bond_count | element_pair_count | carcinogenicity_label\n--- | --- | --- | ---\n- | 12 | 3 | -\n= | 4 | 1 | -\nSQL: WITH pair_counts AS (\n SELECT b.bond_type,\n m.label,\n MIN(a1.element, a2.element) AS element_lo,\n MAX(a1.element, a2.element) AS element_hi,\n COUNT(DISTINCT b.bond_id) AS bonds_in_pair\n FROM main.bond AS b\n JOIN main.molecule AS m ON m.molecule_id = b.molecule_id\n JOIN main.connected AS c ON c.bond_id = b.bond_id\n JOIN main.atom AS a1 ON a1.atom_id = c.atom_id\n JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2\n WHERE b.molecule_id = 'TR377'\n AND b.bond_type IN ('-', '=')\n GROUP BY b.bond_type, m.label, element_lo, element_hi\n)\nSELECT bond_type,\n SUM(bonds_in_pair) AS bond_count,\n COUNT(*) AS element_pair_count,\n label AS carcinogenicity_label\nFROM pair_counts\nGROUP BY bond_type, label\nORDER BY bond_count DESC, bond_type ASC\nLIMIT 2" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "```sql\nWITH pair_counts AS (\n SELECT b.bond_type,\n m.label,\n MIN(a1.element, a2.element) AS element_lo,\n MAX(a1.element, a2.element) AS element_hi,\n COUNT(DISTINCT b.bond_id) AS bonds_in_pair\n FROM main.bond AS b\n JOIN main.molecule AS m ON m.molecule_id = b.molecule_id\n JOIN main.connected AS c ON c.bond_id = b.bond_id\n JOIN main.atom AS a1 ON a1.atom_id = c.atom_id\n JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2\n WHERE b.molecule_id = 'TR377'\n AND b.bond_type IN ('-', '=')\n GROUP BY b.bond_type, m.label, element_lo, element_hi\n)\nSELECT bond_type,\n SUM(bonds_in_pair) AS bond_count,\n COUNT(*) AS element_pair_count,\n label AS carcinogenicity_label\nFROM pair_counts\nGROUP BY bond_type, label\nORDER BY bond_count DESC, bond_type ASC\nLIMIT 2\n```", + "event_parse_errors": [], + "rows": 2, + "sql": "WITH pair_counts AS (\n SELECT b.bond_type,\n m.label,\n MIN(a1.element, a2.element) AS element_lo,\n MAX(a1.element, a2.element) AS element_hi,\n COUNT(DISTINCT b.bond_id) AS bonds_in_pair\n FROM main.bond AS b\n JOIN main.molecule AS m ON m.molecule_id = b.molecule_id\n JOIN main.connected AS c ON c.bond_id = b.bond_id\n JOIN main.atom AS a1 ON a1.atom_id = c.atom_id\n JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2\n WHERE b.molecule_id = 'TR377'\n AND b.bond_type IN ('-', '=')\n GROUP BY b.bond_type, m.label, element_lo, element_hi\n)\nSELECT bond_type,\n SUM(bonds_in_pair) AS bond_count,\n COUNT(*) AS element_pair_count,\n label AS carcinogenicity_label\nFROM pair_counts\nGROUP BY bond_type, label\nORDER BY bond_count DESC, bond_type ASC\nLIMIT 2", + "seconds": 38.891556249931455 +} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/scores.json b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/scores.json new file mode 100644 index 00000000..f3ed60b0 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/scores.json @@ -0,0 +1,12 @@ +[ + { + "instance_id": "bird467", + "score": 0, + "status": "predicted" + }, + { + "instance_id": "bird495", + "score": 1, + "status": "predicted" + } +] diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/sql/bird467.sql b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/sql/bird467.sql new file mode 100644 index 00000000..cf8dab7f --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/sql/bird467.sql @@ -0,0 +1,9 @@ +SELECT COUNT(DISTINCT l.ID) AS patient_count +FROM main.Laboratory AS l +JOIN main.Patient AS p ON p.ID = l.ID +WHERE l."Date" BETWEEN '1981-01-01' AND '1986-12-31' + AND l."Date" >= p.Birthday + AND l."Date" < date(p.Birthday, '+50 years') + AND l.PLT BETWEEN 100 AND 400 + AND (CAST(l."U-PRO" AS REAL) > 0 OR l."U-PRO" IN ('TR', '%%')) +LIMIT 1 diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/sql/bird495.sql b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/sql/bird495.sql new file mode 100644 index 00000000..bd866d2e --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/sql/bird495.sql @@ -0,0 +1,23 @@ +WITH pair_counts AS ( + SELECT b.bond_type, + m.label, + MIN(a1.element, a2.element) AS element_lo, + MAX(a1.element, a2.element) AS element_hi, + COUNT(DISTINCT b.bond_id) AS bonds_in_pair + FROM main.bond AS b + JOIN main.molecule AS m ON m.molecule_id = b.molecule_id + JOIN main.connected AS c ON c.bond_id = b.bond_id + JOIN main.atom AS a1 ON a1.atom_id = c.atom_id + JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2 + WHERE b.molecule_id = 'TR377' + AND b.bond_type IN ('-', '=') + GROUP BY b.bond_type, m.label, element_lo, element_hi +) +SELECT bond_type, + SUM(bonds_in_pair) AS bond_count, + COUNT(*) AS element_pair_count, + label AS carcinogenicity_label +FROM pair_counts +GROUP BY bond_type, label +ORDER BY bond_count DESC, bond_type ASC +LIMIT 2 diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/status.json b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/status.json new file mode 100644 index 00000000..54df7e77 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/codex-mcp/status.json @@ -0,0 +1,4 @@ +{ + "status": "completed", + "wall_seconds": 38.89484399999492 +} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/comparison/comparison.json b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/comparison/comparison.json new file mode 100644 index 00000000..96622ea5 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/comparison/comparison.json @@ -0,0 +1,793 @@ +{ + "scope": "Recorded score transitions on matched selected cases only; not full accuracy or proof of causality. CSV previews are text, not native SQL types. No semantic failure cause is inferred automatically.", + "sources": [ + { + "path": "/Users/seyoung/workspace/benchmarks/codex-mcp-unobserved-20261127/bird-gpt-6.2-astra", + "manifest_sha256": "557bb8528e2f60d42f90df19e32bc6ca0863e55727f704e1d6eeb22b20f54e89", + "scores_sha256": "160b6333e8b4ca303efc3845f5bb1a5cca709c96274bb32861f1de06ff55fa56", + "settings": { + "profiles": [ + { + "name": "codex-mcp", + "model": "gpt-6.2-astra", + "reasoning_effort": "high" + } + ], + "backend": "ChatGPT login -> Codex CLI -> production Lang2SQL MCP", + "revision": "0c7953905ee455c7611652924cb341e596d7937a", + "codex_version": "codex-cli 0.170.0", + "sources": { + "bench/accuracy/codex_mcp.py": "561eded13c1b46c3e942ea3a2904da46c65629b4201d28f4fb7e75d12ccf58c0", + "src/lang2sql/frontends/mcp/server.py": "0836ca4631f321c3f3a2c7524e71f6f31e60ac77286633833af6810d3443ddcb" + }, + "schema_document_sha256": "5176e324a72e80a8a37a12285596d123e0ba6c310dceaa9f13a1e413ee88ff5b", + "review_source": null, + "failure_selection": null, + "split": "development", + "concurrency": 2, + "case_timeout": 600.0, + "sql_timeout": 30, + "max_rows": 100000, + "api_calls": null, + "usage_unit": "one Codex CLI invocation per question; internal model-call count unavailable" + } + }, + { + "path": "/Users/seyoung/workspace/benchmarks/codex-mcp-official-values-last-failures-20261127/bird-gpt-6.2-astra", + "manifest_sha256": "89d88fef2d11d6a618bcbdf27cf9fcfbc23770f37d9231e801e06dc110fc0bbd", + "scores_sha256": "aef4e2f22eda86e750e71159195d4f850659d283738079696e45c45ec5a5583c", + "settings": { + "profiles": [ + { + "name": "codex-mcp", + "model": "gpt-6.2-astra", + "reasoning_effort": "high" + } + ], + "backend": "ChatGPT login -> Codex CLI -> production Lang2SQL MCP", + "revision": "71c3f5f6744d39df8703d0dc794cdfc253d5b60b", + "codex_version": "codex-cli 0.170.0", + "sources": { + "bench/accuracy/codex_mcp.py": "4812960452c27952ee3873575d97fb2dceaccafbdc57cca94afa3770f50297fc", + "src/lang2sql/frontends/mcp/server.py": "0836ca4631f321c3f3a2c7524e71f6f31e60ac77286633833af6810d3443ddcb" + }, + "schema_document_sha256": "7f3a02f99f90eadd69974fe5f45ca5d4abf90a1549e4deb46ae24b0093bde9c6", + "case_selection": { + "split": "all", + "input_cases": 2, + "selected_cases": 2, + "expected_cases": 2 + }, + "review_source": null, + "failure_selection": null, + "split": "all", + "concurrency": 2, + "case_timeout": 600.0, + "sql_timeout": 30, + "max_rows": 100000, + "api_calls": null, + "usage_unit": "one Codex CLI invocation per question; internal model-call count unavailable" + } + } + ], + "transitions": { + "0 -> 0": 1, + "0 -> 1": 1 + }, + "cases": [ + { + "input": { + "instance_id": "bird467", + "db": "thrombosis_prediction", + "question": "I'm preparing a case series on early renal involvement and need to size my cohort. How many patients were under age 50 on the day of a laboratory test performed between 1 January 1981 and 31 December 1986 inclusive, had a platelet count from 100 through 400 at that test, and showed proteinuria at that test? Age means completed years on the day of the test, so under 50 is strictly below 50. The platelet range is inclusive. I just need the number of patients satisfying all conditions.", + "evidence": "A patient showed proteinuria at a test when that test's dipstick reading reports protein: a dash or zero means no protein was found, a number is the amount of protein found, TR stands for trace protein, and a reading written in percent signs is the dipstick saturated, the strongest reading." + }, + "transition": "0 -> 0", + "sql_diff": "--- before.sql\n+++ after.sql\n@@ -5,9 +5,5 @@\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n- AND (\n- CAST(l.\"U-PRO\" AS REAL) > 0\n- OR l.\"U-PRO\" = 'TR'\n- OR (l.\"U-PRO\" GLOB '%*' AND l.\"U-PRO\" NOT GLOB '*[^%]*')\n- )\n+ AND (CAST(l.\"U-PRO\" AS REAL) > 0 OR l.\"U-PRO\" IN ('TR', '%%'))\n LIMIT 1", + "before": { + "score": 0, + "record_sha256": "d3bf7c4285d754b9ead9676aec6cf4cb28266819c18d9694880473d88d13c9bf", + "record": { + "instance_id": "bird467", + "profile": "codex-mcp", + "model": "gpt-6.2-astra", + "status": "predicted", + "calls": [], + "prompt_sha256": "c9433f1893324c36471300a85cfbc51fe98b0d24482967bcc7df1f67e0835e7c", + "events_sha256": "f0f9f5c6276a8ac3daf0a0b759c55613fac83ccff47b3e73759d297e411af7d7", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 167721, + "cached_input_tokens": 155776, + "cache_write_input_tokens": 0, + "output_tokens": 781, + "reasoning_output_tokens": 43 + } + ], + "mcp_calls": [ + { + "id": "item_1", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "Patient" + }, + "result": { + "content": [ + { + "type": "text", + "text": "Patient (table)\n- ID: INTEGER NOT NULL\n- SEX: TEXT\n- Birthday: DATE\n- Description: DATE\n- First Date: DATE\n- Admission: TEXT\n- Diagnosis: TEXT\nPRIMARY KEY (ID)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_2", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"-HgKlwWMQQy4H8NVKqiY7PV5UOtNy0UEaRUfCf3MBw8\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_3", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "Laboratory" + }, + "result": { + "content": [ + { + "type": "text", + "text": "Laboratory (table)\n- ID: INTEGER NOT NULL\n- Date: DATE NOT NULL\n- GOT: INTEGER\n- GPT: INTEGER\n- LDH: INTEGER\n- ALP: INTEGER\n- TP: REAL\n- ALB: REAL\n- UA: REAL\n- UN: INTEGER\n- CRE: REAL\n- T-BIL: REAL\n- T-CHO: INTEGER\n- TG: INTEGER\n- CPK: INTEGER\n- GLU: INTEGER\n- WBC: REAL\n- RBC: REAL\n- HGB: REAL\n- HCT: REAL\n- PLT: INTEGER\n- PT: REAL\n- APTT: INTEGER\n- FG: REAL\n- PIC: INTEGER\n- TAT: INTEGER\n- TAT2: INTEGER\n- U-PRO: TEXT\n- IGG: INTEGER\n- IGA: INTEGER\n- IGM: INTEGER\n- CRP: TEXT\n- RA: TEXT\n- RF: TEXT\n- C3: INTEGER\n- C4: INTEGER\n- RNP: TEXT\n- SM: TEXT\n- SC170: TEXT\n- SSA: TEXT\n- SSB: TEXT\n- CENTROMEA: TEXT\n- DNA: TEXT\n- DNA-II: INTEGER\nPRIMARY KEY (ID, Date)\nFOREIGN KEY (ID) REFERENCES Patient (ID)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_4", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "-HgKlwWMQQy4H8NVKqiY7PV5UOtNy0UEaRUfCf3MBw8", + "sql": "SELECT l.\"U-PRO\", COUNT(*) AS tests, MIN(l.\"Date\"), MAX(l.\"Date\")\nFROM main.Laboratory AS l\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\nGROUP BY l.\"U-PRO\"" + }, + "result": { + "content": [ + { + "type": "text", + "text": "8 row(s):\nResult coverage: fetched_rows=8; displayed_rows=8; fetch_truncated=false; display_truncated=false; sql_rewritten=true; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): U-PRO=NoneType,str; tests=int; MIN(l.\"Date\")=str; MAX(l.\"Date\")=str\nU-PRO | tests | MIN(l.\"Date\") | MAX(l.\"Date\")\n--- | --- | --- | ---\nNone | 1920 | 1981-01-27 | 1986-12-25\n%% | 4 | 1982-09-06 | 1986-03-10\n0 | 2729 | 1981-01-27 | 1986-12-23\n1 | 318 | 1981-04-06 | 1986-12-22\n2 | 313 | 1981-03-30 | 1986-12-15\n3 | 147 | 1981-03-16 | 1986-12-22\n4 | 21 | 1981-03-23 | 1986-04-28\nTR | 499 | 1981-02-19 | 1986-12-25\nSQL: SELECT l.\"U-PRO\", COUNT(*) AS tests, MIN(l.\"Date\"), MAX(l.\"Date\")\nFROM main.Laboratory AS l\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\nGROUP BY l.\"U-PRO\"\nLIMIT 1000" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_5", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"O6i9j5tQluuj3FkWHFv1UBq11qMivf_S33_YWlZAetk\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_6", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "O6i9j5tQluuj3FkWHFv1UBq11qMivf_S33_YWlZAetk", + "expected_columns": [ + "patient_count" + ], + "sql": "SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (\n CAST(l.\"U-PRO\" AS REAL) > 0\n OR l.\"U-PRO\" = 'TR'\n OR (l.\"U-PRO\" GLOB '%*' AND l.\"U-PRO\" NOT GLOB '*[^%]*')\n )\nLIMIT 1" + }, + "result": { + "content": [ + { + "type": "text", + "text": "1 row(s):\nOutput columns validated (projection only).\nResult coverage: fetched_rows=1; displayed_rows=1; fetch_truncated=false; display_truncated=false; sql_rewritten=false; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): patient_count=int\npatient_count\n---\n71\nSQL: SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (\n CAST(l.\"U-PRO\" AS REAL) > 0\n OR l.\"U-PRO\" = 'TR'\n OR (l.\"U-PRO\" GLOB '%*' AND l.\"U-PRO\" NOT GLOB '*[^%]*')\n )\nLIMIT 1" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "```sql\nSELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (\n CAST(l.\"U-PRO\" AS REAL) > 0\n OR l.\"U-PRO\" = 'TR'\n OR (l.\"U-PRO\" GLOB '%*' AND l.\"U-PRO\" NOT GLOB '*[^%]*')\n )\nLIMIT 1\n```", + "event_parse_errors": [], + "rows": 1, + "sql": "SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (\n CAST(l.\"U-PRO\" AS REAL) > 0\n OR l.\"U-PRO\" = 'TR'\n OR (l.\"U-PRO\" GLOB '%*' AND l.\"U-PRO\" NOT GLOB '*[^%]*')\n )\nLIMIT 1", + "seconds": 30.716697375057265 + }, + "result": { + "columns": [ + "patient_count" + ], + "row_count": 1, + "preview": [ + [ + "71" + ] + ], + "preview_truncated": false, + "csv_sha256": "9541ce50dc06713548554e1a49081d739e076ac3e4c4b1186aeed5b06b3313bc" + } + }, + "after": { + "score": 0, + "record_sha256": "ace676de777f7445298264e69be127e09c0485364387d43d2e98713f4a83a788", + "record": { + "instance_id": "bird467", + "profile": "codex-mcp", + "model": "gpt-6.2-astra", + "status": "predicted", + "calls": [], + "prompt_sha256": "f3edaf9e4dc49ac60e37e0a804dbda0947e6f058351c2e000d6e178d6ec7aa08", + "events_sha256": "ce1c1e772137a7c87670959bbe9934b80348ae7bce685e36ea1e3fcb90c356d1", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 195033, + "cached_input_tokens": 179456, + "cache_write_input_tokens": 0, + "output_tokens": 741, + "reasoning_output_tokens": 31 + } + ], + "mcp_calls": [ + { + "id": "item_1", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "Laboratory" + }, + "result": { + "content": [ + { + "type": "text", + "text": "Laboratory (table)\n- ID: INTEGER NOT NULL\n- Date: DATE NOT NULL\n- GOT: INTEGER\n- GPT: INTEGER\n- LDH: INTEGER\n- ALP: INTEGER\n- TP: REAL\n- ALB: REAL\n- UA: REAL\n- UN: INTEGER\n- CRE: REAL\n- T-BIL: REAL\n- T-CHO: INTEGER\n- TG: INTEGER\n- CPK: INTEGER\n- GLU: INTEGER\n- WBC: REAL\n- RBC: REAL\n- HGB: REAL\n- HCT: REAL\n- PLT: INTEGER\n- PT: REAL\n- APTT: INTEGER\n- FG: REAL\n- PIC: INTEGER\n- TAT: INTEGER\n- TAT2: INTEGER\n- U-PRO: TEXT\n- IGG: INTEGER\n- IGA: INTEGER\n- IGM: INTEGER\n- CRP: TEXT\n- RA: TEXT\n- RF: TEXT\n- C3: INTEGER\n- C4: INTEGER\n- RNP: TEXT\n- SM: TEXT\n- SC170: TEXT\n- SSA: TEXT\n- SSB: TEXT\n- CENTROMEA: TEXT\n- DNA: TEXT\n- DNA-II: INTEGER\nPRIMARY KEY (ID, Date)\nFOREIGN KEY (ID) REFERENCES Patient (ID)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_2", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"GBFt8p4hba4Qw9YVnOYVTN7-sGepqWwpPzXRFgsqN80\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_3", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "Patient" + }, + "result": { + "content": [ + { + "type": "text", + "text": "Patient (table)\n- ID: INTEGER NOT NULL\n- SEX: TEXT\n- Birthday: DATE\n- Description: DATE\n- First Date: DATE\n- Admission: TEXT\n- Diagnosis: TEXT\nPRIMARY KEY (ID)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_4", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "GBFt8p4hba4Qw9YVnOYVTN7-sGepqWwpPzXRFgsqN80", + "sql": "SELECT l.\"U-PRO\" AS reading, COUNT(*) AS tests, MIN(l.\"Date\") AS first_test, MIN(p.Birthday) AS first_birthday\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\nGROUP BY l.\"U-PRO\"" + }, + "result": { + "content": [ + { + "type": "text", + "text": "8 row(s):\nResult coverage: fetched_rows=8; displayed_rows=8; fetch_truncated=false; display_truncated=false; sql_rewritten=true; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): reading=NoneType,str; tests=int; first_test=str; first_birthday=str\nreading | tests | first_test | first_birthday\n--- | --- | --- | ---\nNone | 1920 | 1981-01-27 | 1917-04-18\n%% | 4 | 1982-09-06 | 1929-07-05\n0 | 2729 | 1981-01-27 | 1917-04-18\n1 | 318 | 1981-04-06 | 1926-08-01\n2 | 313 | 1981-03-30 | 1926-08-01\n3 | 147 | 1981-03-16 | 1935-04-19\n4 | 21 | 1981-03-23 | 1943-05-19\nTR | 499 | 1981-02-19 | 1919-12-30\nSQL: SELECT l.\"U-PRO\" AS reading, COUNT(*) AS tests, MIN(l.\"Date\") AS first_test, MIN(p.Birthday) AS first_birthday\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\nGROUP BY l.\"U-PRO\"\nLIMIT 1000" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_5", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"ApYlbKxYtGKFx_rIgV3aQGXw0AT7SasD22mU_rP7f-M\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_6", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "ApYlbKxYtGKFx_rIgV3aQGXw0AT7SasD22mU_rP7f-M", + "expected_columns": [ + "patient_count" + ], + "expected_rows": 1, + "sql": "SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (CAST(l.\"U-PRO\" AS REAL) > 0 OR l.\"U-PRO\" IN ('TR', '%%'))\nLIMIT 1" + }, + "result": { + "content": [ + { + "type": "text", + "text": "1 row(s):\nOutput columns validated (projection only).\nOutput row count validated (executed SQL only).\nResult coverage: fetched_rows=1; displayed_rows=1; fetch_truncated=false; display_truncated=false; sql_rewritten=false; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): patient_count=int\npatient_count\n---\n71\nSQL: SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (CAST(l.\"U-PRO\" AS REAL) > 0 OR l.\"U-PRO\" IN ('TR', '%%'))\nLIMIT 1" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "```sql\nSELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (CAST(l.\"U-PRO\" AS REAL) > 0 OR l.\"U-PRO\" IN ('TR', '%%'))\nLIMIT 1\n```", + "event_parse_errors": [], + "rows": 1, + "sql": "SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (CAST(l.\"U-PRO\" AS REAL) > 0 OR l.\"U-PRO\" IN ('TR', '%%'))\nLIMIT 1", + "seconds": 30.475414666929282 + }, + "result": { + "columns": [ + "patient_count" + ], + "row_count": 1, + "preview": [ + [ + "71" + ] + ], + "preview_truncated": false, + "csv_sha256": "9541ce50dc06713548554e1a49081d739e076ac3e4c4b1186aeed5b06b3313bc" + } + } + }, + { + "input": { + "instance_id": "bird495", + "db": "toxicology", + "question": "For molecule TR377, I'd like a profile of its bond composition, covering single and double bonds only. For each bond kind, please give me: the bond kind symbol, the number of bonds of that kind in the molecule, and the number of element pairs that bond kind joins. Also include the molecule's carcinogenicity label. List the bond kinds from most frequent to least; if two kinds are equally frequent, list them alphabetically by symbol.", + "evidence": "A single bond is shown as the symbol '-' and a double bond as '='; a molecule label '+' means carcinogenic and '-' means not carcinogenic." + }, + "transition": "0 -> 1", + "sql_diff": "--- before.sql\n+++ after.sql\n@@ -0,0 +1,23 @@\n+WITH pair_counts AS (\n+ SELECT b.bond_type,\n+ m.label,\n+ MIN(a1.element, a2.element) AS element_lo,\n+ MAX(a1.element, a2.element) AS element_hi,\n+ COUNT(DISTINCT b.bond_id) AS bonds_in_pair\n+ FROM main.bond AS b\n+ JOIN main.molecule AS m ON m.molecule_id = b.molecule_id\n+ JOIN main.connected AS c ON c.bond_id = b.bond_id\n+ JOIN main.atom AS a1 ON a1.atom_id = c.atom_id\n+ JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2\n+ WHERE b.molecule_id = 'TR377'\n+ AND b.bond_type IN ('-', '=')\n+ GROUP BY b.bond_type, m.label, element_lo, element_hi\n+)\n+SELECT bond_type,\n+ SUM(bonds_in_pair) AS bond_count,\n+ COUNT(*) AS element_pair_count,\n+ label AS carcinogenicity_label\n+FROM pair_counts\n+GROUP BY bond_type, label\n+ORDER BY bond_count DESC, bond_type ASC\n+LIMIT 2", + "before": { + "score": 0, + "record_sha256": "68e322b0ca3ffe27ff2bf543eac537af684ec39e8085b390c1c91e34cd78786c", + "record": { + "instance_id": "bird495", + "profile": "codex-mcp", + "model": "gpt-6.2-astra", + "status": "failed", + "calls": [], + "prompt_sha256": "7334354b2a5c2ef8bcf59180b0dc97629cb7fb3aad7acf5a4a8334e5e91e51d1", + "events_sha256": "d9a795b8a637700c839a3ed2a5c3337580cb4641a83be152d7bb9e5d6d38e94a", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 110269, + "cached_input_tokens": 100480, + "cache_write_input_tokens": 0, + "output_tokens": 477, + "reasoning_output_tokens": 232 + } + ], + "mcp_calls": [ + { + "id": "item_1", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "connected" + }, + "result": { + "content": [ + { + "type": "text", + "text": "connected (table)\n- atom_id: TEXT NOT NULL\n- atom_id2: TEXT NOT NULL\n- bond_id: TEXT\nPRIMARY KEY (atom_id, atom_id2)\nFOREIGN KEY (bond_id) REFERENCES bond (bond_id)\nFOREIGN KEY (atom_id2) REFERENCES atom (atom_id)\nFOREIGN KEY (atom_id) REFERENCES atom (atom_id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_2", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "bond" + }, + "result": { + "content": [ + { + "type": "text", + "text": "bond (table)\n- bond_id: TEXT NOT NULL\n- molecule_id: TEXT\n- bond_type: TEXT\nPRIMARY KEY (bond_id)\nFOREIGN KEY (molecule_id) REFERENCES molecule (molecule_id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_3", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "atom" + }, + "result": { + "content": [ + { + "type": "text", + "text": "atom (table)\n- atom_id: TEXT NOT NULL\n- molecule_id: TEXT\n- element: TEXT\nPRIMARY KEY (atom_id)\nFOREIGN KEY (molecule_id) REFERENCES molecule (molecule_id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_4", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [ + "element pairs" + ] + }, + "result": { + "content": [ + { + "type": "text", + "text": "DEFINITION_REQUIRED: No confirmed definition in this scope for: [\"element pairs\"]. SQL was NOT executed. Ask the user for the exact business definition and intended team/org/user scope. Do not infer a definition or register a guessed definition. After explicit user clarification, stage the definition with context_candidates. An operator must approve it before you resolve_business_terms again." + } + ], + "structured_content": null + }, + "error": null, + "status": "failed" + }, + { + "id": "item_5", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "molecule" + }, + "result": { + "content": [ + { + "type": "text", + "text": "molecule (table)\n- molecule_id: TEXT NOT NULL\n- label: TEXT\nPRIMARY KEY (molecule_id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "Should each bond kind count distinct unordered element pairs, so every carbon–oxygen bond contributes to the bond count, but carbon–oxygen counts only once toward the element-pair count?", + "event_parse_errors": [], + "error_type": "ValueError", + "error_message": "Final answer must contain exactly one SQL block; no last-tool fallback", + "seconds": 28.63834737497382 + }, + "result": null + }, + "after": { + "score": 1, + "record_sha256": "02c14827ddc59eff953b526c2fdbf24629daf98f315100514be3520f63c0a2d4", + "record": { + "instance_id": "bird495", + "profile": "codex-mcp", + "model": "gpt-6.2-astra", + "status": "predicted", + "calls": [], + "prompt_sha256": "a8c14bf30100acafa9be3de43d5e9e0d606fc9ecbbaff611e29f06291e448800", + "events_sha256": "6b56f47ecfc4b2b1b3185035090a97e1692d6da1e76629768e3cf57559f1a377", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 165921, + "cached_input_tokens": 154368, + "cache_write_input_tokens": 0, + "output_tokens": 995, + "reasoning_output_tokens": 52 + } + ], + "mcp_calls": [ + { + "id": "item_1", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "molecule" + }, + "result": { + "content": [ + { + "type": "text", + "text": "molecule (table)\n- molecule_id: TEXT NOT NULL\n- label: TEXT\nPRIMARY KEY (molecule_id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_2", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "bond" + }, + "result": { + "content": [ + { + "type": "text", + "text": "bond (table)\n- bond_id: TEXT NOT NULL\n- molecule_id: TEXT\n- bond_type: TEXT\nPRIMARY KEY (bond_id)\nFOREIGN KEY (molecule_id) REFERENCES molecule (molecule_id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_3", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "atom" + }, + "result": { + "content": [ + { + "type": "text", + "text": "atom (table)\n- atom_id: TEXT NOT NULL\n- molecule_id: TEXT\n- element: TEXT\nPRIMARY KEY (atom_id)\nFOREIGN KEY (molecule_id) REFERENCES molecule (molecule_id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_4", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"BM3HE_y240zFH_Rr2nASBNoaGHu5caJO__FiPtlx7Ek\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_5", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "connected" + }, + "result": { + "content": [ + { + "type": "text", + "text": "connected (table)\n- atom_id: TEXT NOT NULL\n- atom_id2: TEXT NOT NULL\n- bond_id: TEXT\nPRIMARY KEY (atom_id, atom_id2)\nFOREIGN KEY (bond_id) REFERENCES bond (bond_id)\nFOREIGN KEY (atom_id2) REFERENCES atom (atom_id)\nFOREIGN KEY (atom_id) REFERENCES atom (atom_id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_6", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "BM3HE_y240zFH_Rr2nASBNoaGHu5caJO__FiPtlx7Ek", + "sql": "SELECT b.bond_type, COUNT(DISTINCT b.bond_id) AS bonds, COUNT(c.bond_id) AS connections, COUNT(a.element) AS first_elements, COUNT(z.element) AS second_elements\nFROM main.bond AS b\nLEFT JOIN main.connected AS c ON c.bond_id = b.bond_id\nLEFT JOIN main.atom AS a ON a.atom_id = c.atom_id\nLEFT JOIN main.atom AS z ON z.atom_id = c.atom_id2\nWHERE b.molecule_id = 'TR377'\nGROUP BY b.bond_type" + }, + "result": { + "content": [ + { + "type": "text", + "text": "3 row(s):\nResult coverage: fetched_rows=3; displayed_rows=3; fetch_truncated=false; display_truncated=false; sql_rewritten=true; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): bond_type=str; bonds=int; connections=int; first_elements=int; second_elements=int\nbond_type | bonds | connections | first_elements | second_elements\n--- | --- | --- | --- | ---\n# | 2 | 4 | 4 | 4\n- | 12 | 24 | 24 | 24\n= | 4 | 8 | 8 | 8\nSQL: SELECT b.bond_type, COUNT(DISTINCT b.bond_id) AS bonds, COUNT(c.bond_id) AS connections, COUNT(a.element) AS first_elements, COUNT(z.element) AS second_elements\nFROM main.bond AS b\nLEFT JOIN main.connected AS c ON c.bond_id = b.bond_id\nLEFT JOIN main.atom AS a ON a.atom_id = c.atom_id\nLEFT JOIN main.atom AS z ON z.atom_id = c.atom_id2\nWHERE b.molecule_id = 'TR377'\nGROUP BY b.bond_type\nLIMIT 1000" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_7", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"SH8tHhKYFv7gvKWolr989r47sdfXX0QV47vLRtlORdA\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_8", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "SH8tHhKYFv7gvKWolr989r47sdfXX0QV47vLRtlORdA", + "expected_rows": 2, + "expected_columns": [ + "bond_type", + "bond_count", + "element_pair_count", + "carcinogenicity_label" + ], + "sql": "WITH pair_counts AS (\n SELECT b.bond_type,\n m.label,\n MIN(a1.element, a2.element) AS element_lo,\n MAX(a1.element, a2.element) AS element_hi,\n COUNT(DISTINCT b.bond_id) AS bonds_in_pair\n FROM main.bond AS b\n JOIN main.molecule AS m ON m.molecule_id = b.molecule_id\n JOIN main.connected AS c ON c.bond_id = b.bond_id\n JOIN main.atom AS a1 ON a1.atom_id = c.atom_id\n JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2\n WHERE b.molecule_id = 'TR377'\n AND b.bond_type IN ('-', '=')\n GROUP BY b.bond_type, m.label, element_lo, element_hi\n)\nSELECT bond_type,\n SUM(bonds_in_pair) AS bond_count,\n COUNT(*) AS element_pair_count,\n label AS carcinogenicity_label\nFROM pair_counts\nGROUP BY bond_type, label\nORDER BY bond_count DESC, bond_type ASC\nLIMIT 2" + }, + "result": { + "content": [ + { + "type": "text", + "text": "2 row(s):\nOutput columns validated (projection only).\nOutput row count validated (executed SQL only).\nResult coverage: fetched_rows=2; displayed_rows=2; fetch_truncated=false; display_truncated=false; sql_rewritten=false; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): bond_type=str; bond_count=int; element_pair_count=int; carcinogenicity_label=str\nbond_type | bond_count | element_pair_count | carcinogenicity_label\n--- | --- | --- | ---\n- | 12 | 3 | -\n= | 4 | 1 | -\nSQL: WITH pair_counts AS (\n SELECT b.bond_type,\n m.label,\n MIN(a1.element, a2.element) AS element_lo,\n MAX(a1.element, a2.element) AS element_hi,\n COUNT(DISTINCT b.bond_id) AS bonds_in_pair\n FROM main.bond AS b\n JOIN main.molecule AS m ON m.molecule_id = b.molecule_id\n JOIN main.connected AS c ON c.bond_id = b.bond_id\n JOIN main.atom AS a1 ON a1.atom_id = c.atom_id\n JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2\n WHERE b.molecule_id = 'TR377'\n AND b.bond_type IN ('-', '=')\n GROUP BY b.bond_type, m.label, element_lo, element_hi\n)\nSELECT bond_type,\n SUM(bonds_in_pair) AS bond_count,\n COUNT(*) AS element_pair_count,\n label AS carcinogenicity_label\nFROM pair_counts\nGROUP BY bond_type, label\nORDER BY bond_count DESC, bond_type ASC\nLIMIT 2" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "```sql\nWITH pair_counts AS (\n SELECT b.bond_type,\n m.label,\n MIN(a1.element, a2.element) AS element_lo,\n MAX(a1.element, a2.element) AS element_hi,\n COUNT(DISTINCT b.bond_id) AS bonds_in_pair\n FROM main.bond AS b\n JOIN main.molecule AS m ON m.molecule_id = b.molecule_id\n JOIN main.connected AS c ON c.bond_id = b.bond_id\n JOIN main.atom AS a1 ON a1.atom_id = c.atom_id\n JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2\n WHERE b.molecule_id = 'TR377'\n AND b.bond_type IN ('-', '=')\n GROUP BY b.bond_type, m.label, element_lo, element_hi\n)\nSELECT bond_type,\n SUM(bonds_in_pair) AS bond_count,\n COUNT(*) AS element_pair_count,\n label AS carcinogenicity_label\nFROM pair_counts\nGROUP BY bond_type, label\nORDER BY bond_count DESC, bond_type ASC\nLIMIT 2\n```", + "event_parse_errors": [], + "rows": 2, + "sql": "WITH pair_counts AS (\n SELECT b.bond_type,\n m.label,\n MIN(a1.element, a2.element) AS element_lo,\n MAX(a1.element, a2.element) AS element_hi,\n COUNT(DISTINCT b.bond_id) AS bonds_in_pair\n FROM main.bond AS b\n JOIN main.molecule AS m ON m.molecule_id = b.molecule_id\n JOIN main.connected AS c ON c.bond_id = b.bond_id\n JOIN main.atom AS a1 ON a1.atom_id = c.atom_id\n JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2\n WHERE b.molecule_id = 'TR377'\n AND b.bond_type IN ('-', '=')\n GROUP BY b.bond_type, m.label, element_lo, element_hi\n)\nSELECT bond_type,\n SUM(bonds_in_pair) AS bond_count,\n COUNT(*) AS element_pair_count,\n label AS carcinogenicity_label\nFROM pair_counts\nGROUP BY bond_type, label\nORDER BY bond_count DESC, bond_type ASC\nLIMIT 2", + "seconds": 38.891556249931455 + }, + "result": { + "columns": [ + "bond_type", + "bond_count", + "element_pair_count", + "carcinogenicity_label" + ], + "row_count": 2, + "preview": [ + [ + "-", + "12", + "3", + "-" + ], + [ + "=", + "4", + "1", + "-" + ] + ], + "preview_truncated": false, + "csv_sha256": "ba193968c57a78e13a7e9f42b86445fd764efa4129491417e626b1169460e0bb" + } + } + } + ] +} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/comparison/index.html b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/comparison/index.html new file mode 100644 index 00000000..451bd17c --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/comparison/index.html @@ -0,0 +1,756 @@ +Lang2SQL trace comparison

Lang2SQL trace comparison

Recorded score transitions on matched selected cases only; not full accuracy or proof of causality. CSV previews are text, not native SQL types. No semantic failure cause is inferred automatically.
{
+  "0 -> 0": 1,
+  "0 -> 1": 1
+}
Provenance and settings
[
+  {
+    "path": "/Users/seyoung/workspace/benchmarks/codex-mcp-unobserved-20261127/bird-gpt-6.2-astra",
+    "manifest_sha256": "557bb8528e2f60d42f90df19e32bc6ca0863e55727f704e1d6eeb22b20f54e89",
+    "scores_sha256": "160b6333e8b4ca303efc3845f5bb1a5cca709c96274bb32861f1de06ff55fa56",
+    "settings": {
+      "profiles": [
+        {
+          "name": "codex-mcp",
+          "model": "gpt-6.2-astra",
+          "reasoning_effort": "high"
+        }
+      ],
+      "backend": "ChatGPT login -> Codex CLI -> production Lang2SQL MCP",
+      "revision": "0c7953905ee455c7611652924cb341e596d7937a",
+      "codex_version": "codex-cli 0.170.0",
+      "sources": {
+        "bench/accuracy/codex_mcp.py": "561eded13c1b46c3e942ea3a2904da46c65629b4201d28f4fb7e75d12ccf58c0",
+        "src/lang2sql/frontends/mcp/server.py": "0836ca4631f321c3f3a2c7524e71f6f31e60ac77286633833af6810d3443ddcb"
+      },
+      "schema_document_sha256": "5176e324a72e80a8a37a12285596d123e0ba6c310dceaa9f13a1e413ee88ff5b",
+      "review_source": null,
+      "failure_selection": null,
+      "split": "development",
+      "concurrency": 2,
+      "case_timeout": 600.0,
+      "sql_timeout": 30,
+      "max_rows": 100000,
+      "api_calls": null,
+      "usage_unit": "one Codex CLI invocation per question; internal model-call count unavailable"
+    }
+  },
+  {
+    "path": "/Users/seyoung/workspace/benchmarks/codex-mcp-official-values-last-failures-20261127/bird-gpt-6.2-astra",
+    "manifest_sha256": "89d88fef2d11d6a618bcbdf27cf9fcfbc23770f37d9231e801e06dc110fc0bbd",
+    "scores_sha256": "aef4e2f22eda86e750e71159195d4f850659d283738079696e45c45ec5a5583c",
+    "settings": {
+      "profiles": [
+        {
+          "name": "codex-mcp",
+          "model": "gpt-6.2-astra",
+          "reasoning_effort": "high"
+        }
+      ],
+      "backend": "ChatGPT login -> Codex CLI -> production Lang2SQL MCP",
+      "revision": "71c3f5f6744d39df8703d0dc794cdfc253d5b60b",
+      "codex_version": "codex-cli 0.170.0",
+      "sources": {
+        "bench/accuracy/codex_mcp.py": "4812960452c27952ee3873575d97fb2dceaccafbdc57cca94afa3770f50297fc",
+        "src/lang2sql/frontends/mcp/server.py": "0836ca4631f321c3f3a2c7524e71f6f31e60ac77286633833af6810d3443ddcb"
+      },
+      "schema_document_sha256": "7f3a02f99f90eadd69974fe5f45ca5d4abf90a1549e4deb46ae24b0093bde9c6",
+      "case_selection": {
+        "split": "all",
+        "input_cases": 2,
+        "selected_cases": 2,
+        "expected_cases": 2
+      },
+      "review_source": null,
+      "failure_selection": null,
+      "split": "all",
+      "concurrency": 2,
+      "case_timeout": 600.0,
+      "sql_timeout": 30,
+      "max_rows": 100000,
+      "api_calls": null,
+      "usage_unit": "one Codex CLI invocation per question; internal model-call count unavailable"
+    }
+  }
+]
bird467: 0 -> 0
{
+  "instance_id": "bird467",
+  "db": "thrombosis_prediction",
+  "question": "I'm preparing a case series on early renal involvement and need to size my cohort. How many patients were under age 50 on the day of a laboratory test performed between 1 January 1981 and 31 December 1986 inclusive, had a platelet count from 100 through 400 at that test, and showed proteinuria at that test? Age means completed years on the day of the test, so under 50 is strictly below 50. The platelet range is inclusive. I just need the number of patients satisfying all conditions.",
+  "evidence": "A patient showed proteinuria at a test when that test's dipstick reading reports protein: a dash or zero means no protein was found, a number is the amount of protein found, TR stands for trace protein, and a reading written in percent signs is the dipstick saturated, the strongest reading."
+}

SQL diff

--- before.sql
++++ after.sql
+@@ -5,9 +5,5 @@
+   AND l."Date" >= p.Birthday
+   AND l."Date" < date(p.Birthday, '+50 years')
+   AND l.PLT BETWEEN 100 AND 400
+-  AND (
+-      CAST(l."U-PRO" AS REAL) > 0
+-      OR l."U-PRO" = 'TR'
+-      OR (l."U-PRO" GLOB '%*' AND l."U-PRO" NOT GLOB '*[^%]*')
+-  )
++  AND (CAST(l."U-PRO" AS REAL) > 0 OR l."U-PRO" IN ('TR', '%%'))
+ LIMIT 1

before: score 0

{
+  "status": "predicted",
+  "error_type": null,
+  "error_message": null,
+  "seconds": 30.716697375057265
+}

Final SQL / answer

SELECT COUNT(DISTINCT l.ID) AS patient_count
+FROM main.Laboratory AS l
+JOIN main.Patient AS p ON p.ID = l.ID
+WHERE l."Date" BETWEEN '1981-01-01' AND '1986-12-31'
+  AND l."Date" >= p.Birthday
+  AND l."Date" < date(p.Birthday, '+50 years')
+  AND l.PLT BETWEEN 100 AND 400
+  AND (
+      CAST(l."U-PRO" AS REAL) > 0
+      OR l."U-PRO" = 'TR'
+      OR (l."U-PRO" GLOB '%*' AND l."U-PRO" NOT GLOB '*[^%]*')
+  )
+LIMIT 1

Result preview (up to 20 rows; full row count below)

{
+  "columns": [
+    "patient_count"
+  ],
+  "row_count": 1,
+  "preview": [
+    [
+      "71"
+    ]
+  ],
+  "preview_truncated": false,
+  "csv_sha256": "9541ce50dc06713548554e1a49081d739e076ac3e4c4b1186aeed5b06b3313bc"
+}
Every MCP call: arguments and results
[
+  {
+    "id": "item_1",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "explore_schema",
+    "arguments": {
+      "table": "Patient"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "Patient (table)\n- ID: INTEGER NOT NULL\n- SEX: TEXT\n- Birthday: DATE\n- Description: DATE\n- First Date: DATE\n- Admission: TEXT\n- Diagnosis: TEXT\nPRIMARY KEY (ID)"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_2",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "resolve_business_terms",
+    "arguments": {
+      "terms": []
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "{\"definition_check_id\": \"-HgKlwWMQQy4H8NVKqiY7PV5UOtNy0UEaRUfCf3MBw8\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_3",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "explore_schema",
+    "arguments": {
+      "table": "Laboratory"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "Laboratory (table)\n- ID: INTEGER NOT NULL\n- Date: DATE NOT NULL\n- GOT: INTEGER\n- GPT: INTEGER\n- LDH: INTEGER\n- ALP: INTEGER\n- TP: REAL\n- ALB: REAL\n- UA: REAL\n- UN: INTEGER\n- CRE: REAL\n- T-BIL: REAL\n- T-CHO: INTEGER\n- TG: INTEGER\n- CPK: INTEGER\n- GLU: INTEGER\n- WBC: REAL\n- RBC: REAL\n- HGB: REAL\n- HCT: REAL\n- PLT: INTEGER\n- PT: REAL\n- APTT: INTEGER\n- FG: REAL\n- PIC: INTEGER\n- TAT: INTEGER\n- TAT2: INTEGER\n- U-PRO: TEXT\n- IGG: INTEGER\n- IGA: INTEGER\n- IGM: INTEGER\n- CRP: TEXT\n- RA: TEXT\n- RF: TEXT\n- C3: INTEGER\n- C4: INTEGER\n- RNP: TEXT\n- SM: TEXT\n- SC170: TEXT\n- SSA: TEXT\n- SSB: TEXT\n- CENTROMEA: TEXT\n- DNA: TEXT\n- DNA-II: INTEGER\nPRIMARY KEY (ID, Date)\nFOREIGN KEY (ID) REFERENCES Patient (ID)"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_4",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "run_sql",
+    "arguments": {
+      "definition_check_id": "-HgKlwWMQQy4H8NVKqiY7PV5UOtNy0UEaRUfCf3MBw8",
+      "sql": "SELECT l.\"U-PRO\", COUNT(*) AS tests, MIN(l.\"Date\"), MAX(l.\"Date\")\nFROM main.Laboratory AS l\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\nGROUP BY l.\"U-PRO\""
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "8 row(s):\nResult coverage: fetched_rows=8; displayed_rows=8; fetch_truncated=false; display_truncated=false; sql_rewritten=true; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): U-PRO=NoneType,str; tests=int; MIN(l.\"Date\")=str; MAX(l.\"Date\")=str\nU-PRO | tests | MIN(l.\"Date\") | MAX(l.\"Date\")\n--- | --- | --- | ---\nNone | 1920 | 1981-01-27 | 1986-12-25\n%% | 4 | 1982-09-06 | 1986-03-10\n0 | 2729 | 1981-01-27 | 1986-12-23\n1 | 318 | 1981-04-06 | 1986-12-22\n2 | 313 | 1981-03-30 | 1986-12-15\n3 | 147 | 1981-03-16 | 1986-12-22\n4 | 21 | 1981-03-23 | 1986-04-28\nTR | 499 | 1981-02-19 | 1986-12-25\nSQL: SELECT l.\"U-PRO\", COUNT(*) AS tests, MIN(l.\"Date\"), MAX(l.\"Date\")\nFROM main.Laboratory AS l\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\nGROUP BY l.\"U-PRO\"\nLIMIT 1000"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_5",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "resolve_business_terms",
+    "arguments": {
+      "terms": []
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "{\"definition_check_id\": \"O6i9j5tQluuj3FkWHFv1UBq11qMivf_S33_YWlZAetk\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_6",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "run_sql",
+    "arguments": {
+      "definition_check_id": "O6i9j5tQluuj3FkWHFv1UBq11qMivf_S33_YWlZAetk",
+      "expected_columns": [
+        "patient_count"
+      ],
+      "sql": "SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n  AND l.\"Date\" >= p.Birthday\n  AND l.\"Date\" < date(p.Birthday, '+50 years')\n  AND l.PLT BETWEEN 100 AND 400\n  AND (\n      CAST(l.\"U-PRO\" AS REAL) > 0\n      OR l.\"U-PRO\" = 'TR'\n      OR (l.\"U-PRO\" GLOB '%*' AND l.\"U-PRO\" NOT GLOB '*[^%]*')\n  )\nLIMIT 1"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "1 row(s):\nOutput columns validated (projection only).\nResult coverage: fetched_rows=1; displayed_rows=1; fetch_truncated=false; display_truncated=false; sql_rewritten=false; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): patient_count=int\npatient_count\n---\n71\nSQL: SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n  AND l.\"Date\" >= p.Birthday\n  AND l.\"Date\" < date(p.Birthday, '+50 years')\n  AND l.PLT BETWEEN 100 AND 400\n  AND (\n      CAST(l.\"U-PRO\" AS REAL) > 0\n      OR l.\"U-PRO\" = 'TR'\n      OR (l.\"U-PRO\" GLOB '%*' AND l.\"U-PRO\" NOT GLOB '*[^%]*')\n  )\nLIMIT 1"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  }
+]

after: score 0

{
+  "status": "predicted",
+  "error_type": null,
+  "error_message": null,
+  "seconds": 30.475414666929282
+}

Final SQL / answer

SELECT COUNT(DISTINCT l.ID) AS patient_count
+FROM main.Laboratory AS l
+JOIN main.Patient AS p ON p.ID = l.ID
+WHERE l."Date" BETWEEN '1981-01-01' AND '1986-12-31'
+  AND l."Date" >= p.Birthday
+  AND l."Date" < date(p.Birthday, '+50 years')
+  AND l.PLT BETWEEN 100 AND 400
+  AND (CAST(l."U-PRO" AS REAL) > 0 OR l."U-PRO" IN ('TR', '%%'))
+LIMIT 1

Result preview (up to 20 rows; full row count below)

{
+  "columns": [
+    "patient_count"
+  ],
+  "row_count": 1,
+  "preview": [
+    [
+      "71"
+    ]
+  ],
+  "preview_truncated": false,
+  "csv_sha256": "9541ce50dc06713548554e1a49081d739e076ac3e4c4b1186aeed5b06b3313bc"
+}
Every MCP call: arguments and results
[
+  {
+    "id": "item_1",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "explore_schema",
+    "arguments": {
+      "table": "Laboratory"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "Laboratory (table)\n- ID: INTEGER NOT NULL\n- Date: DATE NOT NULL\n- GOT: INTEGER\n- GPT: INTEGER\n- LDH: INTEGER\n- ALP: INTEGER\n- TP: REAL\n- ALB: REAL\n- UA: REAL\n- UN: INTEGER\n- CRE: REAL\n- T-BIL: REAL\n- T-CHO: INTEGER\n- TG: INTEGER\n- CPK: INTEGER\n- GLU: INTEGER\n- WBC: REAL\n- RBC: REAL\n- HGB: REAL\n- HCT: REAL\n- PLT: INTEGER\n- PT: REAL\n- APTT: INTEGER\n- FG: REAL\n- PIC: INTEGER\n- TAT: INTEGER\n- TAT2: INTEGER\n- U-PRO: TEXT\n- IGG: INTEGER\n- IGA: INTEGER\n- IGM: INTEGER\n- CRP: TEXT\n- RA: TEXT\n- RF: TEXT\n- C3: INTEGER\n- C4: INTEGER\n- RNP: TEXT\n- SM: TEXT\n- SC170: TEXT\n- SSA: TEXT\n- SSB: TEXT\n- CENTROMEA: TEXT\n- DNA: TEXT\n- DNA-II: INTEGER\nPRIMARY KEY (ID, Date)\nFOREIGN KEY (ID) REFERENCES Patient (ID)"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_2",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "resolve_business_terms",
+    "arguments": {
+      "terms": []
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "{\"definition_check_id\": \"GBFt8p4hba4Qw9YVnOYVTN7-sGepqWwpPzXRFgsqN80\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_3",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "explore_schema",
+    "arguments": {
+      "table": "Patient"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "Patient (table)\n- ID: INTEGER NOT NULL\n- SEX: TEXT\n- Birthday: DATE\n- Description: DATE\n- First Date: DATE\n- Admission: TEXT\n- Diagnosis: TEXT\nPRIMARY KEY (ID)"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_4",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "run_sql",
+    "arguments": {
+      "definition_check_id": "GBFt8p4hba4Qw9YVnOYVTN7-sGepqWwpPzXRFgsqN80",
+      "sql": "SELECT l.\"U-PRO\" AS reading, COUNT(*) AS tests, MIN(l.\"Date\") AS first_test, MIN(p.Birthday) AS first_birthday\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\nGROUP BY l.\"U-PRO\""
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "8 row(s):\nResult coverage: fetched_rows=8; displayed_rows=8; fetch_truncated=false; display_truncated=false; sql_rewritten=true; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): reading=NoneType,str; tests=int; first_test=str; first_birthday=str\nreading | tests | first_test | first_birthday\n--- | --- | --- | ---\nNone | 1920 | 1981-01-27 | 1917-04-18\n%% | 4 | 1982-09-06 | 1929-07-05\n0 | 2729 | 1981-01-27 | 1917-04-18\n1 | 318 | 1981-04-06 | 1926-08-01\n2 | 313 | 1981-03-30 | 1926-08-01\n3 | 147 | 1981-03-16 | 1935-04-19\n4 | 21 | 1981-03-23 | 1943-05-19\nTR | 499 | 1981-02-19 | 1919-12-30\nSQL: SELECT l.\"U-PRO\" AS reading, COUNT(*) AS tests, MIN(l.\"Date\") AS first_test, MIN(p.Birthday) AS first_birthday\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\nGROUP BY l.\"U-PRO\"\nLIMIT 1000"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_5",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "resolve_business_terms",
+    "arguments": {
+      "terms": []
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "{\"definition_check_id\": \"ApYlbKxYtGKFx_rIgV3aQGXw0AT7SasD22mU_rP7f-M\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_6",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "run_sql",
+    "arguments": {
+      "definition_check_id": "ApYlbKxYtGKFx_rIgV3aQGXw0AT7SasD22mU_rP7f-M",
+      "expected_columns": [
+        "patient_count"
+      ],
+      "expected_rows": 1,
+      "sql": "SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n  AND l.\"Date\" >= p.Birthday\n  AND l.\"Date\" < date(p.Birthday, '+50 years')\n  AND l.PLT BETWEEN 100 AND 400\n  AND (CAST(l.\"U-PRO\" AS REAL) > 0 OR l.\"U-PRO\" IN ('TR', '%%'))\nLIMIT 1"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "1 row(s):\nOutput columns validated (projection only).\nOutput row count validated (executed SQL only).\nResult coverage: fetched_rows=1; displayed_rows=1; fetch_truncated=false; display_truncated=false; sql_rewritten=false; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): patient_count=int\npatient_count\n---\n71\nSQL: SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n  AND l.\"Date\" >= p.Birthday\n  AND l.\"Date\" < date(p.Birthday, '+50 years')\n  AND l.PLT BETWEEN 100 AND 400\n  AND (CAST(l.\"U-PRO\" AS REAL) > 0 OR l.\"U-PRO\" IN ('TR', '%%'))\nLIMIT 1"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  }
+]
bird495: 0 -> 1
{
+  "instance_id": "bird495",
+  "db": "toxicology",
+  "question": "For molecule TR377, I'd like a profile of its bond composition, covering single and double bonds only. For each bond kind, please give me: the bond kind symbol, the number of bonds of that kind in the molecule, and the number of element pairs that bond kind joins. Also include the molecule's carcinogenicity label. List the bond kinds from most frequent to least; if two kinds are equally frequent, list them alphabetically by symbol.",
+  "evidence": "A single bond is shown as the symbol '-' and a double bond as '='; a molecule label '+' means carcinogenic and '-' means not carcinogenic."
+}

SQL diff

--- before.sql
++++ after.sql
+@@ -0,0 +1,23 @@
++WITH pair_counts AS (
++    SELECT b.bond_type,
++           m.label,
++           MIN(a1.element, a2.element) AS element_lo,
++           MAX(a1.element, a2.element) AS element_hi,
++           COUNT(DISTINCT b.bond_id) AS bonds_in_pair
++    FROM main.bond AS b
++    JOIN main.molecule AS m ON m.molecule_id = b.molecule_id
++    JOIN main.connected AS c ON c.bond_id = b.bond_id
++    JOIN main.atom AS a1 ON a1.atom_id = c.atom_id
++    JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2
++    WHERE b.molecule_id = 'TR377'
++      AND b.bond_type IN ('-', '=')
++    GROUP BY b.bond_type, m.label, element_lo, element_hi
++)
++SELECT bond_type,
++       SUM(bonds_in_pair) AS bond_count,
++       COUNT(*) AS element_pair_count,
++       label AS carcinogenicity_label
++FROM pair_counts
++GROUP BY bond_type, label
++ORDER BY bond_count DESC, bond_type ASC
++LIMIT 2

before: score 0

{
+  "status": "failed",
+  "error_type": "ValueError",
+  "error_message": "Final answer must contain exactly one SQL block; no last-tool fallback",
+  "seconds": 28.63834737497382
+}

Final SQL / answer

Should each bond kind count distinct unordered element pairs, so every carbon–oxygen bond contributes to the bond count, but carbon–oxygen counts only once toward the element-pair count?

Result preview (up to 20 rows; full row count below)

null
Every MCP call: arguments and results
[
+  {
+    "id": "item_1",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "explore_schema",
+    "arguments": {
+      "table": "connected"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "connected (table)\n- atom_id: TEXT NOT NULL\n- atom_id2: TEXT NOT NULL\n- bond_id: TEXT\nPRIMARY KEY (atom_id, atom_id2)\nFOREIGN KEY (bond_id) REFERENCES bond (bond_id)\nFOREIGN KEY (atom_id2) REFERENCES atom (atom_id)\nFOREIGN KEY (atom_id) REFERENCES atom (atom_id)"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_2",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "explore_schema",
+    "arguments": {
+      "table": "bond"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "bond (table)\n- bond_id: TEXT NOT NULL\n- molecule_id: TEXT\n- bond_type: TEXT\nPRIMARY KEY (bond_id)\nFOREIGN KEY (molecule_id) REFERENCES molecule (molecule_id)"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_3",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "explore_schema",
+    "arguments": {
+      "table": "atom"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "atom (table)\n- atom_id: TEXT NOT NULL\n- molecule_id: TEXT\n- element: TEXT\nPRIMARY KEY (atom_id)\nFOREIGN KEY (molecule_id) REFERENCES molecule (molecule_id)"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_4",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "resolve_business_terms",
+    "arguments": {
+      "terms": [
+        "element pairs"
+      ]
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "DEFINITION_REQUIRED: No confirmed definition in this scope for: [\"element pairs\"]. SQL was NOT executed. Ask the user for the exact business definition and intended team/org/user scope. Do not infer a definition or register a guessed definition. After explicit user clarification, stage the definition with context_candidates. An operator must approve it before you resolve_business_terms again."
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "failed"
+  },
+  {
+    "id": "item_5",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "explore_schema",
+    "arguments": {
+      "table": "molecule"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "molecule (table)\n- molecule_id: TEXT NOT NULL\n- label: TEXT\nPRIMARY KEY (molecule_id)"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  }
+]

after: score 1

{
+  "status": "predicted",
+  "error_type": null,
+  "error_message": null,
+  "seconds": 38.891556249931455
+}

Final SQL / answer

WITH pair_counts AS (
+    SELECT b.bond_type,
+           m.label,
+           MIN(a1.element, a2.element) AS element_lo,
+           MAX(a1.element, a2.element) AS element_hi,
+           COUNT(DISTINCT b.bond_id) AS bonds_in_pair
+    FROM main.bond AS b
+    JOIN main.molecule AS m ON m.molecule_id = b.molecule_id
+    JOIN main.connected AS c ON c.bond_id = b.bond_id
+    JOIN main.atom AS a1 ON a1.atom_id = c.atom_id
+    JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2
+    WHERE b.molecule_id = 'TR377'
+      AND b.bond_type IN ('-', '=')
+    GROUP BY b.bond_type, m.label, element_lo, element_hi
+)
+SELECT bond_type,
+       SUM(bonds_in_pair) AS bond_count,
+       COUNT(*) AS element_pair_count,
+       label AS carcinogenicity_label
+FROM pair_counts
+GROUP BY bond_type, label
+ORDER BY bond_count DESC, bond_type ASC
+LIMIT 2

Result preview (up to 20 rows; full row count below)

{
+  "columns": [
+    "bond_type",
+    "bond_count",
+    "element_pair_count",
+    "carcinogenicity_label"
+  ],
+  "row_count": 2,
+  "preview": [
+    [
+      "-",
+      "12",
+      "3",
+      "-"
+    ],
+    [
+      "=",
+      "4",
+      "1",
+      "-"
+    ]
+  ],
+  "preview_truncated": false,
+  "csv_sha256": "ba193968c57a78e13a7e9f42b86445fd764efa4129491417e626b1169460e0bb"
+}
Every MCP call: arguments and results
[
+  {
+    "id": "item_1",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "explore_schema",
+    "arguments": {
+      "table": "molecule"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "molecule (table)\n- molecule_id: TEXT NOT NULL\n- label: TEXT\nPRIMARY KEY (molecule_id)"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_2",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "explore_schema",
+    "arguments": {
+      "table": "bond"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "bond (table)\n- bond_id: TEXT NOT NULL\n- molecule_id: TEXT\n- bond_type: TEXT\nPRIMARY KEY (bond_id)\nFOREIGN KEY (molecule_id) REFERENCES molecule (molecule_id)"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_3",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "explore_schema",
+    "arguments": {
+      "table": "atom"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "atom (table)\n- atom_id: TEXT NOT NULL\n- molecule_id: TEXT\n- element: TEXT\nPRIMARY KEY (atom_id)\nFOREIGN KEY (molecule_id) REFERENCES molecule (molecule_id)"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_4",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "resolve_business_terms",
+    "arguments": {
+      "terms": []
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "{\"definition_check_id\": \"BM3HE_y240zFH_Rr2nASBNoaGHu5caJO__FiPtlx7Ek\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_5",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "explore_schema",
+    "arguments": {
+      "table": "connected"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "connected (table)\n- atom_id: TEXT NOT NULL\n- atom_id2: TEXT NOT NULL\n- bond_id: TEXT\nPRIMARY KEY (atom_id, atom_id2)\nFOREIGN KEY (bond_id) REFERENCES bond (bond_id)\nFOREIGN KEY (atom_id2) REFERENCES atom (atom_id)\nFOREIGN KEY (atom_id) REFERENCES atom (atom_id)"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_6",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "run_sql",
+    "arguments": {
+      "definition_check_id": "BM3HE_y240zFH_Rr2nASBNoaGHu5caJO__FiPtlx7Ek",
+      "sql": "SELECT b.bond_type, COUNT(DISTINCT b.bond_id) AS bonds, COUNT(c.bond_id) AS connections, COUNT(a.element) AS first_elements, COUNT(z.element) AS second_elements\nFROM main.bond AS b\nLEFT JOIN main.connected AS c ON c.bond_id = b.bond_id\nLEFT JOIN main.atom AS a ON a.atom_id = c.atom_id\nLEFT JOIN main.atom AS z ON z.atom_id = c.atom_id2\nWHERE b.molecule_id = 'TR377'\nGROUP BY b.bond_type"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "3 row(s):\nResult coverage: fetched_rows=3; displayed_rows=3; fetch_truncated=false; display_truncated=false; sql_rewritten=true; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): bond_type=str; bonds=int; connections=int; first_elements=int; second_elements=int\nbond_type | bonds | connections | first_elements | second_elements\n--- | --- | --- | --- | ---\n# | 2 | 4 | 4 | 4\n- | 12 | 24 | 24 | 24\n= | 4 | 8 | 8 | 8\nSQL: SELECT b.bond_type, COUNT(DISTINCT b.bond_id) AS bonds, COUNT(c.bond_id) AS connections, COUNT(a.element) AS first_elements, COUNT(z.element) AS second_elements\nFROM main.bond AS b\nLEFT JOIN main.connected AS c ON c.bond_id = b.bond_id\nLEFT JOIN main.atom AS a ON a.atom_id = c.atom_id\nLEFT JOIN main.atom AS z ON z.atom_id = c.atom_id2\nWHERE b.molecule_id = 'TR377'\nGROUP BY b.bond_type\nLIMIT 1000"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_7",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "resolve_business_terms",
+    "arguments": {
+      "terms": []
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "{\"definition_check_id\": \"SH8tHhKYFv7gvKWolr989r47sdfXX0QV47vLRtlORdA\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_8",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "run_sql",
+    "arguments": {
+      "definition_check_id": "SH8tHhKYFv7gvKWolr989r47sdfXX0QV47vLRtlORdA",
+      "expected_rows": 2,
+      "expected_columns": [
+        "bond_type",
+        "bond_count",
+        "element_pair_count",
+        "carcinogenicity_label"
+      ],
+      "sql": "WITH pair_counts AS (\n    SELECT b.bond_type,\n           m.label,\n           MIN(a1.element, a2.element) AS element_lo,\n           MAX(a1.element, a2.element) AS element_hi,\n           COUNT(DISTINCT b.bond_id) AS bonds_in_pair\n    FROM main.bond AS b\n    JOIN main.molecule AS m ON m.molecule_id = b.molecule_id\n    JOIN main.connected AS c ON c.bond_id = b.bond_id\n    JOIN main.atom AS a1 ON a1.atom_id = c.atom_id\n    JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2\n    WHERE b.molecule_id = 'TR377'\n      AND b.bond_type IN ('-', '=')\n    GROUP BY b.bond_type, m.label, element_lo, element_hi\n)\nSELECT bond_type,\n       SUM(bonds_in_pair) AS bond_count,\n       COUNT(*) AS element_pair_count,\n       label AS carcinogenicity_label\nFROM pair_counts\nGROUP BY bond_type, label\nORDER BY bond_count DESC, bond_type ASC\nLIMIT 2"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "2 row(s):\nOutput columns validated (projection only).\nOutput row count validated (executed SQL only).\nResult coverage: fetched_rows=2; displayed_rows=2; fetch_truncated=false; display_truncated=false; sql_rewritten=false; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): bond_type=str; bond_count=int; element_pair_count=int; carcinogenicity_label=str\nbond_type | bond_count | element_pair_count | carcinogenicity_label\n--- | --- | --- | ---\n- | 12 | 3 | -\n= | 4 | 1 | -\nSQL: WITH pair_counts AS (\n    SELECT b.bond_type,\n           m.label,\n           MIN(a1.element, a2.element) AS element_lo,\n           MAX(a1.element, a2.element) AS element_hi,\n           COUNT(DISTINCT b.bond_id) AS bonds_in_pair\n    FROM main.bond AS b\n    JOIN main.molecule AS m ON m.molecule_id = b.molecule_id\n    JOIN main.connected AS c ON c.bond_id = b.bond_id\n    JOIN main.atom AS a1 ON a1.atom_id = c.atom_id\n    JOIN main.atom AS a2 ON a2.atom_id = c.atom_id2\n    WHERE b.molecule_id = 'TR377'\n      AND b.bond_type IN ('-', '=')\n    GROUP BY b.bond_type, m.label, element_lo, element_hi\n)\nSELECT bond_type,\n       SUM(bonds_in_pair) AS bond_count,\n       COUNT(*) AS element_pair_count,\n       label AS carcinogenicity_label\nFROM pair_counts\nGROUP BY bond_type, label\nORDER BY bond_count DESC, bond_type ASC\nLIMIT 2"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  }
+]
\ No newline at end of file diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/manifest.json b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/manifest.json new file mode 100644 index 00000000..27c3aeec --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/manifest.json @@ -0,0 +1,449 @@ +{ + "benchmark": "BIRD Mini-Dev SQLite 500 (2026-10-25)", + "upstream_commit": "5b256b5a9c17478f06ed6912612e9a14d17065c8", + "question_file_sha256": "926af2a0d1b47e5d0d15a7aa8a34d4721007f4550a881555b6a89496b54a2606", + "evaluator_sha256": "da1bbcd4530be83692d7c650c814ea9704bb710d0c953eb75d02ccb38233cf89", + "cases": [ + { + "instance_id": "bird467", + "db": "thrombosis_prediction", + "question": "I'm preparing a case series on early renal involvement and need to size my cohort. How many patients were under age 50 on the day of a laboratory test performed between 1 January 1981 and 31 December 1986 inclusive, had a platelet count from 100 through 400 at that test, and showed proteinuria at that test? Age means completed years on the day of the test, so under 50 is strictly below 50. The platelet range is inclusive. I just need the number of patients satisfying all conditions.", + "evidence": "A patient showed proteinuria at a test when that test's dipstick reading reports protein: a dash or zero means no protein was found, a number is the amount of protein found, TR stands for trace protein, and a reading written in percent signs is the dipstick saturated, the strongest reading." + }, + { + "instance_id": "bird495", + "db": "toxicology", + "question": "For molecule TR377, I'd like a profile of its bond composition, covering single and double bonds only. For each bond kind, please give me: the bond kind symbol, the number of bonds of that kind in the molecule, and the number of element pairs that bond kind joins. Also include the molecule's carcinogenicity label. List the bond kinds from most frequent to least; if two kinds are equally frequent, list them alphabetically by symbol.", + "evidence": "A single bond is shown as the symbol '-' and a double bond as '='; a molecule label '+' means carcinogenic and '-' means not carcinogenic." + } + ], + "db_sha256": { + "california_schools": "c0903eec662e63068fd1d14403d3d6c1d473287fc10c4356333ea58f878db983", + "card_games": "c98bdb57fe7474da798b407785544b9af0daaad5d61fd21e2a73309493bc1227", + "codebase_community": "92101be6d2a9f6adceea59d38f6d1c556087f9eea1432432a21268cb1348036d", + "debit_card_specializing": "b3d149ad05746dbbe5116e229e17e18f09c39db43cf117d9ef3441753608b691", + "european_football_2": "f72f5c9b990371417288a67b27a02e601ef904d45525c2c9f7931fb01001c536", + "financial": "d15d89cdb068a202b6f2b99342af44dffc1d52545b39ceaf62efdc0ba570101e", + "formula_1": "79770caf966707e35516fa566e24b40ae515c74ec1ec4631235245645b87b24d", + "student_club": "eb89bcfe97eefa386a27904ec5aa15159811a7eac894ec659a36e48fa9f76b77", + "superhero": "75e94a2c3236ee3bb2c01fb97a1c4b4c1c269bcefd4eab1d04be323d2d0825b1", + "thrombosis_prediction": "87583183c3dc472fba04de702965560a9d7c0a548836613f242317e0eeb83f00", + "toxicology": "4df4094208e0799d5e5f0e2b5bc5c415cf87b1208ebaf8f4c14c7af445b682c5" + }, + "suite": "bird", + "development_ids": [ + "bird008", + "bird009", + "bird010", + "bird011", + "bird012", + "bird013", + "bird014", + "bird015", + "bird016", + "bird017", + "bird018", + "bird020", + "bird021", + "bird022", + "bird023", + "bird025", + "bird026", + "bird027", + "bird028", + "bird029", + "bird030", + "bird031", + "bird032", + "bird033", + "bird034", + "bird035", + "bird037", + "bird038", + "bird039", + "bird040", + "bird041", + "bird042", + "bird043", + "bird044", + "bird045", + "bird047", + "bird048", + "bird049", + "bird050", + "bird051", + "bird053", + "bird054", + "bird055", + "bird056", + "bird057", + "bird060", + "bird061", + "bird063", + "bird065", + "bird066", + "bird067", + "bird068", + "bird070", + "bird071", + "bird072", + "bird073", + "bird074", + "bird075", + "bird076", + "bird077", + "bird078", + "bird079", + "bird080", + "bird081", + "bird082", + "bird083", + "bird084", + "bird085", + "bird086", + "bird088", + "bird089", + "bird091", + "bird092", + "bird095", + "bird096", + "bird097", + "bird098", + "bird099", + "bird100", + "bird101", + "bird102", + "bird103", + "bird104", + "bird105", + "bird106", + "bird108", + "bird109", + "bird110", + "bird112", + "bird113", + "bird114", + "bird116", + "bird117", + "bird118", + "bird119", + "bird121", + "bird122", + "bird123", + "bird124", + "bird125", + "bird126", + "bird128", + "bird130", + "bird131", + "bird133", + "bird134", + "bird135", + "bird136", + "bird137", + "bird138", + "bird139", + "bird140", + "bird143", + "bird144", + "bird145", + "bird147", + "bird148", + "bird149", + "bird150", + "bird151", + "bird153", + "bird155", + "bird158", + "bird159", + "bird160", + "bird161", + "bird162", + "bird163", + "bird164", + "bird166", + "bird167", + "bird168", + "bird169", + "bird171", + "bird172", + "bird173", + "bird174", + "bird175", + "bird176", + "bird177", + "bird178", + "bird180", + "bird181", + "bird182", + "bird183", + "bird184", + "bird185", + "bird186", + "bird187", + "bird188", + "bird189", + "bird190", + "bird191", + "bird192", + "bird193", + "bird194", + "bird195", + "bird196", + "bird197", + "bird198", + "bird199", + "bird200", + "bird201", + "bird202", + "bird203", + "bird205", + "bird206", + "bird207", + "bird208", + "bird209", + "bird210", + "bird211", + "bird212", + "bird213", + "bird215", + "bird216", + "bird217", + "bird218", + "bird219", + "bird220", + "bird221", + "bird222", + "bird223", + "bird224", + "bird227", + "bird228", + "bird230", + "bird232", + "bird233", + "bird234", + "bird235", + "bird236", + "bird237", + "bird238", + "bird239", + "bird240", + "bird241", + "bird242", + "bird243", + "bird244", + "bird246", + "bird247", + "bird248", + "bird250", + "bird251", + "bird252", + "bird253", + "bird254", + "bird255", + "bird256", + "bird257", + "bird258", + "bird261", + "bird262", + "bird263", + "bird264", + "bird265", + "bird266", + "bird267", + "bird268", + "bird269", + "bird270", + "bird271", + "bird272", + "bird274", + "bird275", + "bird276", + "bird277", + "bird278", + "bird279", + "bird280", + "bird281", + "bird282", + "bird283", + "bird284", + "bird285", + "bird286", + "bird287", + "bird288", + "bird289", + "bird291", + "bird292", + "bird293", + "bird295", + "bird296", + "bird297", + "bird298", + "bird299", + "bird300", + "bird301", + "bird302", + "bird304", + "bird305", + "bird306", + "bird307", + "bird308", + "bird309", + "bird310", + "bird311", + "bird312", + "bird313", + "bird314", + "bird315", + "bird316", + "bird317", + "bird319", + "bird321", + "bird322", + "bird323", + "bird324", + "bird325", + "bird326", + "bird327", + "bird331", + "bird332", + "bird333", + "bird334", + "bird335", + "bird336", + "bird337", + "bird338", + "bird339", + "bird340", + "bird341", + "bird342", + "bird343", + "bird344", + "bird345", + "bird347", + "bird348", + "bird349", + "bird350", + "bird351", + "bird352", + "bird354", + "bird356", + "bird361", + "bird362", + "bird364", + "bird366", + "bird367", + "bird368", + "bird369", + "bird372", + "bird373", + "bird374", + "bird375", + "bird376", + "bird377", + "bird380", + "bird382", + "bird383", + "bird385", + "bird386", + "bird388", + "bird390", + "bird391", + "bird392", + "bird394", + "bird395", + "bird396", + "bird397", + "bird399", + "bird401", + "bird402", + "bird403", + "bird404", + "bird405", + "bird406", + "bird407", + "bird408", + "bird409", + "bird410", + "bird411", + "bird412", + "bird413", + "bird414", + "bird415", + "bird416", + "bird417", + "bird419", + "bird420", + "bird421", + "bird422", + "bird424", + "bird425", + "bird426", + "bird427", + "bird428", + "bird430", + "bird431", + "bird432", + "bird433", + "bird434", + "bird435", + "bird436", + "bird437", + "bird438", + "bird439", + "bird440", + "bird441", + "bird442", + "bird443", + "bird444", + "bird445", + "bird446", + "bird447", + "bird448", + "bird450", + "bird453", + "bird454", + "bird455", + "bird457", + "bird458", + "bird460", + "bird461", + "bird462", + "bird463", + "bird464", + "bird465", + "bird466", + "bird467", + "bird468", + "bird469", + "bird471", + "bird472", + "bird473", + "bird474", + "bird475", + "bird476", + "bird477", + "bird478", + "bird479", + "bird480", + "bird481", + "bird482", + "bird484", + "bird485", + "bird486", + "bird487", + "bird488", + "bird489", + "bird490", + "bird491", + "bird492", + "bird493", + "bird495", + "bird496", + "bird497", + "bird498", + "bird499" + ], + "holdout_ids": [], + "split_seed": 20261126 +} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/protocol.json b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/protocol.json new file mode 100644 index 00000000..232f454b --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/protocol.json @@ -0,0 +1,17 @@ +{ + "revision": "71c3f5f6744d39df8703d0dc794cdfc253d5b60b", + "source": "/Users/seyoung/workspace/benchmarks/codex-mcp-unobserved-20261127/bird-gpt-6.2-astra", + "ids": [ + "bird467", + "bird495" + ], + "split": "all", + "expected_cases": 2, + "candidate": "Sameproduct/metadata asPR357; onlynewrunnerpreflightguardfromPR358.", + "inference": "Freshoriginalquestions,evidenceandfullpinnedofficialCSVmetadata. No priorSQL,grade,goldoranalystdiagnosis.", + "limits": [ + "Twonewcoveragefailuresnotinprevious31selection. No case repeated atthiscandidate.", + "Selectedfailures,notfullaccuracy; priorproductfixesalsodifferfromoldcoveragebaseline.", + "Strictclarificationpolicyunchanged." + ] +} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/requested-manifest.json b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/requested-manifest.json new file mode 100644 index 00000000..27c3aeec --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/requested-manifest.json @@ -0,0 +1,449 @@ +{ + "benchmark": "BIRD Mini-Dev SQLite 500 (2026-10-25)", + "upstream_commit": "5b256b5a9c17478f06ed6912612e9a14d17065c8", + "question_file_sha256": "926af2a0d1b47e5d0d15a7aa8a34d4721007f4550a881555b6a89496b54a2606", + "evaluator_sha256": "da1bbcd4530be83692d7c650c814ea9704bb710d0c953eb75d02ccb38233cf89", + "cases": [ + { + "instance_id": "bird467", + "db": "thrombosis_prediction", + "question": "I'm preparing a case series on early renal involvement and need to size my cohort. How many patients were under age 50 on the day of a laboratory test performed between 1 January 1981 and 31 December 1986 inclusive, had a platelet count from 100 through 400 at that test, and showed proteinuria at that test? Age means completed years on the day of the test, so under 50 is strictly below 50. The platelet range is inclusive. I just need the number of patients satisfying all conditions.", + "evidence": "A patient showed proteinuria at a test when that test's dipstick reading reports protein: a dash or zero means no protein was found, a number is the amount of protein found, TR stands for trace protein, and a reading written in percent signs is the dipstick saturated, the strongest reading." + }, + { + "instance_id": "bird495", + "db": "toxicology", + "question": "For molecule TR377, I'd like a profile of its bond composition, covering single and double bonds only. For each bond kind, please give me: the bond kind symbol, the number of bonds of that kind in the molecule, and the number of element pairs that bond kind joins. Also include the molecule's carcinogenicity label. List the bond kinds from most frequent to least; if two kinds are equally frequent, list them alphabetically by symbol.", + "evidence": "A single bond is shown as the symbol '-' and a double bond as '='; a molecule label '+' means carcinogenic and '-' means not carcinogenic." + } + ], + "db_sha256": { + "california_schools": "c0903eec662e63068fd1d14403d3d6c1d473287fc10c4356333ea58f878db983", + "card_games": "c98bdb57fe7474da798b407785544b9af0daaad5d61fd21e2a73309493bc1227", + "codebase_community": "92101be6d2a9f6adceea59d38f6d1c556087f9eea1432432a21268cb1348036d", + "debit_card_specializing": "b3d149ad05746dbbe5116e229e17e18f09c39db43cf117d9ef3441753608b691", + "european_football_2": "f72f5c9b990371417288a67b27a02e601ef904d45525c2c9f7931fb01001c536", + "financial": "d15d89cdb068a202b6f2b99342af44dffc1d52545b39ceaf62efdc0ba570101e", + "formula_1": "79770caf966707e35516fa566e24b40ae515c74ec1ec4631235245645b87b24d", + "student_club": "eb89bcfe97eefa386a27904ec5aa15159811a7eac894ec659a36e48fa9f76b77", + "superhero": "75e94a2c3236ee3bb2c01fb97a1c4b4c1c269bcefd4eab1d04be323d2d0825b1", + "thrombosis_prediction": "87583183c3dc472fba04de702965560a9d7c0a548836613f242317e0eeb83f00", + "toxicology": "4df4094208e0799d5e5f0e2b5bc5c415cf87b1208ebaf8f4c14c7af445b682c5" + }, + "suite": "bird", + "development_ids": [ + "bird008", + "bird009", + "bird010", + "bird011", + "bird012", + "bird013", + "bird014", + "bird015", + "bird016", + "bird017", + "bird018", + "bird020", + "bird021", + "bird022", + "bird023", + "bird025", + "bird026", + "bird027", + "bird028", + "bird029", + "bird030", + "bird031", + "bird032", + "bird033", + "bird034", + "bird035", + "bird037", + "bird038", + "bird039", + "bird040", + "bird041", + "bird042", + "bird043", + "bird044", + "bird045", + "bird047", + "bird048", + "bird049", + "bird050", + "bird051", + "bird053", + "bird054", + "bird055", + "bird056", + "bird057", + "bird060", + "bird061", + "bird063", + "bird065", + "bird066", + "bird067", + "bird068", + "bird070", + "bird071", + "bird072", + "bird073", + "bird074", + "bird075", + "bird076", + "bird077", + "bird078", + "bird079", + "bird080", + "bird081", + "bird082", + "bird083", + "bird084", + "bird085", + "bird086", + "bird088", + "bird089", + "bird091", + "bird092", + "bird095", + "bird096", + "bird097", + "bird098", + "bird099", + "bird100", + "bird101", + "bird102", + "bird103", + "bird104", + "bird105", + "bird106", + "bird108", + "bird109", + "bird110", + "bird112", + "bird113", + "bird114", + "bird116", + "bird117", + "bird118", + "bird119", + "bird121", + "bird122", + "bird123", + "bird124", + "bird125", + "bird126", + "bird128", + "bird130", + "bird131", + "bird133", + "bird134", + "bird135", + "bird136", + "bird137", + "bird138", + "bird139", + "bird140", + "bird143", + "bird144", + "bird145", + "bird147", + "bird148", + "bird149", + "bird150", + "bird151", + "bird153", + "bird155", + "bird158", + "bird159", + "bird160", + "bird161", + "bird162", + "bird163", + "bird164", + "bird166", + "bird167", + "bird168", + "bird169", + "bird171", + "bird172", + "bird173", + "bird174", + "bird175", + "bird176", + "bird177", + "bird178", + "bird180", + "bird181", + "bird182", + "bird183", + "bird184", + "bird185", + "bird186", + "bird187", + "bird188", + "bird189", + "bird190", + "bird191", + "bird192", + "bird193", + "bird194", + "bird195", + "bird196", + "bird197", + "bird198", + "bird199", + "bird200", + "bird201", + "bird202", + "bird203", + "bird205", + "bird206", + "bird207", + "bird208", + "bird209", + "bird210", + "bird211", + "bird212", + "bird213", + "bird215", + "bird216", + "bird217", + "bird218", + "bird219", + "bird220", + "bird221", + "bird222", + "bird223", + "bird224", + "bird227", + "bird228", + "bird230", + "bird232", + "bird233", + "bird234", + "bird235", + "bird236", + "bird237", + "bird238", + "bird239", + "bird240", + "bird241", + "bird242", + "bird243", + "bird244", + "bird246", + "bird247", + "bird248", + "bird250", + "bird251", + "bird252", + "bird253", + "bird254", + "bird255", + "bird256", + "bird257", + "bird258", + "bird261", + "bird262", + "bird263", + "bird264", + "bird265", + "bird266", + "bird267", + "bird268", + "bird269", + "bird270", + "bird271", + "bird272", + "bird274", + "bird275", + "bird276", + "bird277", + "bird278", + "bird279", + "bird280", + "bird281", + "bird282", + "bird283", + "bird284", + "bird285", + "bird286", + "bird287", + "bird288", + "bird289", + "bird291", + "bird292", + "bird293", + "bird295", + "bird296", + "bird297", + "bird298", + "bird299", + "bird300", + "bird301", + "bird302", + "bird304", + "bird305", + "bird306", + "bird307", + "bird308", + "bird309", + "bird310", + "bird311", + "bird312", + "bird313", + "bird314", + "bird315", + "bird316", + "bird317", + "bird319", + "bird321", + "bird322", + "bird323", + "bird324", + "bird325", + "bird326", + "bird327", + "bird331", + "bird332", + "bird333", + "bird334", + "bird335", + "bird336", + "bird337", + "bird338", + "bird339", + "bird340", + "bird341", + "bird342", + "bird343", + "bird344", + "bird345", + "bird347", + "bird348", + "bird349", + "bird350", + "bird351", + "bird352", + "bird354", + "bird356", + "bird361", + "bird362", + "bird364", + "bird366", + "bird367", + "bird368", + "bird369", + "bird372", + "bird373", + "bird374", + "bird375", + "bird376", + "bird377", + "bird380", + "bird382", + "bird383", + "bird385", + "bird386", + "bird388", + "bird390", + "bird391", + "bird392", + "bird394", + "bird395", + "bird396", + "bird397", + "bird399", + "bird401", + "bird402", + "bird403", + "bird404", + "bird405", + "bird406", + "bird407", + "bird408", + "bird409", + "bird410", + "bird411", + "bird412", + "bird413", + "bird414", + "bird415", + "bird416", + "bird417", + "bird419", + "bird420", + "bird421", + "bird422", + "bird424", + "bird425", + "bird426", + "bird427", + "bird428", + "bird430", + "bird431", + "bird432", + "bird433", + "bird434", + "bird435", + "bird436", + "bird437", + "bird438", + "bird439", + "bird440", + "bird441", + "bird442", + "bird443", + "bird444", + "bird445", + "bird446", + "bird447", + "bird448", + "bird450", + "bird453", + "bird454", + "bird455", + "bird457", + "bird458", + "bird460", + "bird461", + "bird462", + "bird463", + "bird464", + "bird465", + "bird466", + "bird467", + "bird468", + "bird469", + "bird471", + "bird472", + "bird473", + "bird474", + "bird475", + "bird476", + "bird477", + "bird478", + "bird479", + "bird480", + "bird481", + "bird482", + "bird484", + "bird485", + "bird486", + "bird487", + "bird488", + "bird489", + "bird490", + "bird491", + "bird492", + "bird493", + "bird495", + "bird496", + "bird497", + "bird498", + "bird499" + ], + "holdout_ids": [], + "split_seed": 20261126 +} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/settings.json b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/settings.json new file mode 100644 index 00000000..74a99212 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/settings.json @@ -0,0 +1,32 @@ +{ + "profiles": [ + { + "name": "codex-mcp", + "model": "gpt-6.2-astra", + "reasoning_effort": "high" + } + ], + "backend": "ChatGPT login -> Codex CLI -> production Lang2SQL MCP", + "revision": "71c3f5f6744d39df8703d0dc794cdfc253d5b60b", + "codex_version": "codex-cli 0.170.0", + "sources": { + "bench/accuracy/codex_mcp.py": "4812960452c27952ee3873575d97fb2dceaccafbdc57cca94afa3770f50297fc", + "src/lang2sql/frontends/mcp/server.py": "0836ca4631f321c3f3a2c7524e71f6f31e60ac77286633833af6810d3443ddcb" + }, + "schema_document_sha256": "7f3a02f99f90eadd69974fe5f45ca5d4abf90a1549e4deb46ae24b0093bde9c6", + "case_selection": { + "split": "all", + "input_cases": 2, + "selected_cases": 2, + "expected_cases": 2 + }, + "review_source": null, + "failure_selection": null, + "split": "all", + "concurrency": 2, + "case_timeout": 600.0, + "sql_timeout": 30, + "max_rows": 100000, + "api_calls": null, + "usage_unit": "one Codex CLI invocation per question; internal model-call count unavailable" +} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/summary.json b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/summary.json new file mode 100644 index 00000000..06cca51a --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/guarded-two-case/summary.json @@ -0,0 +1,8 @@ +[ + { + "profile": "codex-mcp", + "correct": 1, + "total": 2, + "accuracy": 0.5 + } +] diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/csv/bird146.csv b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/csv/bird146.csv new file mode 100644 index 00000000..94a004d4 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/csv/bird146.csv @@ -0,0 +1,2 @@ +average_monthly_posts +5.33 diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/events/bird146.answer.txt b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/events/bird146.answer.txt new file mode 100644 index 00000000..0a677847 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/events/bird146.answer.txt @@ -0,0 +1,15 @@ +```sql +WITH monthly_counts AS ( + SELECT strftime('%Y-%m', l.CreationDate) AS month, + COUNT(DISTINCT l.RelatedPostId) AS post_count + FROM main.postLinks AS l + JOIN main.posts AS p ON p.Id = l.RelatedPostId + WHERE l.CreationDate >= '2010-01-01' + AND l.CreationDate < '2011-01-01' + AND p.AnswerCount <= 2 + GROUP BY month +) +SELECT ROUND(COALESCE(SUM(post_count), 0) / 12.0, 2) AS average_monthly_posts +FROM monthly_counts +LIMIT 1000 +``` \ No newline at end of file diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/events/bird146.jsonl b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/events/bird146.jsonl new file mode 100644 index 00000000..885c5a04 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/events/bird146.jsonl @@ -0,0 +1,17 @@ +{"type":"thread.started","thread_id":"01a21a19-b38e-7aa0-ac45-d19b4e422a98"} +{"type":"turn.started"} +{"type":"item.completed","item":{"id":"item_0","type":"agent_message","text":"I’ll check how Lang2SQL identifies the post receiving a link, then run the query and verify that the average includes all twelve months."}} +{"type":"item.started","item":{"id":"item_1","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"posts"},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_1","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"posts"},"result":{"content":[{"type":"text","text":"posts (table)\n- Id: INTEGER NOT NULL\n- PostTypeId: INTEGER\n- AcceptedAnswerId: INTEGER\n- CreaionDate: DATETIME\n- Score: INTEGER\n- ViewCount: INTEGER\n- Body: TEXT\n- OwnerUserId: INTEGER\n- LasActivityDate: DATETIME\n- Title: TEXT\n- Tags: TEXT\n- AnswerCount: INTEGER\n- CommentCount: INTEGER\n- FavoriteCount: INTEGER\n- LastEditorUserId: INTEGER\n- LastEditDate: DATETIME\n- CommunityOwnedDate: DATETIME\n- ParentId: INTEGER\n- ClosedDate: DATETIME\n- OwnerDisplayName: TEXT\n- LastEditorDisplayName: TEXT\nPRIMARY KEY (Id)\nFOREIGN KEY (LastEditorUserId) REFERENCES users (Id)\nFOREIGN KEY (OwnerUserId) REFERENCES users (Id)\nFOREIGN KEY (ParentId) REFERENCES posts (Id)"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_2","type":"mcp_tool_call","server":"lang2sql","tool":"resolve_business_terms","arguments":{"terms":[]},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_2","type":"mcp_tool_call","server":"lang2sql","tool":"resolve_business_terms","arguments":{"terms":[]},"result":{"content":[{"type":"text","text":"{\"definition_check_id\": \"u2vbfftjV4KgU3PRCm6g-SyKhMZvljoC1ctLE-w6G4E\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_3","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"postLinks"},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_3","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"postLinks"},"result":{"content":[{"type":"text","text":"postLinks (table)\n- Id: INTEGER NOT NULL\n- CreationDate: DATETIME\n- PostId: INTEGER\n- RelatedPostId: INTEGER\n- LinkTypeId: INTEGER\nPRIMARY KEY (Id)\nFOREIGN KEY (PostId) REFERENCES posts (Id)\nFOREIGN KEY (RelatedPostId) REFERENCES posts (Id)"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_4","type":"mcp_tool_call","server":"lang2sql","tool":"run_sql","arguments":{"definition_check_id":"u2vbfftjV4KgU3PRCm6g-SyKhMZvljoC1ctLE-w6G4E","sql":"SELECT l.CreationDate, l.PostId, l.RelatedPostId, p.AnswerCount,\n instr(s.Body, '/questions/' || l.RelatedPostId || '/') > 0 AS source_links_to_related\nFROM main.postLinks AS l\nJOIN main.posts AS s ON s.Id = l.PostId\nJOIN main.posts AS p ON p.Id = l.RelatedPostId\nWHERE l.CreationDate >= '2010-01-01' AND l.CreationDate < '2011-01-01'\nORDER BY l.Id\nLIMIT 10"},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_4","type":"mcp_tool_call","server":"lang2sql","tool":"run_sql","arguments":{"definition_check_id":"u2vbfftjV4KgU3PRCm6g-SyKhMZvljoC1ctLE-w6G4E","sql":"SELECT l.CreationDate, l.PostId, l.RelatedPostId, p.AnswerCount,\n instr(s.Body, '/questions/' || l.RelatedPostId || '/') > 0 AS source_links_to_related\nFROM main.postLinks AS l\nJOIN main.posts AS s ON s.Id = l.PostId\nJOIN main.posts AS p ON p.Id = l.RelatedPostId\nWHERE l.CreationDate >= '2010-01-01' AND l.CreationDate < '2011-01-01'\nORDER BY l.Id\nLIMIT 10"},"result":{"content":[{"type":"text","text":"10 row(s):\nResult coverage: fetched_rows=10; displayed_rows=10; fetch_truncated=false; display_truncated=false; sql_rewritten=false; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): CreationDate=str; PostId=int; RelatedPostId=int; AnswerCount=int; source_links_to_related=int\nCreationDate | PostId | RelatedPostId | AnswerCount | source_links_to_related\n--- | --- | --- | --- | ---\n2010-07-21 14:47:33.0 | 395 | 173 | 9 | 0\n2010-07-23 16:30:41.0 | 548 | 539 | 8 | 1\n2010-07-26 20:12:15.0 | 375 | 30 | 8 | 1\n2010-07-27 16:00:22.0 | 769 | 31 | 10 | 0\n2010-07-27 16:00:22.0 | 769 | 6 | 15 | 0\n2010-07-27 17:19:27.0 | 790 | 298 | 6 | 0\n2010-07-27 23:22:51.0 | 715 | 7 | 24 | 0\n2010-07-28 19:36:09.0 | 834 | 577 | 10 | 0\n2010-07-29 19:01:22.0 | 614 | 170 | 19 | 1\n2010-08-01 12:08:34.0 | 222 | 213 | 13 | 1\nSQL: SELECT l.CreationDate, l.PostId, l.RelatedPostId, p.AnswerCount,\n instr(s.Body, '/questions/' || l.RelatedPostId || '/') > 0 AS source_links_to_related\nFROM main.postLinks AS l\nJOIN main.posts AS s ON s.Id = l.PostId\nJOIN main.posts AS p ON p.Id = l.RelatedPostId\nWHERE l.CreationDate >= '2010-01-01' AND l.CreationDate < '2011-01-01'\nORDER BY l.Id\nLIMIT 10"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_5","type":"mcp_tool_call","server":"lang2sql","tool":"resolve_business_terms","arguments":{"terms":[]},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_5","type":"mcp_tool_call","server":"lang2sql","tool":"resolve_business_terms","arguments":{"terms":[]},"result":{"content":[{"type":"text","text":"{\"definition_check_id\": \"imd3Yo8Hu8dq_pozUpztRo6U9mbwWhYuZTuswFFIk_0\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_6","type":"mcp_tool_call","server":"lang2sql","tool":"run_sql","arguments":{"definition_check_id":"imd3Yo8Hu8dq_pozUpztRo6U9mbwWhYuZTuswFFIk_0","expected_rows":1,"expected_columns":["average_monthly_posts"],"sql":"WITH monthly_counts AS (\n SELECT strftime('%Y-%m', l.CreationDate) AS month,\n COUNT(DISTINCT l.RelatedPostId) AS post_count\n FROM main.postLinks AS l\n JOIN main.posts AS p ON p.Id = l.RelatedPostId\n WHERE l.CreationDate >= '2010-01-01'\n AND l.CreationDate < '2011-01-01'\n AND p.AnswerCount <= 2\n GROUP BY month\n)\nSELECT ROUND(COALESCE(SUM(post_count), 0) / 12.0, 2) AS average_monthly_posts\nFROM monthly_counts;"},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_6","type":"mcp_tool_call","server":"lang2sql","tool":"run_sql","arguments":{"definition_check_id":"imd3Yo8Hu8dq_pozUpztRo6U9mbwWhYuZTuswFFIk_0","expected_rows":1,"expected_columns":["average_monthly_posts"],"sql":"WITH monthly_counts AS (\n SELECT strftime('%Y-%m', l.CreationDate) AS month,\n COUNT(DISTINCT l.RelatedPostId) AS post_count\n FROM main.postLinks AS l\n JOIN main.posts AS p ON p.Id = l.RelatedPostId\n WHERE l.CreationDate >= '2010-01-01'\n AND l.CreationDate < '2011-01-01'\n AND p.AnswerCount <= 2\n GROUP BY month\n)\nSELECT ROUND(COALESCE(SUM(post_count), 0) / 12.0, 2) AS average_monthly_posts\nFROM monthly_counts;"},"result":{"content":[{"type":"text","text":"1 row(s):\nOutput columns validated (projection only).\nOutput row count validated (executed SQL only).\nResult coverage: fetched_rows=1; displayed_rows=1; fetch_truncated=false; display_truncated=false; sql_rewritten=true; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): average_monthly_posts=float\naverage_monthly_posts\n---\n5.33\nSQL: WITH monthly_counts AS (\n SELECT strftime('%Y-%m', l.CreationDate) AS month,\n COUNT(DISTINCT l.RelatedPostId) AS post_count\n FROM main.postLinks AS l\n JOIN main.posts AS p ON p.Id = l.RelatedPostId\n WHERE l.CreationDate >= '2010-01-01'\n AND l.CreationDate < '2011-01-01'\n AND p.AnswerCount <= 2\n GROUP BY month\n)\nSELECT ROUND(COALESCE(SUM(post_count), 0) / 12.0, 2) AS average_monthly_posts\nFROM monthly_counts\nLIMIT 1000"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.completed","item":{"id":"item_7","type":"agent_message","text":"```sql\nWITH monthly_counts AS (\n SELECT strftime('%Y-%m', l.CreationDate) AS month,\n COUNT(DISTINCT l.RelatedPostId) AS post_count\n FROM main.postLinks AS l\n JOIN main.posts AS p ON p.Id = l.RelatedPostId\n WHERE l.CreationDate >= '2010-01-01'\n AND l.CreationDate < '2011-01-01'\n AND p.AnswerCount <= 2\n GROUP BY month\n)\nSELECT ROUND(COALESCE(SUM(post_count), 0) / 12.0, 2) AS average_monthly_posts\nFROM monthly_counts\nLIMIT 1000\n```"}} +{"type":"turn.completed","usage":{"input_tokens":200311,"cached_input_tokens":183808,"cache_write_input_tokens":0,"output_tokens":907,"reasoning_output_tokens":130}} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/events/bird146.prompt.txt b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/events/bird146.prompt.txt new file mode 100644 index 00000000..cd66e7b2 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/events/bird146.prompt.txt @@ -0,0 +1,639 @@ +You must use lang2sql MCP to inspect the schema and execute your final answer query, not merely write SQL. Call resolve_business_terms before run_sql; use terms=[] only for literal diagnostics or fully specified request criteria. Inspect the returned result and return the exact successfully executed final SQL in one fenced sql block. A result table alone or SQL that you have not executed does not complete this task. Do not use shell, files, web, or other servers. Do not invent missing business definitions; if essential meaning remains unresolved, ask for clarification instead of inventing SQL or placeholders. +For each month of 2010, how many posts that have no more than two answers received a link during that month? A month with none counts as zero. Give me the average across all twelve months of 2010, rounded to two decimals. +Provided evidence: +A link is a recorded connection that associates one post with another post of the site. +Official schema metadata (examples are not exhaustive): +CREATE TABLE `badges` ( + `Id` INTEGER, -- the badge id; example: [1, 2] + `UserId` INTEGER, -- the unique id of the user; example: [5, 6] + `Name` TEXT, -- the badge name the user obtained; example: ['Teacher'] + `Date` DATETIME, -- the date that the user obtained the badge; example: ['2010-07-19 19:39:07.0'] + PRIMARY KEY (`Id`), + FOREIGN KEY (`UserId`) REFERENCES `users` (`Id`) +); + +CREATE TABLE `comments` ( + `Id` INTEGER, -- the comment Id; example: [1, 2] + `PostId` INTEGER, -- the unique id of the post; example: [3, 5] + `Score` INTEGER, -- rating score; example: [5, 0] + `Text` TEXT, -- the detailed content of the comment; example: ['Could be a poster child fo argumentative and subjective. At the least, need to d', "Yes, R is nice- but WHY is it 'valuable'."] + `CreationDate` DATETIME, -- the creation date of the comment; example: ['2010-07-19 19:15:52.0', '2010-07-19 19:16:14.0'] + `UserId` INTEGER, -- the id of the user who post the comment; example: [13, 37] + `UserDisplayName` TEXT, -- user's display name; example: [] + PRIMARY KEY (`Id`), + FOREIGN KEY (`UserId`) REFERENCES `users` (`Id`), + FOREIGN KEY (`PostId`) REFERENCES `posts` (`Id`) +); + +CREATE TABLE `postHistory` ( + `Id` INTEGER, -- the post history id; example: [1, 2] + `PostHistoryTypeId` INTEGER, -- the id of the post history type; example: [2, 1] + `PostId` INTEGER, -- the unique id of the post; example: [1, 2] + `RevisionGUID` TEXT, -- the revision globally unique id of the post; example: ['e58bf7fd-e60f-4c58-a6e4-dfc91cf98a69', '18bf9150-f1cb-432d-b7b7-26d2f8e33581'] + `CreationDate` DATETIME, -- the creation date of the post; example: ['2010-07-19 19:12:12.0', '2010-07-19 19:12:57.0'] + `UserId` INTEGER, -- the user who post the post; example: [8, 24] + `Text` TEXT, -- the detailed content of the post; example: ['How should I elicit prior distributions from experts when fitting a Bayesian mod', 'Eliciting priors from experts'] + `Comment` TEXT, -- comments of the post; example: [''] + `UserDisplayName` TEXT, -- user's display name; example: [''] + PRIMARY KEY (`Id`), + FOREIGN KEY (`UserId`) REFERENCES `users` (`Id`), + FOREIGN KEY (`PostId`) REFERENCES `posts` (`Id`) +); + +CREATE TABLE `postLinks` ( + `Id` INTEGER, -- the post link id; example: [108, 145] + `CreationDate` DATETIME, -- the creation date of the post link; example: ['2010-07-21 14:47:33.0', '2010-07-23 16:30:41.0'] + `PostId` INTEGER, -- the post id; example: [395, 548] + `RelatedPostId` INTEGER, -- the id of the related post; example: [173, 539] + `LinkTypeId` INTEGER, -- the id of the link type; example: [1] + PRIMARY KEY (`Id`), + FOREIGN KEY (`RelatedPostId`) REFERENCES `posts` (`Id`), + FOREIGN KEY (`PostId`) REFERENCES `posts` (`Id`) +); + +CREATE TABLE `posts` ( + `Id` INTEGER, -- the post id; example: [1, 2] + `PostTypeId` INTEGER, -- the id of the post type; example: [1, 2] + `AcceptedAnswerId` INTEGER, -- the accepted answer id of the post; example: [15, 59] + `CreaionDate` DATETIME, -- the creation date of the post; example: ['2010-07-19 19:12:12.0', '2010-07-19 19:12:57.0'] + `Score` INTEGER, -- the score of the post; example: [23, 22] + `ViewCount` INTEGER, -- the view count of the post; example: [1278, 8198] + `Body` TEXT, -- the body of the post; example: ['

How should I elicit prior distributions from experts when fitting a Bayesian ', '

In many different statistical methods there is an "assumption of normality". '] + `OwnerUserId` INTEGER, -- the id of the owner user; example: [8, 24] + `LasActivityDate` DATETIME, -- the last activity date; example: ['2010-09-15 21:08:26.0', '2012-11-12 09:21:54.0'] + `Title` TEXT, -- the title of the post; example: ['Eliciting priors from experts', 'What is normality?'] + `Tags` TEXT, -- the tag of the post; example: ['', ''] + `AnswerCount` INTEGER, -- the total number of answers of the post; example: [5, 7] + `CommentCount` INTEGER, -- the total number of comments of the post; example: [1, 4] + `FavoriteCount` INTEGER, -- the total number of favorites of the post; example: [14, 8] + `LastEditorUserId` INTEGER, -- the id of the last editor; example: [88, 183] + `LastEditDate` DATETIME, -- the last edit date; example: ['2010-08-07 17:56:44.0', '2011-02-12 05:50:03.0'] + `CommunityOwnedDate` DATETIME, -- the community owned date; example: ['2010-07-19 19:13:28.0', '2010-07-19 19:14:43.0'] + `ParentId` INTEGER, -- the id of the parent post; example: [3] + `ClosedDate` DATETIME, -- the closed date of the post; example: [] + `OwnerDisplayName` TEXT, -- the display name of the post owner; example: [] + `LastEditorDisplayName` TEXT, -- the display name of the last editor; example: [] + PRIMARY KEY (`Id`), + FOREIGN KEY (`ParentId`) REFERENCES `posts` (`Id`), + FOREIGN KEY (`OwnerUserId`) REFERENCES `users` (`Id`), + FOREIGN KEY (`LastEditorUserId`) REFERENCES `users` (`Id`) +); + +CREATE TABLE `tags` ( + `Id` INTEGER, -- the tag id; example: [1, 2] + `TagName` TEXT, -- the name of the tag; example: ['bayesian', 'prior'] + `Count` INTEGER, -- the count of posts that contain this tag; example: [1342, 168] + `ExcerptPostId` INTEGER, -- the excerpt post id of the tag; example: [20258, 62158] + `WikiPostId` INTEGER, -- the wiki post id of the tag; example: [20257, 62157] + PRIMARY KEY (`Id`), + FOREIGN KEY (`ExcerptPostId`) REFERENCES `posts` (`Id`) +); + +CREATE TABLE `users` ( + `Id` INTEGER, -- the user id; example: [-1, 2] + `Reputation` INTEGER, -- the user's reputation; example: [1, 101] + `CreationDate` DATETIME, -- the creation date of the user account; example: ['2010-07-19 06:55:26.0', '2010-07-19 14:01:36.0'] + `DisplayName` TEXT, -- the user's display name; example: ['Community', 'Geoff Dalgas'] + `LastAccessDate` DATETIME, -- the last access date of the user account; example: ['2010-07-19 06:55:26.0', '2013-11-12 22:07:23.0'] + `WebsiteUrl` TEXT, -- the website url of the user account; example: ['http://meta.stackexchange.com/', 'http://stackoverflow.com'] + `Location` TEXT, -- user's location; example: ['on the server farm', 'Corvallis, OR'] + `AboutMe` TEXT, -- the self introduction of the user; example: ["

Hi, I'm not really a person.

I'm a background process that helps keep ", '

Developer on the StackOverflow team. Find me on

this tag is more popular" + }, + { + "original_column_name": "ExcerptPostId", + "column_name": "Excerpt Post Id", + "column_description": "the excerpt post id of the tag", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "WikiPostId", + "column_name": "Wiki Post Id", + "column_description": "the wiki post id of the tag", + "data_format": "integer", + "value_description": "" + } + ], + "users": [ + { + "original_column_name": "Id", + "column_name": "", + "column_description": "the user id", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "Reputation", + "column_name": "", + "column_description": "the user's reputation", + "data_format": "integer", + "value_description": "commonsense evidence:\nThe user with higher reputation has more influence. " + }, + { + "original_column_name": "CreationDate", + "column_name": "Creation Date", + "column_description": "the creation date of the user account", + "data_format": "datetime", + "value_description": "" + }, + { + "original_column_name": "DisplayName", + "column_name": "Display Name", + "column_description": "the user's display name", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "LastAccessDate", + "column_name": "Last Access Date", + "column_description": "the last access date of the user account", + "data_format": "datetime", + "value_description": "" + }, + { + "original_column_name": "WebsiteUrl", + "column_name": "Website Url", + "column_description": "the website url of the user account", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "Location", + "column_name": "", + "column_description": "user's location", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "AboutMe", + "column_name": "About Me", + "column_description": "the self introduction of the user", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "Views", + "column_name": "", + "column_description": "the number of views ", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "UpVotes", + "column_name": "", + "column_description": "the number of upvotes", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "DownVotes", + "column_name": "", + "column_description": "the number of downvotes", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "AccountId", + "column_name": "Account Id", + "column_description": "the unique id of the account", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "Age", + "column_name": "", + "column_description": "user's age", + "data_format": "integer", + "value_description": "• teenager: 13-18\n• adult: 19-65\n• elder: > 65" + }, + { + "original_column_name": "ProfileImageUrl", + "column_name": "Profile Image Url", + "column_description": "the profile image url", + "data_format": "text", + "value_description": "" + } + ], + "votes": [ + { + "original_column_name": "Id", + "column_name": "", + "column_description": "the vote id", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "PostId", + "column_name": "Post Id", + "column_description": "the id of the post that is voted", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "VoteTypeId", + "column_name": "Vote Type Id", + "column_description": "the id of the vote type", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "CreationDate", + "column_name": "Creation Date", + "column_description": "the creation date of the vote", + "data_format": "datetime", + "value_description": "" + }, + { + "original_column_name": "UserId", + "column_name": "User Id", + "column_description": "the id of the voter", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "BountyAmount", + "column_name": "Bounty Amount", + "column_description": "the amount of bounty", + "data_format": "integer", + "value_description": "" + } + ] +} +Return your final answer as exactly one fenced ```sql block containing the single read-only SQLite SELECT/WITH query that answers the question. Do not include exploratory SQL in the final answer. Use the supplied documentation; no user simulator is available. \ No newline at end of file diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/events/bird146.stderr b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/events/bird146.stderr new file mode 100644 index 00000000..e69de29b diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/records/bird146.json b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/records/bird146.json new file mode 100644 index 00000000..a2b89d5c --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/records/bird146.json @@ -0,0 +1,152 @@ +{ + "instance_id": "bird146", + "profile": "codex-mcp", + "model": "gpt-6.2-astra", + "status": "predicted", + "calls": [], + "prompt_sha256": "d9d3970cae3788177bc53f4b97f5c4a7c8db2e53e5d0cd5d656203814ed74a24", + "events_sha256": "c005d7d9900bbb82b0dd6c9b6a9ea8267d1529426fa3ffa595f1df5fc89dec88", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 200311, + "cached_input_tokens": 183808, + "cache_write_input_tokens": 0, + "output_tokens": 907, + "reasoning_output_tokens": 130 + } + ], + "mcp_calls": [ + { + "id": "item_1", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "posts" + }, + "result": { + "content": [ + { + "type": "text", + "text": "posts (table)\n- Id: INTEGER NOT NULL\n- PostTypeId: INTEGER\n- AcceptedAnswerId: INTEGER\n- CreaionDate: DATETIME\n- Score: INTEGER\n- ViewCount: INTEGER\n- Body: TEXT\n- OwnerUserId: INTEGER\n- LasActivityDate: DATETIME\n- Title: TEXT\n- Tags: TEXT\n- AnswerCount: INTEGER\n- CommentCount: INTEGER\n- FavoriteCount: INTEGER\n- LastEditorUserId: INTEGER\n- LastEditDate: DATETIME\n- CommunityOwnedDate: DATETIME\n- ParentId: INTEGER\n- ClosedDate: DATETIME\n- OwnerDisplayName: TEXT\n- LastEditorDisplayName: TEXT\nPRIMARY KEY (Id)\nFOREIGN KEY (LastEditorUserId) REFERENCES users (Id)\nFOREIGN KEY (OwnerUserId) REFERENCES users (Id)\nFOREIGN KEY (ParentId) REFERENCES posts (Id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_2", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"u2vbfftjV4KgU3PRCm6g-SyKhMZvljoC1ctLE-w6G4E\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_3", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "postLinks" + }, + "result": { + "content": [ + { + "type": "text", + "text": "postLinks (table)\n- Id: INTEGER NOT NULL\n- CreationDate: DATETIME\n- PostId: INTEGER\n- RelatedPostId: INTEGER\n- LinkTypeId: INTEGER\nPRIMARY KEY (Id)\nFOREIGN KEY (PostId) REFERENCES posts (Id)\nFOREIGN KEY (RelatedPostId) REFERENCES posts (Id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_4", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "u2vbfftjV4KgU3PRCm6g-SyKhMZvljoC1ctLE-w6G4E", + "sql": "SELECT l.CreationDate, l.PostId, l.RelatedPostId, p.AnswerCount,\n instr(s.Body, '/questions/' || l.RelatedPostId || '/') > 0 AS source_links_to_related\nFROM main.postLinks AS l\nJOIN main.posts AS s ON s.Id = l.PostId\nJOIN main.posts AS p ON p.Id = l.RelatedPostId\nWHERE l.CreationDate >= '2010-01-01' AND l.CreationDate < '2011-01-01'\nORDER BY l.Id\nLIMIT 10" + }, + "result": { + "content": [ + { + "type": "text", + "text": "10 row(s):\nResult coverage: fetched_rows=10; displayed_rows=10; fetch_truncated=false; display_truncated=false; sql_rewritten=false; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): CreationDate=str; PostId=int; RelatedPostId=int; AnswerCount=int; source_links_to_related=int\nCreationDate | PostId | RelatedPostId | AnswerCount | source_links_to_related\n--- | --- | --- | --- | ---\n2010-07-21 14:47:33.0 | 395 | 173 | 9 | 0\n2010-07-23 16:30:41.0 | 548 | 539 | 8 | 1\n2010-07-26 20:12:15.0 | 375 | 30 | 8 | 1\n2010-07-27 16:00:22.0 | 769 | 31 | 10 | 0\n2010-07-27 16:00:22.0 | 769 | 6 | 15 | 0\n2010-07-27 17:19:27.0 | 790 | 298 | 6 | 0\n2010-07-27 23:22:51.0 | 715 | 7 | 24 | 0\n2010-07-28 19:36:09.0 | 834 | 577 | 10 | 0\n2010-07-29 19:01:22.0 | 614 | 170 | 19 | 1\n2010-08-01 12:08:34.0 | 222 | 213 | 13 | 1\nSQL: SELECT l.CreationDate, l.PostId, l.RelatedPostId, p.AnswerCount,\n instr(s.Body, '/questions/' || l.RelatedPostId || '/') > 0 AS source_links_to_related\nFROM main.postLinks AS l\nJOIN main.posts AS s ON s.Id = l.PostId\nJOIN main.posts AS p ON p.Id = l.RelatedPostId\nWHERE l.CreationDate >= '2010-01-01' AND l.CreationDate < '2011-01-01'\nORDER BY l.Id\nLIMIT 10" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_5", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"imd3Yo8Hu8dq_pozUpztRo6U9mbwWhYuZTuswFFIk_0\", \"definitions\": [], \"instruction\": \"For oracle_view the operator has confirmed the contract: call run_sql with this definition_check_id, period_start and exclusive period_end, without sql. An explicit calendar year/month is sufficient to derive these dates. Ask only if the period or business meaning is actually unclear. For text definitions use SQL. Discover schema and use qualified table names before run_sql. A receipt is not proof of SQL semantic correctness.\"}" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_6", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "imd3Yo8Hu8dq_pozUpztRo6U9mbwWhYuZTuswFFIk_0", + "expected_rows": 1, + "expected_columns": [ + "average_monthly_posts" + ], + "sql": "WITH monthly_counts AS (\n SELECT strftime('%Y-%m', l.CreationDate) AS month,\n COUNT(DISTINCT l.RelatedPostId) AS post_count\n FROM main.postLinks AS l\n JOIN main.posts AS p ON p.Id = l.RelatedPostId\n WHERE l.CreationDate >= '2010-01-01'\n AND l.CreationDate < '2011-01-01'\n AND p.AnswerCount <= 2\n GROUP BY month\n)\nSELECT ROUND(COALESCE(SUM(post_count), 0) / 12.0, 2) AS average_monthly_posts\nFROM monthly_counts;" + }, + "result": { + "content": [ + { + "type": "text", + "text": "1 row(s):\nOutput columns validated (projection only).\nOutput row count validated (executed SQL only).\nResult coverage: fetched_rows=1; displayed_rows=1; fetch_truncated=false; display_truncated=false; sql_rewritten=true; query_timeout_enforced=true; query_timeout_scope=sqlite_vm. Counts refer to the executed SQL, not the source table size.\nObserved value types (displayed rows): average_monthly_posts=float\naverage_monthly_posts\n---\n5.33\nSQL: WITH monthly_counts AS (\n SELECT strftime('%Y-%m', l.CreationDate) AS month,\n COUNT(DISTINCT l.RelatedPostId) AS post_count\n FROM main.postLinks AS l\n JOIN main.posts AS p ON p.Id = l.RelatedPostId\n WHERE l.CreationDate >= '2010-01-01'\n AND l.CreationDate < '2011-01-01'\n AND p.AnswerCount <= 2\n GROUP BY month\n)\nSELECT ROUND(COALESCE(SUM(post_count), 0) / 12.0, 2) AS average_monthly_posts\nFROM monthly_counts\nLIMIT 1000" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "```sql\nWITH monthly_counts AS (\n SELECT strftime('%Y-%m', l.CreationDate) AS month,\n COUNT(DISTINCT l.RelatedPostId) AS post_count\n FROM main.postLinks AS l\n JOIN main.posts AS p ON p.Id = l.RelatedPostId\n WHERE l.CreationDate >= '2010-01-01'\n AND l.CreationDate < '2011-01-01'\n AND p.AnswerCount <= 2\n GROUP BY month\n)\nSELECT ROUND(COALESCE(SUM(post_count), 0) / 12.0, 2) AS average_monthly_posts\nFROM monthly_counts\nLIMIT 1000\n```", + "event_parse_errors": [], + "rows": 1, + "sql": "WITH monthly_counts AS (\n SELECT strftime('%Y-%m', l.CreationDate) AS month,\n COUNT(DISTINCT l.RelatedPostId) AS post_count\n FROM main.postLinks AS l\n JOIN main.posts AS p ON p.Id = l.RelatedPostId\n WHERE l.CreationDate >= '2010-01-01'\n AND l.CreationDate < '2011-01-01'\n AND p.AnswerCount <= 2\n GROUP BY month\n)\nSELECT ROUND(COALESCE(SUM(post_count), 0) / 12.0, 2) AS average_monthly_posts\nFROM monthly_counts\nLIMIT 1000", + "seconds": 34.83458570798393 +} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/scores.json b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/scores.json new file mode 100644 index 00000000..e3256c6f --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/scores.json @@ -0,0 +1,7 @@ +[ + { + "instance_id": "bird146", + "score": 0, + "status": "predicted" + } +] diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/sql/bird146.sql b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/sql/bird146.sql new file mode 100644 index 00000000..bab2ec3e --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/sql/bird146.sql @@ -0,0 +1,13 @@ +WITH monthly_counts AS ( + SELECT strftime('%Y-%m', l.CreationDate) AS month, + COUNT(DISTINCT l.RelatedPostId) AS post_count + FROM main.postLinks AS l + JOIN main.posts AS p ON p.Id = l.RelatedPostId + WHERE l.CreationDate >= '2010-01-01' + AND l.CreationDate < '2011-01-01' + AND p.AnswerCount <= 2 + GROUP BY month +) +SELECT ROUND(COALESCE(SUM(post_count), 0) / 12.0, 2) AS average_monthly_posts +FROM monthly_counts +LIMIT 1000 diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/status.json b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/status.json new file mode 100644 index 00000000..c6558d52 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/codex-mcp/status.json @@ -0,0 +1,4 @@ +{ + "status": "completed", + "wall_seconds": 34.83558187505696 +} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/manifest.json b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/manifest.json new file mode 100644 index 00000000..1402f660 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/manifest.json @@ -0,0 +1,533 @@ +{ + "benchmark": "BIRD Mini-Dev SQLite 500 (2026-10-25)", + "upstream_commit": "5b256b5a9c17478f06ed6912612e9a14d17065c8", + "question_file_sha256": "926af2a0d1b47e5d0d15a7aa8a34d4721007f4550a881555b6a89496b54a2606", + "evaluator_sha256": "da1bbcd4530be83692d7c650c814ea9704bb710d0c953eb75d02ccb38233cf89", + "cases": [ + { + "instance_id": "bird146", + "db": "codebase_community", + "question": "For each month of 2010, how many posts that have no more than two answers received a link during that month? A month with none counts as zero. Give me the average across all twelve months of 2010, rounded to two decimals.", + "evidence": "A link is a recorded connection that associates one post with another post of the site." + } + ], + "db_sha256": { + "california_schools": "c0903eec662e63068fd1d14403d3d6c1d473287fc10c4356333ea58f878db983", + "card_games": "c98bdb57fe7474da798b407785544b9af0daaad5d61fd21e2a73309493bc1227", + "codebase_community": "92101be6d2a9f6adceea59d38f6d1c556087f9eea1432432a21268cb1348036d", + "debit_card_specializing": "b3d149ad05746dbbe5116e229e17e18f09c39db43cf117d9ef3441753608b691", + "european_football_2": "f72f5c9b990371417288a67b27a02e601ef904d45525c2c9f7931fb01001c536", + "financial": "d15d89cdb068a202b6f2b99342af44dffc1d52545b39ceaf62efdc0ba570101e", + "formula_1": "79770caf966707e35516fa566e24b40ae515c74ec1ec4631235245645b87b24d", + "student_club": "eb89bcfe97eefa386a27904ec5aa15159811a7eac894ec659a36e48fa9f76b77", + "superhero": "75e94a2c3236ee3bb2c01fb97a1c4b4c1c269bcefd4eab1d04be323d2d0825b1", + "thrombosis_prediction": "87583183c3dc472fba04de702965560a9d7c0a548836613f242317e0eeb83f00", + "toxicology": "4df4094208e0799d5e5f0e2b5bc5c415cf87b1208ebaf8f4c14c7af445b682c5" + }, + "suite": "bird", + "development_ids": [ + "bird058", + "bird024", + "bird451", + "bird229", + "bird146", + "bird389", + "bird152", + "bird353", + "bird064", + "bird087", + "bird260", + "bird449", + "bird249", + "bird470", + "bird379", + "bird179", + "bird036", + "bird429", + "bird459", + "bird423" + ], + "holdout_ids": [ + "bird023", + "bird238", + "bird358", + "bird324", + "bird155", + "bird267", + "bird110", + "bird192", + "bird226", + "bird365", + "bird128", + "bird381", + "bird305", + "bird408", + "bird001", + "bird413", + "bird120", + "bird432", + "bird160", + "bird027", + "bird199", + "bird095", + "bird407", + "bird091", + "bird489", + "bird209", + "bird194", + "bird313", + "bird015", + "bird051", + "bird270", + "bird130", + "bird427", + "bird167", + "bird360", + "bird061", + "bird450", + "bird097", + "bird032", + "bird341", + "bird006", + "bird156", + "bird471", + "bird119", + "bird369", + "bird256", + "bird057", + "bird222", + "bird361", + "bird205", + "bird356", + "bird279", + "bird412", + "bird488", + "bird496", + "bird295", + "bird404", + "bird390", + "bird417", + "bird440", + "bird211", + "bird487", + "bird005", + "bird299", + "bird397", + "bird346", + "bird315", + "bird484", + "bird472", + "bird162", + "bird428", + "bird254", + "bird349", + "bird017", + "bird446", + "bird232", + "bird236", + "bird071", + "bird063", + "bird244", + "bird062", + "bird157", + "bird480", + "bird185", + "bird248", + "bird463", + "bird035", + "bird345", + "bird088", + "bird072", + "bird443", + "bird135", + "bird474", + "bird275", + "bird495", + "bird148", + "bird444", + "bird331", + "bird060", + "bird431", + "bird416", + "bird117", + "bird410", + "bird079", + "bird326", + "bird105", + "bird436", + "bird383", + "bird139", + "bird350", + "bird182", + "bird485", + "bird132", + "bird245", + "bird424", + "bird292", + "bird098", + "bird030", + "bird329", + "bird430", + "bird191", + "bird455", + "bird434", + "bird348", + "bird026", + "bird011", + "bird089", + "bird212", + "bird103", + "bird083", + "bird008", + "bird074", + "bird050", + "bird106", + "bird259", + "bird376", + "bird067", + "bird193", + "bird055", + "bird044", + "bird264", + "bird198", + "bird003", + "bird075", + "bird380", + "bird033", + "bird025", + "bird301", + "bird196", + "bird114", + "bird077", + "bird303", + "bird204", + "bird366", + "bird240", + "bird123", + "bird195", + "bird333", + "bird158", + "bird112", + "bird469", + "bird493", + "bird368", + "bird306", + "bird462", + "bird490", + "bird285", + "bird246", + "bird373", + "bird273", + "bird289", + "bird276", + "bird168", + "bird342", + "bird492", + "bird387", + "bird337", + "bird189", + "bird184", + "bird401", + "bird352", + "bird200", + "bird280", + "bird002", + "bird048", + "bird186", + "bird174", + "bird498", + "bird141", + "bird239", + "bird039", + "bird216", + "bird022", + "bird332", + "bird294", + "bird045", + "bird169", + "bird172", + "bird040", + "bird242", + "bird107", + "bird250", + "bird382", + "bird491", + "bird347", + "bird076", + "bird497", + "bird116", + "bird374", + "bird262", + "bird453", + "bird171", + "bird043", + "bird217", + "bird178", + "bird257", + "bird386", + "bird396", + "bird181", + "bird439", + "bird419", + "bird415", + "bird111", + "bird164", + "bird414", + "bird406", + "bird296", + "bird101", + "bird409", + "bird251", + "bird118", + "bird268", + "bird086", + "bird010", + "bird056", + "bird127", + "bird210", + "bird122", + "bird161", + "bird367", + "bird218", + "bird457", + "bird144", + "bird372", + "bird286", + "bird370", + "bird154", + "bird124", + "bird084", + "bird177", + "bird099", + "bird143", + "bird435", + "bird402", + "bird336", + "bird479", + "bird125", + "bird290", + "bird335", + "bird094", + "bird300", + "bird482", + "bird466", + "bird214", + "bird281", + "bird392", + "bird082", + "bird233", + "bird013", + "bird478", + "bird153", + "bird420", + "bird477", + "bird096", + "bird258", + "bird247", + "bird494", + "bird351", + "bird344", + "bird081", + "bird241", + "bird473", + "bird355", + "bird049", + "bird384", + "bird037", + "bird145", + "bird377", + "bird224", + "bird481", + "bird009", + "bird159", + "bird411", + "bird421", + "bird458", + "bird448", + "bird029", + "bird137", + "bird163", + "bird134", + "bird225", + "bird468", + "bird034", + "bird080", + "bird271", + "bird100", + "bird263", + "bird325", + "bird398", + "bird093", + "bird452", + "bird066", + "bird031", + "bird287", + "bird007", + "bird235", + "bird312", + "bird340", + "bird362", + "bird028", + "bird019", + "bird298", + "bird138", + "bird418", + "bird359", + "bird046", + "bird113", + "bird230", + "bird073", + "bird202", + "bird070", + "bird433", + "bird265", + "bird322", + "bird021", + "bird314", + "bird311", + "bird394", + "bird004", + "bird391", + "bird140", + "bird425", + "bird321", + "bird282", + "bird221", + "bird183", + "bird228", + "bird078", + "bird467", + "bird012", + "bird147", + "bird197", + "bird109", + "bird266", + "bird316", + "bird283", + "bird378", + "bird483", + "bird441", + "bird085", + "bird310", + "bird475", + "bird297", + "bird261", + "bird388", + "bird339", + "bird170", + "bird447", + "bird129", + "bird486", + "bird136", + "bird052", + "bird375", + "bird288", + "bird456", + "bird165", + "bird476", + "bird219", + "bird338", + "bird499", + "bird059", + "bird255", + "bird464", + "bird302", + "bird357", + "bird142", + "bird393", + "bird328", + "bird215", + "bird042", + "bird284", + "bird277", + "bird102", + "bird272", + "bird020", + "bird307", + "bird330", + "bird304", + "bird442", + "bird253", + "bird000", + "bird454", + "bird363", + "bird223", + "bird047", + "bird220", + "bird231", + "bird400", + "bird465", + "bird385", + "bird309", + "bird206", + "bird445", + "bird461", + "bird317", + "bird237", + "bird399", + "bird422", + "bird460", + "bird175", + "bird318", + "bird108", + "bird069", + "bird068", + "bird092", + "bird173", + "bird234", + "bird090", + "bird014", + "bird151", + "bird213", + "bird018", + "bird133", + "bird187", + "bird269", + "bird131", + "bird203", + "bird308", + "bird180", + "bird054", + "bird405", + "bird395", + "bird364", + "bird121", + "bird371", + "bird293", + "bird038", + "bird426", + "bird252", + "bird104", + "bird190", + "bird188", + "bird354", + "bird201", + "bird207", + "bird437", + "bird291", + "bird334", + "bird274", + "bird065", + "bird403", + "bird278", + "bird126", + "bird176", + "bird208", + "bird053", + "bird150", + "bird320", + "bird323", + "bird115", + "bird327", + "bird166", + "bird149", + "bird438", + "bird041", + "bird343", + "bird319", + "bird016", + "bird227", + "bird243" + ], + "split_seed": 20261126 +} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/protocol.json b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/protocol.json new file mode 100644 index 00000000..6206e604 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/protocol.json @@ -0,0 +1,82 @@ +{ + "revision": "5374b07b7cb128613620dc241080112b5f98b7b9", + "ids": [ + "bird001", + "bird003", + "bird063", + "bird093", + "bird107", + "bird115", + "bird120", + "bird142", + "bird146", + "bird148", + "bird149", + "bird162", + "bird204", + "bird225", + "bird228", + "bird231", + "bird273", + "bird279", + "bird303", + "bird318", + "bird321", + "bird329", + "bird330", + "bird346", + "bird352", + "bird358", + "bird359", + "bird395", + "bird400", + "bird452", + "bird483" + ], + "validated_failure_sources": { + "bird001": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-evidence-review-20261127/bird-gpt-6.2-astra", + "bird003": "/Users/seyoung/workspace/benchmarks/codex-mcp-recovered-failures-astra-20261127/bird-gpt-6.2-astra", + "bird063": "/Users/seyoung/workspace/benchmarks/codex-mcp-unobserved-20261127/checkpoints/011/bird", + "bird093": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-multistage-20261127/bird-gpt-6.2-astra", + "bird107": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-bird-backlog-20261127/bird-gpt-6.2-astra", + "bird115": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-bird-backlog-20261127/bird-gpt-6.2-astra", + "bird120": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-bird-backlog-20261127/bird-gpt-6.2-astra", + "bird142": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-bird-backlog-20261127/bird-gpt-6.2-astra", + "bird146": "/Users/seyoung/workspace/benchmarks/codex-mcp-output-row-contract-20261127/bird-gpt-6.2-astra", + "bird148": "/Users/seyoung/workspace/benchmarks/codex-mcp-unobserved-20261127/checkpoints/011/bird", + "bird149": "/Users/seyoung/workspace/benchmarks/codex-mcp-unobserved-20261127/checkpoints/011/bird", + "bird162": "/Users/seyoung/workspace/benchmarks/codex-mcp-unobserved-20261127/checkpoints/011/bird", + "bird204": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-bird-backlog-20261127/bird-gpt-6.2-astra", + "bird225": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-bird-backlog-20261127/bird-gpt-6.2-astra", + "bird228": "/Users/seyoung/workspace/benchmarks/codex-mcp-unobserved-20261127/checkpoints/011/bird", + "bird231": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-bird-backlog-20261127/bird-gpt-6.2-astra", + "bird273": "/Users/seyoung/workspace/benchmarks/codex-mcp-grouped-row-contract-20261127/bird-gpt-6.2-astra", + "bird279": "/Users/seyoung/workspace/benchmarks/codex-mcp-unobserved-20261127/checkpoints/011/bird", + "bird303": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-bird-backlog-20261127/bird-gpt-6.2-astra", + "bird318": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-bird-backlog-20261127/bird-gpt-6.2-astra", + "bird321": "/Users/seyoung/workspace/benchmarks/codex-mcp-unobserved-20261127/checkpoints/011/bird", + "bird329": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-evidence-review-20261127/bird-gpt-6.2-astra", + "bird330": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-bird-backlog-20261127/bird-gpt-6.2-astra", + "bird346": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-bird-backlog-20261127/bird-gpt-6.2-astra", + "bird352": "/Users/seyoung/workspace/benchmarks/codex-mcp-unobserved-20261127/checkpoints/011/bird", + "bird358": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-evidence-review-20261127/bird-gpt-6.2-astra", + "bird359": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-evidence-review-20261127/bird-gpt-6.2-astra", + "bird395": "/Users/seyoung/workspace/benchmarks/codex-mcp-unobserved-20261127/checkpoints/011/bird", + "bird400": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-bird-backlog-20261127/bird-gpt-6.2-astra", + "bird452": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-bird-backlog-20261127/bird-gpt-6.2-astra", + "bird483": "/Users/seyoung/workspace/benchmarks/codex-mcp-astra-bird-backlog-20261127/bird-gpt-6.2-astra" + }, + "audit_sha256": "e8164064681d0ca263c97b0ae527035a0b1da239cd0df031c54706d7f7b93d54", + "selection": "All31observedneverpassedBIRDcases after63validatedtrials including checkpoint011; previouslypassedcasesexcluded. Livecoverageisnotrestarted.", + "model": "gpt-6.2-astra", + "effort": "high", + "schema_variant": "bird-schema-with-values.json", + "new_code_or_prompt_changes": 0, + "inference": "Fresh original question/evidence with full official75CSVmetadata. No previousanswer,score,gold or diagnosis supplied.", + "limits": [ + "Selected failure cohort, not full500 accuracy.", + "No policy change: still clarify genuinelymissingdefinitions.", + "Candidate differs from historical sources in prior fixes; not isolated metadata ablation.", + "Allresultsretained; no restart on observationtimeouts." + ] +} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/requested-manifest.json b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/requested-manifest.json new file mode 100644 index 00000000..775e7480 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/requested-manifest.json @@ -0,0 +1,713 @@ +{ + "benchmark": "BIRD Mini-Dev SQLite 500 (2026-10-25)", + "upstream_commit": "5b256b5a9c17478f06ed6912612e9a14d17065c8", + "question_file_sha256": "926af2a0d1b47e5d0d15a7aa8a34d4721007f4550a881555b6a89496b54a2606", + "evaluator_sha256": "da1bbcd4530be83692d7c650c814ea9704bb710d0c953eb75d02ccb38233cf89", + "cases": [ + { + "instance_id": "bird001", + "db": "california_schools", + "question": "For locally funded schools whose K-12 minus ages-5-17 enrollment difference exceeds the average such difference among locally funded schools, list each school's directory-listed name and DOC type.", + "evidence": "" + }, + { + "instance_id": "bird003", + "db": "california_schools", + "question": "What is the ratio of merged Unified School District schools in Orange County to merged Elementary School District schools?", + "evidence": "" + }, + { + "instance_id": "bird063", + "db": "card_games", + "question": "I'm cataloguing how the frame styles on Tarmogoyf's printings evolved over time. What is the number of years between the oldest and the newest frame style used on the printings of Tarmogoyf? The span in years is the newer year minus the older year.", + "evidence": "Frame style version means the year a card's frame style dates from." + }, + { + "instance_id": "bird093", + "db": "card_games", + "question": "Among the cards carrying the boros watermark that were printed in a foreign language, which card type is the most common, and how many of those cards have that type? If several types tie for the most, list all of them with their counts.", + "evidence": "\"Boros watermark\" refers to the guild watermark appearing on cards of the Boros guild; \"printed in a foreign language\" means the card was printed in any language other than English." + }, + { + "instance_id": "bird107", + "db": "card_games", + "question": "I'm assembling a Japanese-language boros deck and want to check which cards need careful rules review. For every card that has a boros watermark and a Japanese printing, please give me: the Japanese card name, the English card type, and the total number of official rulings recorded for that card. A card is identified by its Japanese name together with its English card type - printings that share both count as one card, and if either differs they should be listed as separate cards. The ruling total should add up all ruling entries across every printing of that card, and if a card has no rulings, list it with a total of 0.", + "evidence": "Boros watermark means the watermark is marked 'boros' on the card; a Japanese printing is the foreign data entry in Japanese; rulings are the official rules clarifications recorded for a card." + }, + { + "instance_id": "bird115", + "db": "card_games", + "question": "Among the Commander-type expansion sets released in calendar year 2020 (1 January 2020 to 31 December 2020), I need the one with the highest total card count, so we can plan translation work. Please send me the set's id from the sets listing, its name, and the number of official languages it was released in. The total card count should include promotional and related supplemental products, but exclude Alchemy modifications. If two sets tie for the highest total card count, list each of them, ordered by set id ascending.", + "evidence": "Commander: a multiplayer expansion type of the game. Alchemy modifications: online-only variant versions of cards." + }, + { + "instance_id": "bird120", + "db": "codebase_community", + "question": "What is the difference in percentage points between the 2010 and 2011 shares of all Student badges, taking the 2010 share minus the 2011 share?", + "evidence": "" + }, + { + "instance_id": "bird142", + "db": "codebase_community", + "question": "I'm auditing accounts on the stats forum. What is the id of the youngest user account whose display name is Michael? If two or more such accounts tie as the youngest, give me the smallest id.", + "evidence": "" + }, + { + "instance_id": "bird146", + "db": "codebase_community", + "question": "For each month of 2010, how many posts that have no more than two answers received a link during that month? A month with none counts as zero. Give me the average across all twelve months of 2010, rounded to two decimals.", + "evidence": "A link is a recorded connection that associates one post with another post of the site." + }, + { + "instance_id": "bird148", + "db": "codebase_community", + "question": "I'm reviewing the history of the question 'Why square the difference instead of taking the absolute value in standard deviation?'. For that post, who left the most edit comments, and how many did they leave? Please give me each editor's display name along with their number of edit comments on that post. If several editors are tied for the most, list each of them with their count. Also, please count every revision as its own event, even when successive revisions carry the same note.", + "evidence": "An edit comment is the note an editor records together with a revision of a post, not a comment posted under the post." + }, + { + "instance_id": "bird149", + "db": "debit_card_specializing", + "question": "For each of the SME, LAM, and KAM segments, identify the CZK customer with the lowest total recorded consumption in 2013, breaking a tie by smaller customer ID. What are the differences between those customers' 2013 totals in SME minus LAM, LAM minus KAM, and KAM minus SME order? Round each to two decimals.", + "evidence": "" + }, + { + "instance_id": "bird162", + "db": "debit_card_specializing", + "question": "For my February 2013 activity report: how many SME customers actually purchased gas in February 2013? Please give me just a single whole number - the count of SME customers who consumed gas during the calendar month of February 2013 (Feb 1-28, 2013).", + "evidence": "By \"gas\" I mean gasoline (motor fuel) purchases, not natural gas." + }, + { + "instance_id": "bird204", + "db": "financial", + "question": "As part of a data-quality review for a segment report, I need to know how much of the recorded transaction activity for one of our segments has no payment purpose noted. How many transactions are there, over the whole recorded history, on the accounts held by male customers born between 1974 and 1976 (birth years 1974, 1975 and 1976), for which no payment purpose is noted? Please give me just that single number.", + "evidence": "Payment purpose: the stated reason or note recorded for a transaction." + }, + { + "instance_id": "bird225", + "db": "financial", + "question": "I'm putting together a review of our first credit card wave and need a profile of every client who was issued a credit card in 1994 (issue date falling in calendar year 1994). For each such client, please include: client id, gender, birth date, card type, age at card issue (the card's issue year minus the client's birth year), number of loans on their account, total amount borrowed, borrower classification, district name, district average salary, and their age rank within gender. Use these classifications: Young borrower if there's at least one loan on the account and age at card issue is under 30; Mature borrower if there's at least one loan and age at card issue is 30 or more; otherwise Non-borrower. The age rank within gender should be a standard competition rank - equal ages share a rank and the next rank is skipped (e.g. 1, 1, 3). Order the rows by client id.", + "evidence": "" + }, + { + "instance_id": "bird228", + "db": "financial", + "question": "For the year-end review of my branch at location 1: how many accounts that were on the branch's books as of 31 December 1995 hold an active loan contract? I want a single integer, nothing else. An account counts only if it belonged to the branch on that date, and only contracts that are still active by their repayment status count - statuses A and B are finished contracts and shouldn't be included.", + "evidence": "Loan status C means an active contract in good standing; loan status D means an active contract with the client in debt. Both are active contracts." + }, + { + "instance_id": "bird231", + "db": "financial", + "question": "I need to find out where our pre-1997 long-term mortgage exposure is concentrated geographically. Long-term means a loan duration of more than 24 months, and \"opened before 1997\" should exclude anything opened during 1997. Please tell me: for each region, which districts have at least one such account, and give me the region whose qualifying districts have the largest combined number of inhabitants. Along with the region's name, I want the number of those districts in it, their combined population, and the total number of those accounts in the region. If two regions tie on combined population, pick the one whose name comes first alphabetically.", + "evidence": "" + }, + { + "instance_id": "bird273", + "db": "formula_1", + "question": "I'm writing a piece about how the same common forenames recur across Formula 1 history. Could you tell me how many different drivers named Peter have ever won a Formula 1 race, and the same for drivers named John? Please give me one count per forename, so I can compare the two — if they turn out to be equal, just report both counts side by side. Nothing else needed.", + "evidence": "A race win means the driver finished first in that race." + }, + { + "instance_id": "bird279", + "db": "formula_1", + "question": "I'm profiling the oldest driver ever to win a Formula 1 race. Please identify the winning driver with the earliest date of birth - if two winning drivers share that birth date, use the one whose full name (forename then surname) comes first alphabetically. For that driver, return his full name (forename then surname), his nationality, the name and date of the first race he won (the earliest date; if two of his wins share that date, the one whose race name comes first alphabetically), and the total number of races he started over his entire career. A win means finishing in position 1 in a race. The career covers every race in the database, from 1950 through 2017. Return a single row.", + "evidence": "Grand Prix: any race event in the database, whatever its name is; some race names do not contain the words 'Grand Prix'." + }, + { + "instance_id": "bird303", + "db": "student_club", + "question": "I'm reviewing our roster against the catalog and want to see how much of the College of Humanities and Social Sciences' coverage our members actually hold, department by department. For each department in that college, give me: the department's name, the majors it offers, the majors held by at least one of our members, and the average members per major it offers, rounded to two decimals. Membership is as currently listed in the member records, and count a department as belonging to the college when any of its majors sits in the college.", + "evidence": "College of Humanities and Social Sciences: one of the colleges that houses departments offering majors." + }, + { + "instance_id": "bird318", + "db": "student_club", + "question": "What is the date of the Vice President's most recent expense on record, and what is the total cost of all expenses incurred on that date? Consider all expenses on record with no earlier cut-off, and give the total exactly as it appears in the records, without rounding.", + "evidence": "Vice President is a position of the Student Club." + }, + { + "instance_id": "bird321", + "db": "student_club", + "question": "I want to review what the money actually went on for the well-funded events, by venue. For events that had a budget line of more than forty dollars, how many different things were bought for them at each location? Please give me, for each location, the location of the event and the number of different things bought for such events at that location, and nothing else. Note that a budget line of more than forty dollars means a single budgeted amount strictly over 40 dollars, and all qualifying events held at a location should be pooled together.", + "evidence": "" + }, + { + "instance_id": "bird329", + "db": "student_club", + "question": "I'm preparing the year-end audit of club spending. For each item Sacha Harrison bought with club money, I need the item name and how many times she bought it. Can you give me that list?", + "evidence": "By \"item\" I mean an individual thing named in a record of what money was spent for." + }, + { + "instance_id": "bird330", + "db": "student_club", + "question": "I'm putting together the end-of-term spending review. Who bought the most different kinds of items in October or November 2019? Please give me that member's full name, how many different kinds of items they bought in those two months, and their total spending in dollars over the same period. If two members tie for the most kinds, list every tied member with their kind count and spending.", + "evidence": "An item is one of the individual things a purchase covered, such as a pizza or a bottle of water." + }, + { + "instance_id": "bird346", + "db": "superhero", + "question": "I'm writing an article about heroes who fall outside the classic good-versus-evil divide. How many superheroes in the database have an alignment that is neither good nor bad? Please give me just that count. Note that this should cover all superheroes in the database.", + "evidence": "good: a superhero whose alignment is Good; bad: a superhero whose alignment is Bad; alignment: the moral category assigned to a superhero" + }, + { + "instance_id": "bird352", + "db": "superhero", + "question": "How many characters published by A-Bomb's publisher have no race listed? I just need a single count. (By A-Bomb's publisher, I mean the publisher that publishes the character A-Bomb.)", + "evidence": "race: the character's race or group, e.g. Human, Alien, Mutant" + }, + { + "instance_id": "bird358", + "db": "superhero", + "question": "I'm writing a piece about which real publishing companies have put out very tall heroes. How many publishers in the database have released at least one hero taller than 200 cm? Note that taller than 200 cm means strictly more than 200 cm, and it counts if even one of their heroes is that tall. I just need the number of publishers, nothing else.", + "evidence": "A hero's publisher being 'released' means the publisher the hero is attributed to in the database." + }, + { + "instance_id": "bird359", + "db": "superhero", + "question": "For a licensing survey of non-DC heroic characters, I need a single total count of superheroes whose alignment is Good and who are not published by DC Comics. Just that one number, please.", + "evidence": "Good means the hero's alignment is Good; DC Comics means the publisher named DC Comics." + }, + { + "instance_id": "bird395", + "db": "thrombosis_prediction", + "question": "As part of the data-completeness review, I'd like to know how much laboratory follow-up our never-examined patients actually have, split by sex. Could you give me, for each sex (F and M), the average number of laboratory test dates recorded for the patients of that sex who have no examination record at all? Please cover the whole registry, all years, and round the averages to two decimal places. Nothing else needed beyond the two averages.", + "evidence": "F denotes a female patient and M denotes a male patient. A laboratory test date is a date on which laboratory tests were recorded for a patient." + }, + { + "instance_id": "bird400", + "db": "thrombosis_prediction", + "question": "I'm studying patients who carry exactly the rheumatoid arthritis and Sjögren's syndrome overlap. Please look at each patient's own record and find those whose record names exactly rheumatoid arthritis and Sjögren's syndrome, in either order, and no other disease – a disease recorded only as suspected does not count as a diagnosis. For those patients, considering their whole recorded laboratory history regardless of date, I need two numbers: how many have had at least one laboratory result showing a normal platelet level, and how many have never had a laboratory result showing a normal platelet level – count a patient with no laboratory results at all as never having had a normal platelet result.", + "evidence": "Rheumatoid arthritis is recorded as the code RA and Sjögren's syndrome as the code SJS. A normal platelet level means a platelet count above 100 and below 400." + }, + { + "instance_id": "bird452", + "db": "thrombosis_prediction", + "question": "I'm reviewing confirmed SLE cases for a study of neurologic involvement. Among patients whose examination lists SLE among the diagnosed diseases and who have a symptom recorded at such an examination, I need the case detail of the youngest such patient. Please send me the symptom recorded at that qualifying examination and that patient's overall diagnosis (their overall diagnosis, not the diagnosis written at the examination). If two patients share the same birth date, use the one with the smaller patient ID; and if that patient has more than one qualifying examination, use the most recent one.", + "evidence": "SLE is systemic lupus erythematosus. A disease name followed by 'susp' means the disease was only suspected, not diagnosed." + }, + { + "instance_id": "bird483", + "db": "toxicology", + "question": "For the carcinogenic molecules in the toxicology database, how many carbon-carbon bonds are there of each bond type (single, double, and triple)? Please give me the bond type and the corresponding count.", + "evidence": "A molecule labelled '+' is carcinogenic. Bond types are recorded as follows: a single bond as '-', a double bond as '=', and a triple bond as '#'. A carbon-carbon bond is a bond whose two bonded atoms are both carbon." + } + ], + "db_sha256": { + "california_schools": "c0903eec662e63068fd1d14403d3d6c1d473287fc10c4356333ea58f878db983", + "card_games": "c98bdb57fe7474da798b407785544b9af0daaad5d61fd21e2a73309493bc1227", + "codebase_community": "92101be6d2a9f6adceea59d38f6d1c556087f9eea1432432a21268cb1348036d", + "debit_card_specializing": "b3d149ad05746dbbe5116e229e17e18f09c39db43cf117d9ef3441753608b691", + "european_football_2": "f72f5c9b990371417288a67b27a02e601ef904d45525c2c9f7931fb01001c536", + "financial": "d15d89cdb068a202b6f2b99342af44dffc1d52545b39ceaf62efdc0ba570101e", + "formula_1": "79770caf966707e35516fa566e24b40ae515c74ec1ec4631235245645b87b24d", + "student_club": "eb89bcfe97eefa386a27904ec5aa15159811a7eac894ec659a36e48fa9f76b77", + "superhero": "75e94a2c3236ee3bb2c01fb97a1c4b4c1c269bcefd4eab1d04be323d2d0825b1", + "thrombosis_prediction": "87583183c3dc472fba04de702965560a9d7c0a548836613f242317e0eeb83f00", + "toxicology": "4df4094208e0799d5e5f0e2b5bc5c415cf87b1208ebaf8f4c14c7af445b682c5" + }, + "suite": "bird", + "development_ids": [ + "bird058", + "bird024", + "bird451", + "bird229", + "bird146", + "bird389", + "bird152", + "bird353", + "bird064", + "bird087", + "bird260", + "bird449", + "bird249", + "bird470", + "bird379", + "bird179", + "bird036", + "bird429", + "bird459", + "bird423" + ], + "holdout_ids": [ + "bird023", + "bird238", + "bird358", + "bird324", + "bird155", + "bird267", + "bird110", + "bird192", + "bird226", + "bird365", + "bird128", + "bird381", + "bird305", + "bird408", + "bird001", + "bird413", + "bird120", + "bird432", + "bird160", + "bird027", + "bird199", + "bird095", + "bird407", + "bird091", + "bird489", + "bird209", + "bird194", + "bird313", + "bird015", + "bird051", + "bird270", + "bird130", + "bird427", + "bird167", + "bird360", + "bird061", + "bird450", + "bird097", + "bird032", + "bird341", + "bird006", + "bird156", + "bird471", + "bird119", + "bird369", + "bird256", + "bird057", + "bird222", + "bird361", + "bird205", + "bird356", + "bird279", + "bird412", + "bird488", + "bird496", + "bird295", + "bird404", + "bird390", + "bird417", + "bird440", + "bird211", + "bird487", + "bird005", + "bird299", + "bird397", + "bird346", + "bird315", + "bird484", + "bird472", + "bird162", + "bird428", + "bird254", + "bird349", + "bird017", + "bird446", + "bird232", + "bird236", + "bird071", + "bird063", + "bird244", + "bird062", + "bird157", + "bird480", + "bird185", + "bird248", + "bird463", + "bird035", + "bird345", + "bird088", + "bird072", + "bird443", + "bird135", + "bird474", + "bird275", + "bird495", + "bird148", + "bird444", + "bird331", + "bird060", + "bird431", + "bird416", + "bird117", + "bird410", + "bird079", + "bird326", + "bird105", + "bird436", + "bird383", + "bird139", + "bird350", + "bird182", + "bird485", + "bird132", + "bird245", + "bird424", + "bird292", + "bird098", + "bird030", + "bird329", + "bird430", + "bird191", + "bird455", + "bird434", + "bird348", + "bird026", + "bird011", + "bird089", + "bird212", + "bird103", + "bird083", + "bird008", + "bird074", + "bird050", + "bird106", + "bird259", + "bird376", + "bird067", + "bird193", + "bird055", + "bird044", + "bird264", + "bird198", + "bird003", + "bird075", + "bird380", + "bird033", + "bird025", + "bird301", + "bird196", + "bird114", + "bird077", + "bird303", + "bird204", + "bird366", + "bird240", + "bird123", + "bird195", + "bird333", + "bird158", + "bird112", + "bird469", + "bird493", + "bird368", + "bird306", + "bird462", + "bird490", + "bird285", + "bird246", + "bird373", + "bird273", + "bird289", + "bird276", + "bird168", + "bird342", + "bird492", + "bird387", + "bird337", + "bird189", + "bird184", + "bird401", + "bird352", + "bird200", + "bird280", + "bird002", + "bird048", + "bird186", + "bird174", + "bird498", + "bird141", + "bird239", + "bird039", + "bird216", + "bird022", + "bird332", + "bird294", + "bird045", + "bird169", + "bird172", + "bird040", + "bird242", + "bird107", + "bird250", + "bird382", + "bird491", + "bird347", + "bird076", + "bird497", + "bird116", + "bird374", + "bird262", + "bird453", + "bird171", + "bird043", + "bird217", + "bird178", + "bird257", + "bird386", + "bird396", + "bird181", + "bird439", + "bird419", + "bird415", + "bird111", + "bird164", + "bird414", + "bird406", + "bird296", + "bird101", + "bird409", + "bird251", + "bird118", + "bird268", + "bird086", + "bird010", + "bird056", + "bird127", + "bird210", + "bird122", + "bird161", + "bird367", + "bird218", + "bird457", + "bird144", + "bird372", + "bird286", + "bird370", + "bird154", + "bird124", + "bird084", + "bird177", + "bird099", + "bird143", + "bird435", + "bird402", + "bird336", + "bird479", + "bird125", + "bird290", + "bird335", + "bird094", + "bird300", + "bird482", + "bird466", + "bird214", + "bird281", + "bird392", + "bird082", + "bird233", + "bird013", + "bird478", + "bird153", + "bird420", + "bird477", + "bird096", + "bird258", + "bird247", + "bird494", + "bird351", + "bird344", + "bird081", + "bird241", + "bird473", + "bird355", + "bird049", + "bird384", + "bird037", + "bird145", + "bird377", + "bird224", + "bird481", + "bird009", + "bird159", + "bird411", + "bird421", + "bird458", + "bird448", + "bird029", + "bird137", + "bird163", + "bird134", + "bird225", + "bird468", + "bird034", + "bird080", + "bird271", + "bird100", + "bird263", + "bird325", + "bird398", + "bird093", + "bird452", + "bird066", + "bird031", + "bird287", + "bird007", + "bird235", + "bird312", + "bird340", + "bird362", + "bird028", + "bird019", + "bird298", + "bird138", + "bird418", + "bird359", + "bird046", + "bird113", + "bird230", + "bird073", + "bird202", + "bird070", + "bird433", + "bird265", + "bird322", + "bird021", + "bird314", + "bird311", + "bird394", + "bird004", + "bird391", + "bird140", + "bird425", + "bird321", + "bird282", + "bird221", + "bird183", + "bird228", + "bird078", + "bird467", + "bird012", + "bird147", + "bird197", + "bird109", + "bird266", + "bird316", + "bird283", + "bird378", + "bird483", + "bird441", + "bird085", + "bird310", + "bird475", + "bird297", + "bird261", + "bird388", + "bird339", + "bird170", + "bird447", + "bird129", + "bird486", + "bird136", + "bird052", + "bird375", + "bird288", + "bird456", + "bird165", + "bird476", + "bird219", + "bird338", + "bird499", + "bird059", + "bird255", + "bird464", + "bird302", + "bird357", + "bird142", + "bird393", + "bird328", + "bird215", + "bird042", + "bird284", + "bird277", + "bird102", + "bird272", + "bird020", + "bird307", + "bird330", + "bird304", + "bird442", + "bird253", + "bird000", + "bird454", + "bird363", + "bird223", + "bird047", + "bird220", + "bird231", + "bird400", + "bird465", + "bird385", + "bird309", + "bird206", + "bird445", + "bird461", + "bird317", + "bird237", + "bird399", + "bird422", + "bird460", + "bird175", + "bird318", + "bird108", + "bird069", + "bird068", + "bird092", + "bird173", + "bird234", + "bird090", + "bird014", + "bird151", + "bird213", + "bird018", + "bird133", + "bird187", + "bird269", + "bird131", + "bird203", + "bird308", + "bird180", + "bird054", + "bird405", + "bird395", + "bird364", + "bird121", + "bird371", + "bird293", + "bird038", + "bird426", + "bird252", + "bird104", + "bird190", + "bird188", + "bird354", + "bird201", + "bird207", + "bird437", + "bird291", + "bird334", + "bird274", + "bird065", + "bird403", + "bird278", + "bird126", + "bird176", + "bird208", + "bird053", + "bird150", + "bird320", + "bird323", + "bird115", + "bird327", + "bird166", + "bird149", + "bird438", + "bird041", + "bird343", + "bird319", + "bird016", + "bird227", + "bird243" + ], + "split_seed": 20261126 +} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/settings.json b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/settings.json new file mode 100644 index 00000000..96ea2812 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/settings.json @@ -0,0 +1,26 @@ +{ + "profiles": [ + { + "name": "codex-mcp", + "model": "gpt-6.2-astra", + "reasoning_effort": "high" + } + ], + "backend": "ChatGPT login -> Codex CLI -> production Lang2SQL MCP", + "revision": "5374b07b7cb128613620dc241080112b5f98b7b9", + "codex_version": "codex-cli 0.170.0", + "sources": { + "bench/accuracy/codex_mcp.py": "561eded13c1b46c3e942ea3a2904da46c65629b4201d28f4fb7e75d12ccf58c0", + "src/lang2sql/frontends/mcp/server.py": "0836ca4631f321c3f3a2c7524e71f6f31e60ac77286633833af6810d3443ddcb" + }, + "schema_document_sha256": "7f3a02f99f90eadd69974fe5f45ca5d4abf90a1549e4deb46ae24b0093bde9c6", + "review_source": null, + "failure_selection": null, + "split": "development", + "concurrency": 2, + "case_timeout": 600.0, + "sql_timeout": 30, + "max_rows": 100000, + "api_calls": null, + "usage_unit": "one Codex CLI invocation per question; internal model-call count unavailable" +} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/summary.json b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/summary.json new file mode 100644 index 00000000..b787263e --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/partial-selection/summary.json @@ -0,0 +1,8 @@ +[ + { + "profile": "codex-mcp", + "correct": 0, + "total": 1, + "accuracy": 0.0 + } +] diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/sha256.json b/bench/accuracy/mcp-review-results/selection-count-validation/sha256.json new file mode 100644 index 00000000..2a26ceb5 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/sha256.json @@ -0,0 +1,40 @@ +{ + "analysis.json": "10b63dc4c055e6155c1a3cb07f6ce674d3f01ec41d246e53170bb2da8b935c54", + "guarded-two-case/codex-mcp/csv/bird467.csv": "9541ce50dc06713548554e1a49081d739e076ac3e4c4b1186aeed5b06b3313bc", + "guarded-two-case/codex-mcp/csv/bird495.csv": "ba193968c57a78e13a7e9f42b86445fd764efa4129491417e626b1169460e0bb", + "guarded-two-case/codex-mcp/events/bird467.answer.txt": "737637650065b8b0330cf4bc66b67d791c3bfafefe8c847a9f4f69d5ec4ac832", + "guarded-two-case/codex-mcp/events/bird467.jsonl": "ce1c1e772137a7c87670959bbe9934b80348ae7bce685e36ea1e3fcb90c356d1", + "guarded-two-case/codex-mcp/events/bird467.prompt.txt": "f3edaf9e4dc49ac60e37e0a804dbda0947e6f058351c2e000d6e178d6ec7aa08", + "guarded-two-case/codex-mcp/events/bird467.stderr": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "guarded-two-case/codex-mcp/events/bird495.answer.txt": "50104c05eb3041fb77508876a13a69efaa2f000e87bc890b87a60e5f59da9340", + "guarded-two-case/codex-mcp/events/bird495.jsonl": "6b56f47ecfc4b2b1b3185035090a97e1692d6da1e76629768e3cf57559f1a377", + "guarded-two-case/codex-mcp/events/bird495.prompt.txt": "a8c14bf30100acafa9be3de43d5e9e0d606fc9ecbbaff611e29f06291e448800", + "guarded-two-case/codex-mcp/events/bird495.stderr": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "guarded-two-case/codex-mcp/records/bird467.json": "ace676de777f7445298264e69be127e09c0485364387d43d2e98713f4a83a788", + "guarded-two-case/codex-mcp/records/bird495.json": "02c14827ddc59eff953b526c2fdbf24629daf98f315100514be3520f63c0a2d4", + "guarded-two-case/codex-mcp/scores.json": "aef4e2f22eda86e750e71159195d4f850659d283738079696e45c45ec5a5583c", + "guarded-two-case/codex-mcp/sql/bird467.sql": "d5daa379c9709aa26f715905fb8eec28ec37d1f4cde0f311325f5bc75eaf26cb", + "guarded-two-case/codex-mcp/sql/bird495.sql": "7ff56f4a0603c33cc0ca493eb041f362ccc9dd78b51b05ebfd68095424d8a2fd", + "guarded-two-case/codex-mcp/status.json": "b71e1956256378e4c8325c08fa01d66d10d06fe33998fa4239183637fc729959", + "guarded-two-case/comparison/comparison.json": "f558a4c1cc739f747cfd8a9c39902490f4c92f5b911a7f73e8e73d6ec28f5d0f", + "guarded-two-case/comparison/index.html": "caf0dc0f9f96a44cbc9bc0f9d0ee732baa187865cfabb02b250ab9bb565b71b6", + "guarded-two-case/manifest.json": "89d88fef2d11d6a618bcbdf27cf9fcfbc23770f37d9231e801e06dc110fc0bbd", + "guarded-two-case/protocol.json": "958b82f963d5bb8f9e1b5449d30677bc0d22f7d0b8c5c909f5b50be45893f1f9", + "guarded-two-case/requested-manifest.json": "89d88fef2d11d6a618bcbdf27cf9fcfbc23770f37d9231e801e06dc110fc0bbd", + "guarded-two-case/settings.json": "4c8e8471308136d24eecb5af8585145b20fcffae988a725816265e583dce3590", + "guarded-two-case/summary.json": "8bfb6bf95237721208f4b2f590f699e507c75d87b5eaa321db454892af7adc7c", + "partial-selection/codex-mcp/csv/bird146.csv": "0b9cbd80d9686d8952b98ea1f0098ac223b901ba64e1e3f45578301f53676e3e", + "partial-selection/codex-mcp/events/bird146.answer.txt": "cd4b580feb2dc400a85c60719528d937c91bed31748215129f4bb577af0cd5c7", + "partial-selection/codex-mcp/events/bird146.jsonl": "c005d7d9900bbb82b0dd6c9b6a9ea8267d1529426fa3ffa595f1df5fc89dec88", + "partial-selection/codex-mcp/events/bird146.prompt.txt": "d9d3970cae3788177bc53f4b97f5c4a7c8db2e53e5d0cd5d656203814ed74a24", + "partial-selection/codex-mcp/events/bird146.stderr": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "partial-selection/codex-mcp/records/bird146.json": "eed4bf291cf63cccacc62702d91388f969109e6a74c3822588407404cfd60d78", + "partial-selection/codex-mcp/scores.json": "221b9abc627016bf71a8a38bf3771c9427233ada5dd493b361ecc05379b3678b", + "partial-selection/codex-mcp/sql/bird146.sql": "542c099f21286de1c03df77526e648ebb6e306d5b88c9b3a2746c65bff618057", + "partial-selection/codex-mcp/status.json": "ab80dac4b249bf224021bf46c1a6f0524ce8af16641f7963b5ac13042ccb8bfc", + "partial-selection/manifest.json": "742d500d5aa4eea752ce6245f6d7302003f850fa207c0914368ea7dde3e850de", + "partial-selection/protocol.json": "b0b99a91fc7594ce9589fe5c9a2c7e0093d02db08c3c80c28cd8a47986e8d054", + "partial-selection/requested-manifest.json": "19f12f866db43dd79ea5fce021ab98bd66eb4afcbc0c33332696a7f9164b8021", + "partial-selection/settings.json": "10177dc56ad88c95c8c66965791ef6e847f1c037262937f1d72f27223e7849ca", + "partial-selection/summary.json": "8f3fcdc8d7ea6392ccdeb7e607ede75cb9f00743b9684fbfb5d23fb5f6863318" +} From 0b6250ff917b23a2659dc96d722094ba7840778b Mon Sep 17 00:00:00 2001 From: seyeong Date: Fri, 27 Nov 2026 08:11:42 +0900 Subject: [PATCH 3/3] Isolate chronology-filter mismatch without misattributing numeric casts --- .../bird467-filter-audit.json | 43 +++++++++++++++++++ .../selection-count-validation/sha256.json | 1 + 2 files changed, 44 insertions(+) create mode 100644 bench/accuracy/mcp-review-results/selection-count-validation/bird467-filter-audit.json diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/bird467-filter-audit.json b/bench/accuracy/mcp-review-results/selection-count-validation/bird467-filter-audit.json new file mode 100644 index 00000000..4e4feaf3 --- /dev/null +++ b/bench/accuracy/mcp-review-results/selection-count-validation/bird467-filter-audit.json @@ -0,0 +1,43 @@ +{ + "source_record_sha256": "ace676de777f7445298264e69be127e09c0485364387d43d2e98713f4a83a788", + "questions_sha256": "926af2a0d1b47e5d0d15a7aa8a34d4721007f4550a881555b6a89496b54a2606", + "db_sha256": "87583183c3dc472fba04de702965560a9d7c0a548836613f242317e0eeb83f00", + "sql_variants": { + "model": "SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (CAST(l.\"U-PRO\" AS REAL) > 0 OR l.\"U-PRO\" IN ('TR', '%%'))\nLIMIT 1", + "protein_predicate_only": "SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" >= p.Birthday\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND l.\"U-PRO\" IS NOT NULL AND l.\"U-PRO\" NOT IN ('-', '0')\nLIMIT 1", + "remove_unrequested_nonnegative_age_only": "SELECT COUNT(DISTINCT l.ID) AS patient_count\nFROM main.Laboratory AS l\nJOIN main.Patient AS p ON p.ID = l.ID\nWHERE l.\"Date\" BETWEEN '1981-01-01' AND '1986-12-31'\n AND l.\"Date\" < date(p.Birthday, '+50 years')\n AND l.PLT BETWEEN 100 AND 400\n AND (CAST(l.\"U-PRO\" AS REAL) > 0 OR l.\"U-PRO\" IN ('TR', '%%'))\nLIMIT 1", + "reference": "SELECT COUNT(DISTINCT p.ID) AS patient_count FROM Patient AS p JOIN Laboratory AS l ON l.ID = p.ID WHERE SUBSTR(l.Date, 1, 4) BETWEEN '1981' AND '1986' AND l.PLT BETWEEN 100 AND 400 AND p.Birthday IS NOT NULL AND (CAST(SUBSTR(l.Date, 1, 4) AS INTEGER) - CAST(SUBSTR(p.Birthday, 1, 4) AS INTEGER) - CASE WHEN SUBSTR(l.Date, 6, 5) < SUBSTR(p.Birthday, 6, 5) THEN 1 ELSE 0 END) < 50 AND l.\"U-PRO\" IS NOT NULL AND l.\"U-PRO\" NOT IN ('-', '0')" + }, + "results": { + "model": [ + [ + 71 + ] + ], + "protein_predicate_only": [ + [ + 71 + ] + ], + "remove_unrequested_nonnegative_age_only": [ + [ + 73 + ] + ], + "reference": [ + [ + 73 + ] + ] + }, + "added_patient_ids_without_chronology_filter": [ + 2047892, + 3385021 + ], + "finding": "Changingonlyproteinpredicate doesnotfixcount. Removingmodel-addedtest-date>=birthdateconditionalone changes71to73matchingreference. The2addedpatientsqualifythroughpre-birthdatetestrecords.", + "limits": [ + "Offlinecounterfactualonly;notmodelrepairorinput.", + "Originalofficialgrade0retained.", + "Do notsilentlyremovechronologyvalidationasgeneralproductpolicyjusttomatchreference." + ] +} diff --git a/bench/accuracy/mcp-review-results/selection-count-validation/sha256.json b/bench/accuracy/mcp-review-results/selection-count-validation/sha256.json index 2a26ceb5..969914b6 100644 --- a/bench/accuracy/mcp-review-results/selection-count-validation/sha256.json +++ b/bench/accuracy/mcp-review-results/selection-count-validation/sha256.json @@ -1,5 +1,6 @@ { "analysis.json": "10b63dc4c055e6155c1a3cb07f6ce674d3f01ec41d246e53170bb2da8b935c54", + "bird467-filter-audit.json": "6fb158879bb31194abd3a1ddf349d07530c28507adee319010aa9e01a575808f", "guarded-two-case/codex-mcp/csv/bird467.csv": "9541ce50dc06713548554e1a49081d739e076ac3e4c4b1186aeed5b06b3313bc", "guarded-two-case/codex-mcp/csv/bird495.csv": "ba193968c57a78e13a7e9f42b86445fd764efa4129491417e626b1169460e0bb", "guarded-two-case/codex-mcp/events/bird467.answer.txt": "737637650065b8b0330cf4bc66b67d791c3bfafefe8c847a9f4f69d5ec4ac832",