diff --git a/bench/accuracy/mcp-review-results/rate-projection-30f20bd/manifest.json b/bench/accuracy/mcp-review-results/rate-projection-30f20bd/manifest.json new file mode 100644 index 00000000..d7f2bff7 --- /dev/null +++ b/bench/accuracy/mcp-review-results/rate-projection-30f20bd/manifest.json @@ -0,0 +1,40 @@ +{ + "benchmark": "BIRD Mini-Dev SQLite 500 (2026-10-25)", + "upstream_commit": "5b256b5a9c17478f06ed6912612e9a14d17065c8", + "question_file_sha256": "926af2a0d1b47e5d0d15a7aa8a34d4721007f4550a881555b6a89496b54a2606", + "evaluator_sha256": "da1bbcd4530be83692d7c650c814ea9704bb710d0c953eb75d02ccb38233cf89", + "cases": [ + { + "instance_id": "bird000", + "db": "california_schools", + "question": "Among schools with a school-level SAT excellence rate above 0.3, what is the highest ages-5-17 free-meal eligibility rate?", + "evidence": "SAT excellence rate is the share of test takers scoring at least 1500." + }, + { + "instance_id": "bird002", + "db": "california_schools", + "question": "For the five schools with ownership code 66 and the largest K-12 free-or-reduced-price meal counts, give each school's K-12 eligible meal rate rounded to six decimal places.", + "evidence": "" + } + ], + "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": [ + "bird000", + "bird002" + ], + "holdout_ids": [], + "split_seed": 20261126 +} diff --git a/bench/accuracy/mcp-review-results/rate-projection-30f20bd/protocol.json b/bench/accuracy/mcp-review-results/rate-projection-30f20bd/protocol.json new file mode 100644 index 00000000..b09b681b --- /dev/null +++ b/bench/accuracy/mcp-review-results/rate-projection-30f20bd/protocol.json @@ -0,0 +1,13 @@ +{ + "source": "/Users/seyoung/workspace/benchmarks/codex-mcp-prior-full-failures-20261127/completed-snapshot-001/bird", + "source_scores_sha256": "c8472485e67a402acf64581e2265677769dc5b53b4f562c3f384d221294ad971", + "selection": [ + "bird000", + "bird002" + ], + "reason": "rate computation drift and extra projected label in completed failed cases", + "model": "gpt-6.2-sol", + "reasoning_effort": "high", + "metric": "targeted failure repair; not full accuracy", + "no_grade_feedback_in_prompt": true +} diff --git a/bench/accuracy/mcp-review-results/rate-projection-30f20bd/records/bird000.json b/bench/accuracy/mcp-review-results/rate-projection-30f20bd/records/bird000.json new file mode 100644 index 00000000..c9ded50e --- /dev/null +++ b/bench/accuracy/mcp-review-results/rate-projection-30f20bd/records/bird000.json @@ -0,0 +1,146 @@ +{ + "instance_id": "bird000", + "profile": "codex-mcp", + "model": "gpt-6.2-sol", + "status": "predicted", + "calls": [], + "events_sha256": "8b3de9191ba827b0265011ef20c70d92ea431d0de3d98cbb5c7cb78650e8da93", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 165952, + "cached_input_tokens": 153472, + "cache_write_input_tokens": 0, + "output_tokens": 1001, + "reasoning_output_tokens": 213 + } + ], + "mcp_calls": [ + { + "id": "item_1", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "frpm" + }, + "result": { + "content": [ + { + "type": "text", + "text": "frpm (table)\n- CDSCode: TEXT NOT NULL\n- Academic Year: TEXT\n- County Code: TEXT\n- District Code: INTEGER\n- School Code: TEXT\n- County Name: TEXT\n- District Name: TEXT\n- School Name: TEXT\n- District Type: TEXT\n- School Type: TEXT\n- Educational Option Type: TEXT\n- NSLP Provision Status: TEXT\n- Charter School (Y/N): INTEGER\n- Charter School Number: TEXT\n- Charter Funding Type: TEXT\n- IRC: INTEGER\n- Low Grade: TEXT\n- High Grade: TEXT\n- Enrollment (K-12): REAL\n- Free Meal Count (K-12): REAL\n- Percent (%) Eligible Free (K-12): REAL\n- FRPM Count (K-12): REAL\n- Percent (%) Eligible FRPM (K-12): REAL\n- Enrollment (Ages 5-17): REAL\n- Free Meal Count (Ages 5-17): REAL\n- Percent (%) Eligible Free (Ages 5-17): REAL\n- FRPM Count (Ages 5-17): REAL\n- Percent (%) Eligible FRPM (Ages 5-17): REAL\n- 2013-14 CALPADS Fall 1 Certification Status: INTEGER\nPRIMARY KEY (CDSCode)\nFOREIGN KEY (CDSCode) REFERENCES schools (CDSCode)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_2", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "satscores" + }, + "result": { + "content": [ + { + "type": "text", + "text": "satscores (table)\n- cds: TEXT NOT NULL\n- rtype: TEXT NOT NULL\n- sname: TEXT\n- dname: TEXT\n- cname: TEXT\n- enroll12: INTEGER NOT NULL\n- NumTstTakr: INTEGER NOT NULL\n- AvgScrRead: INTEGER\n- AvgScrMath: INTEGER\n- AvgScrWrite: INTEGER\n- NumGE1500: INTEGER\nPRIMARY KEY (cds)\nFOREIGN KEY (cds) REFERENCES schools (CDSCode)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_3", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"eVqWbHxqp1Hx2ZbhmGRFAnsa7R-vkA0jC-hyMHcF-Tk\", \"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_4", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "eVqWbHxqp1Hx2ZbhmGRFAnsa7R-vkA0jC-hyMHcF-Tk", + "sql": "SELECT\n s.rtype,\n COUNT(*) AS sat_rows,\n COUNT(f.CDSCode) AS matched_rows,\n SUM(CASE WHEN s.NumTstTakr = 0 THEN 1 ELSE 0 END) AS zero_test_takers,\n SUM(CASE WHEN typeof(s.NumGE1500) NOT IN ('integer', 'null') THEN 1 ELSE 0 END) AS noninteger_score_counts,\n SUM(CASE WHEN f.\"Enrollment (Ages 5-17)\" = 0 THEN 1 ELSE 0 END) AS zero_enrollment,\n SUM(CASE WHEN typeof(f.\"Free Meal Count (Ages 5-17)\") NOT IN ('real', 'integer', 'null')\n OR typeof(f.\"Enrollment (Ages 5-17)\") NOT IN ('real', 'integer', 'null')\n THEN 1 ELSE 0 END) AS nonnumeric_meal_inputs,\n COUNT(f.\"Percent (%) Eligible Free (Ages 5-17)\") AS stored_rate_rows\nFROM main.satscores AS s\nLEFT JOIN main.frpm AS f ON f.CDSCode = s.cds\nGROUP BY s.rtype" + }, + "result": { + "content": [ + { + "type": "text", + "text": "2 row(s):\nObserved value types (displayed rows): rtype=str; sat_rows=int; matched_rows=int; zero_test_takers=int; noninteger_score_counts=int; zero_enrollment=int; nonnumeric_meal_inputs=int; stored_rate_rows=int\nrtype | sat_rows | matched_rows | zero_test_takers | noninteger_score_counts | zero_enrollment | nonnumeric_meal_inputs | stored_rate_rows\n--- | --- | --- | --- | --- | --- | --- | ---\nD | 520 | 35 | 36 | 0 | 0 | 0 | 29\nS | 1749 | 1747 | 182 | 0 | 0 | 0 | 1734\nSQL: SELECT\n s.rtype,\n COUNT(*) AS sat_rows,\n COUNT(f.CDSCode) AS matched_rows,\n SUM(CASE WHEN s.NumTstTakr = 0 THEN 1 ELSE 0 END) AS zero_test_takers,\n SUM(CASE WHEN typeof(s.NumGE1500) NOT IN ('integer', 'null') THEN 1 ELSE 0 END) AS noninteger_score_counts,\n SUM(CASE WHEN f.\"Enrollment (Ages 5-17)\" = 0 THEN 1 ELSE 0 END) AS zero_enrollment,\n SUM(CASE WHEN typeof(f.\"Free Meal Count (Ages 5-17)\") NOT IN ('real', 'integer', 'null')\n OR typeof(f.\"Enrollment (Ages 5-17)\") NOT IN ('real', 'integer', 'null')\n THEN 1 ELSE 0 END) AS nonnumeric_meal_inputs,\n COUNT(f.\"Percent (%) Eligible Free (Ages 5-17)\") AS stored_rate_rows\nFROM main.satscores AS s\nLEFT JOIN main.frpm AS f ON f.CDSCode = s.cds\nGROUP BY s.rtype\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\": \"0R1PqV-7AQj8dxVxC2XRfmgE8kgKEYT9r5rgK49sDh4\", \"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": "0R1PqV-7AQj8dxVxC2XRfmgE8kgKEYT9r5rgK49sDh4", + "sql": "SELECT MAX(\n CAST(f.\"Free Meal Count (Ages 5-17)\" AS REAL)\n / NULLIF(f.\"Enrollment (Ages 5-17)\", 0)\n) AS highest_free_meal_eligibility_rate\nFROM main.satscores AS s\nJOIN main.frpm AS f ON f.CDSCode = s.cds\nWHERE s.rtype = 'S'\n AND CAST(s.NumGE1500 AS REAL) / NULLIF(s.NumTstTakr, 0) > 0.3\nLIMIT 1" + }, + "result": { + "content": [ + { + "type": "text", + "text": "1 row(s):\nObserved value types (displayed rows): highest_free_meal_eligibility_rate=float\nhighest_free_meal_eligibility_rate\n---\n0.9049079754601227\nSQL: SELECT MAX(\n CAST(f.\"Free Meal Count (Ages 5-17)\" AS REAL)\n / NULLIF(f.\"Enrollment (Ages 5-17)\", 0)\n) AS highest_free_meal_eligibility_rate\nFROM main.satscores AS s\nJOIN main.frpm AS f ON f.CDSCode = s.cds\nWHERE s.rtype = 'S'\n AND CAST(s.NumGE1500 AS REAL) / NULLIF(s.NumTstTakr, 0) > 0.3\nLIMIT 1" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "```sql\nSELECT MAX(\n CAST(f.\"Free Meal Count (Ages 5-17)\" AS REAL)\n / NULLIF(f.\"Enrollment (Ages 5-17)\", 0)\n) AS highest_free_meal_eligibility_rate\nFROM main.satscores AS s\nJOIN main.frpm AS f ON f.CDSCode = s.cds\nWHERE s.rtype = 'S'\n AND CAST(s.NumGE1500 AS REAL) / NULLIF(s.NumTstTakr, 0) > 0.3\nLIMIT 1\n```", + "rows": 1, + "sql": "SELECT MAX(\n CAST(f.\"Free Meal Count (Ages 5-17)\" AS REAL)\n / NULLIF(f.\"Enrollment (Ages 5-17)\", 0)\n) AS highest_free_meal_eligibility_rate\nFROM main.satscores AS s\nJOIN main.frpm AS f ON f.CDSCode = s.cds\nWHERE s.rtype = 'S'\n AND CAST(s.NumGE1500 AS REAL) / NULLIF(s.NumTstTakr, 0) > 0.3\nLIMIT 1", + "seconds": 36.641486749984324 +} diff --git a/bench/accuracy/mcp-review-results/rate-projection-30f20bd/records/bird002.json b/bench/accuracy/mcp-review-results/rate-projection-30f20bd/records/bird002.json new file mode 100644 index 00000000..e77e82c2 --- /dev/null +++ b/bench/accuracy/mcp-review-results/rate-projection-30f20bd/records/bird002.json @@ -0,0 +1,146 @@ +{ + "instance_id": "bird002", + "profile": "codex-mcp", + "model": "gpt-6.2-sol", + "status": "predicted", + "calls": [], + "events_sha256": "a5d7c069ea1c1a489b2b4289a3a707952d91b85216d5cbed44bf07f46ad62562", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 167253, + "cached_input_tokens": 154752, + "cache_write_input_tokens": 0, + "output_tokens": 971, + "reasoning_output_tokens": 235 + } + ], + "mcp_calls": [ + { + "id": "item_1", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "schools" + }, + "result": { + "content": [ + { + "type": "text", + "text": "schools (table)\n- CDSCode: TEXT NOT NULL\n- NCESDist: TEXT\n- NCESSchool: TEXT\n- StatusType: TEXT NOT NULL\n- County: TEXT NOT NULL\n- District: TEXT NOT NULL\n- School: TEXT\n- Street: TEXT\n- StreetAbr: TEXT\n- City: TEXT\n- Zip: TEXT\n- State: TEXT\n- MailStreet: TEXT\n- MailStrAbr: TEXT\n- MailCity: TEXT\n- MailZip: TEXT\n- MailState: TEXT\n- Phone: TEXT\n- Ext: TEXT\n- Website: TEXT\n- OpenDate: DATE\n- ClosedDate: DATE\n- Charter: INTEGER\n- CharterNum: TEXT\n- FundingType: TEXT\n- DOC: TEXT NOT NULL\n- DOCType: TEXT NOT NULL\n- SOC: TEXT\n- SOCType: TEXT\n- EdOpsCode: TEXT\n- EdOpsName: TEXT\n- EILCode: TEXT\n- EILName: TEXT\n- GSoffered: TEXT\n- GSserved: TEXT\n- Virtual: TEXT\n- Magnet: INTEGER\n- Latitude: REAL\n- Longitude: REAL\n- AdmFName1: TEXT\n- AdmLName1: TEXT\n- AdmEmail1: TEXT\n- AdmFName2: TEXT\n- AdmLName2: TEXT\n- AdmEmail2: TEXT\n- AdmFName3: TEXT\n- AdmLName3: TEXT\n- AdmEmail3: TEXT\n- LastUpdate: DATE NOT NULL\nPRIMARY KEY (CDSCode)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_2", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "frpm" + }, + "result": { + "content": [ + { + "type": "text", + "text": "frpm (table)\n- CDSCode: TEXT NOT NULL\n- Academic Year: TEXT\n- County Code: TEXT\n- District Code: INTEGER\n- School Code: TEXT\n- County Name: TEXT\n- District Name: TEXT\n- School Name: TEXT\n- District Type: TEXT\n- School Type: TEXT\n- Educational Option Type: TEXT\n- NSLP Provision Status: TEXT\n- Charter School (Y/N): INTEGER\n- Charter School Number: TEXT\n- Charter Funding Type: TEXT\n- IRC: INTEGER\n- Low Grade: TEXT\n- High Grade: TEXT\n- Enrollment (K-12): REAL\n- Free Meal Count (K-12): REAL\n- Percent (%) Eligible Free (K-12): REAL\n- FRPM Count (K-12): REAL\n- Percent (%) Eligible FRPM (K-12): REAL\n- Enrollment (Ages 5-17): REAL\n- Free Meal Count (Ages 5-17): REAL\n- Percent (%) Eligible Free (Ages 5-17): REAL\n- FRPM Count (Ages 5-17): REAL\n- Percent (%) Eligible FRPM (Ages 5-17): REAL\n- 2013-14 CALPADS Fall 1 Certification Status: INTEGER\nPRIMARY KEY (CDSCode)\nFOREIGN KEY (CDSCode) REFERENCES schools (CDSCode)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_3", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"EGjrc9f-o_PbOQHcWTfgLzMmNox63vnpIFI1PTua9q4\", \"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_4", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "EGjrc9f-o_PbOQHcWTfgLzMmNox63vnpIFI1PTua9q4", + "sql": "SELECT\n s.SOCType,\n COUNT(*) OVER () AS matched_schools,\n COUNT(f.\"FRPM Count (K-12)\") OVER () AS schools_with_meal_counts,\n f.\"FRPM Count (K-12)\" AS meal_count,\n f.\"Enrollment (K-12)\" AS enrollment,\n ROUND(f.\"Percent (%) Eligible FRPM (K-12)\", 6) AS stored_rate,\n ROUND(1.0 * f.\"FRPM Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0), 6) AS calculated_rate\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE s.SOC = '66'\nORDER BY f.\"FRPM Count (K-12)\" DESC, s.CDSCode\nLIMIT 6;" + }, + "result": { + "content": [ + { + "type": "text", + "text": "6 row(s):\nObserved value types (displayed rows): SOCType=str; matched_schools=int; schools_with_meal_counts=int; meal_count=float; enrollment=float; stored_rate=float; calculated_rate=float\nSOCType | matched_schools | schools_with_meal_counts | meal_count | enrollment | stored_rate | calculated_rate\n--- | --- | --- | --- | --- | --- | ---\nHigh Schools (Public) | 1292 | 1289 | 4419.0 | 4814.0 | 0.917948 | 0.917948\nHigh Schools (Public) | 1292 | 1289 | 2979.0 | 2981.0 | 0.999329 | 0.999329\nHigh Schools (Public) | 1292 | 1289 | 2919.0 | 3256.0 | 0.896499 | 0.896499\nHigh Schools (Public) | 1292 | 1289 | 2872.0 | 3206.0 | 0.89582 | 0.89582\nHigh Schools (Public) | 1292 | 1289 | 2727.0 | 2983.0 | 0.91418 | 0.91418\nHigh Schools (Public) | 1292 | 1289 | 2679.0 | 3530.0 | 0.758924 | 0.758924\nSQL: SELECT\n s.SOCType,\n COUNT(*) OVER () AS matched_schools,\n COUNT(f.\"FRPM Count (K-12)\") OVER () AS schools_with_meal_counts,\n f.\"FRPM Count (K-12)\" AS meal_count,\n f.\"Enrollment (K-12)\" AS enrollment,\n ROUND(f.\"Percent (%) Eligible FRPM (K-12)\", 6) AS stored_rate,\n ROUND(1.0 * f.\"FRPM Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0), 6) AS calculated_rate\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE s.SOC = '66'\nORDER BY f.\"FRPM Count (K-12)\" DESC, s.CDSCode\nLIMIT 6;" + } + ], + "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\": \"7aJmgzldKr42R2nyJmqy6ZwtLQ2Auhz4wD6wezbQnMM\", \"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": "7aJmgzldKr42R2nyJmqy6ZwtLQ2Auhz4wD6wezbQnMM", + "sql": "SELECT ROUND(\n 1.0 * f.\"FRPM Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0),\n 6\n) AS eligible_meal_rate\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE s.SOC = '66'\nORDER BY f.\"FRPM Count (K-12)\" DESC, s.CDSCode\nLIMIT 5;" + }, + "result": { + "content": [ + { + "type": "text", + "text": "5 row(s):\nObserved value types (displayed rows): eligible_meal_rate=float\neligible_meal_rate\n---\n0.917948\n0.999329\n0.896499\n0.89582\n0.91418\nSQL: SELECT ROUND(\n 1.0 * f.\"FRPM Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0),\n 6\n) AS eligible_meal_rate\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE s.SOC = '66'\nORDER BY f.\"FRPM Count (K-12)\" DESC, s.CDSCode\nLIMIT 5;" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "```sql\nSELECT ROUND(\n 1.0 * f.\"FRPM Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0),\n 6\n) AS eligible_meal_rate\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE s.SOC = '66'\nORDER BY f.\"FRPM Count (K-12)\" DESC, s.CDSCode\nLIMIT 5;\n```", + "rows": 5, + "sql": "SELECT ROUND(\n 1.0 * f.\"FRPM Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0),\n 6\n) AS eligible_meal_rate\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE s.SOC = '66'\nORDER BY f.\"FRPM Count (K-12)\" DESC, s.CDSCode\nLIMIT 5;", + "seconds": 32.778590374975465 +} diff --git a/bench/accuracy/mcp-review-results/rate-projection-30f20bd/scores.json b/bench/accuracy/mcp-review-results/rate-projection-30f20bd/scores.json new file mode 100644 index 00000000..15c65c32 --- /dev/null +++ b/bench/accuracy/mcp-review-results/rate-projection-30f20bd/scores.json @@ -0,0 +1,12 @@ +[ + { + "instance_id": "bird000", + "score": 1, + "status": "predicted" + }, + { + "instance_id": "bird002", + "score": 1, + "status": "predicted" + } +] diff --git a/bench/accuracy/mcp-review-results/rate-projection-30f20bd/settings.json b/bench/accuracy/mcp-review-results/rate-projection-30f20bd/settings.json new file mode 100644 index 00000000..a7eca0e0 --- /dev/null +++ b/bench/accuracy/mcp-review-results/rate-projection-30f20bd/settings.json @@ -0,0 +1,26 @@ +{ + "profiles": [ + { + "name": "codex-mcp", + "model": "gpt-6.2-sol", + "reasoning_effort": "high" + } + ], + "backend": "ChatGPT login -> Codex CLI -> production Lang2SQL MCP", + "revision": "30f20bd4e9e9a14c95535744f9bb24ee7fb5b2e8", + "codex_version": "codex-cli 0.170.0", + "sources": { + "bench/accuracy/codex_mcp.py": "6d8700253cf9a0dfc00c645199a3769c476bfee36d28f1b79e0b494c51fa14de", + "src/lang2sql/frontends/mcp/server.py": "0836ca4631f321c3f3a2c7524e71f6f31e60ac77286633833af6810d3443ddcb" + }, + "schema_document_sha256": "5176e324a72e80a8a37a12285596d123e0ba6c310dceaa9f13a1e413ee88ff5b", + "review_source": null, + "failure_selection": null, + "split": "development", + "concurrency": 2, + "case_timeout": 600, + "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/rate-projection-30f20bd/source-record-hashes.json b/bench/accuracy/mcp-review-results/rate-projection-30f20bd/source-record-hashes.json new file mode 100644 index 00000000..2d9a43ae --- /dev/null +++ b/bench/accuracy/mcp-review-results/rate-projection-30f20bd/source-record-hashes.json @@ -0,0 +1,4 @@ +{ + "bird000.json": "5c5a914ab6ca93c48561a148e7bab73cab1bc51800cb9b3fb6d62eaa3abb3360", + "bird002.json": "310753f5878187222b8edff61144ec1b8cd57af73239520d0016630f13b57abc" +} diff --git a/bench/accuracy/mcp-review-results/rate-projection-30f20bd/summary.json b/bench/accuracy/mcp-review-results/rate-projection-30f20bd/summary.json new file mode 100644 index 00000000..8a2e75c5 --- /dev/null +++ b/bench/accuracy/mcp-review-results/rate-projection-30f20bd/summary.json @@ -0,0 +1,9 @@ +[ + { + "profile": "codex-mcp", + "correct": 2, + "total": 2, + "accuracy": 1.0, + "interpretation": "targeted repair on two prior failures, not full benchmark accuracy" + } +] diff --git a/src/lang2sql/harness/system_prompt.py b/src/lang2sql/harness/system_prompt.py index 51c7e8db..f4583ae2 100644 --- a/src/lang2sql/harness/system_prompt.py +++ b/src/lang2sql/harness/system_prompt.py @@ -23,7 +23,7 @@ - Answer concisely. Show only the final successful SQL you ran, not intermediate attempts. Query correctness: -- Before constructing SQL, identify the requested output columns, row grain, population, time boundaries, and aggregation. Return only requested columns, not diagnostic identifiers or intermediate statistics. +- Before constructing SQL, identify the requested output columns, row grain, population, time boundaries, and aggregation. Return only requested columns, not diagnostic identifiers or intermediate statistics. When the requested output is only a measure for qualifying entities, do not add entity names or identifiers merely for readability; selecting entities is not itself a request to project their labels. Retain identifying fields when the user asks for the entities themselves or a detailed list. - Inspect all relevant tables and join keys. Check relationship direction and join multiplicity; do not replace a declared business identifier with a database's implicit row identifier. - Do not add unstated filters, exclude zero-valued records, or fill missing values unless the question or supplied definitions require it. Check whether ties and empty groups must be retained. - Preserve result types: a request for decimal places means numeric ROUND, not printf/text formatting. Inspect observed result value types before finalizing; round numeric results numerically; format numbers as text only when explicitly requested. Before returning, check that the executed result matches the requested output contract. @@ -33,7 +33,7 @@ - A successful query is not proof of correctness. Compare the final SQL against every requested output, filter, denominator, grouping and ordering requirement before answering. - When several columns or tables describe a similar concept, inspect each candidate and prefer the explicitly named field/source. Do not silently substitute a convenient near-synonym. - Profile relevant stored values with small read-only queries before deciding numeric casts, date formats or missing-value handling. SQL NULL, empty strings, sentinel values and genuine zero are different; use documented meanings and observed values, not invented cleaning rules. -- For rates, check numerator and denominator at the requested grain and precision instead of assuming a stored rounded percentage is interchangeable. Preserve requested identifiers and categorical strings verbatim; do not prettify their case or change types. +- For a requested rate or share, calculate it from the matching underlying numerator and denominator when available, with explicit non-integer division and appropriate zero-denominator handling. Use a precomputed rate instead only when the request or supplied definition specifically selects that stored measure. Stored percentages can differ from the requested calculation even when their displayed values look identical; round only at the requested stage and precision. Preserve requested identifiers and categorical strings verbatim; do not prettify their case or change types. - Before running a correlated subquery over large tables, inspect join-key indexes or use a preaggregated/set-based join to avoid repeated full scans. - Check the effect of every join on row counts. Do not invent DISTINCT, extra legal/status restrictions, zero-filled groups, or implicit deduplication when the question does not request them. - For multi-stage analysis, keep a compact query contract: source and evidence for each measure, eligible population, one-row grain at each stage, requested final columns, and precision. Verify the final SELECT against this contract after executing it.