diff --git a/bench/accuracy/mcp-review-results/integer-ratio-difference/analysis.json b/bench/accuracy/mcp-review-results/integer-ratio-difference/analysis.json new file mode 100644 index 00000000..10014324 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-difference/analysis.json @@ -0,0 +1,7 @@ +{ + "correct": 0, + "total": 1, + "compiler_calls": 0, + "finding": "Model still collapses two percentage components into a single ratio of count differences. Correct compiler availability alone did not change the decision.", + "next_step": "Only after deterministic compiler/property/stdio verification, add a short generic existing numeric-rule extension for tool adoption and independently requested components; do not inject benchmark values or reference SQL." +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/csv/bird120.csv b/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/csv/bird120.csv new file mode 100644 index 00000000..0c3db744 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/csv/bird120.csv @@ -0,0 +1,2 @@ +percentage_point_difference +-9.544015626052401 diff --git a/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/events/bird120.answer.txt b/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/events/bird120.answer.txt new file mode 100644 index 00000000..74d4a07a --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/events/bird120.answer.txt @@ -0,0 +1,10 @@ +```sql +SELECT + 100.0 * ( + COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010') + - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011') + ) / NULLIF(COUNT(*), 0) AS percentage_point_difference +FROM main.badges AS b +WHERE b.Name = 'Student' +LIMIT 1 +``` \ No newline at end of file diff --git a/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/events/bird120.jsonl b/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/events/bird120.jsonl new file mode 100644 index 00000000..97e7a791 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/events/bird120.jsonl @@ -0,0 +1,15 @@ +{"type":"thread.started","thread_id":"01a21a44-6c8a-72c1-bc5a-0245a211a0ff"} +{"type":"turn.started"} +{"type":"item.completed","item":{"id":"item_0","type":"agent_message","text":"I’ll verify how badge awards are recorded, then run the calculation using all Student badges as the denominator."}} +{"type":"item.started","item":{"id":"item_1","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_1","type":"mcp_tool_call","server":"lang2sql","tool":"resolve_business_terms","arguments":{"terms":[]},"result":{"content":[{"type":"text","text":"{\"definition_check_id\": \"CkA9cROjGM3PdCTsL8FH_fWN9zvze8_ksmnK9vHJEKk\", \"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_2","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"badges"},"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":"badges"},"result":{"content":[{"type":"text","text":"badges (table)\n- Id: INTEGER NOT NULL\n- UserId: INTEGER\n- Name: TEXT\n- Date: DATETIME\nPRIMARY KEY (Id)\nFOREIGN KEY (UserId) REFERENCES users (Id)"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.started","item":{"id":"item_3","type":"mcp_tool_call","server":"lang2sql","tool":"run_sql","arguments":{"definition_check_id":"CkA9cROjGM3PdCTsL8FH_fWN9zvze8_ksmnK9vHJEKk","sql":"SELECT strftime('%Y', b.Date) AS award_year, COUNT(*) AS awards FROM main.badges AS b WHERE b.Name = 'Student' GROUP BY award_year ORDER BY award_year;"},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_3","type":"mcp_tool_call","server":"lang2sql","tool":"run_sql","arguments":{"definition_check_id":"CkA9cROjGM3PdCTsL8FH_fWN9zvze8_ksmnK9vHJEKk","sql":"SELECT strftime('%Y', b.Date) AS award_year, COUNT(*) AS awards FROM main.badges AS b WHERE b.Name = 'Student' GROUP BY award_year ORDER BY award_year;"},"result":{"content":[{"type":"text","text":"5 row(s):\nResult coverage: fetched_rows=5; displayed_rows=5; 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): award_year=str; awards=int\naward_year | awards\n--- | ---\n2010 | 542\n2011 | 1959\n2012 | 3349\n2013 | 4725\n2014 | 4272\nSQL: SELECT strftime('%Y', b.Date) AS award_year, COUNT(*) AS awards FROM main.badges AS b WHERE b.Name = 'Student' GROUP BY award_year ORDER BY award_year\nLIMIT 1000"}],"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\": \"bHlHZ1kmioYc4wpo9EP5JTyMIflEQwBvb0PoPiOu6DU\", \"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":"run_sql","arguments":{"definition_check_id":"bHlHZ1kmioYc4wpo9EP5JTyMIflEQwBvb0PoPiOu6DU","expected_rows":1,"expected_columns":["percentage_point_difference"],"sql":"SELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\nLIMIT 1"},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_5","type":"mcp_tool_call","server":"lang2sql","tool":"run_sql","arguments":{"definition_check_id":"bHlHZ1kmioYc4wpo9EP5JTyMIflEQwBvb0PoPiOu6DU","expected_rows":1,"expected_columns":["percentage_point_difference"],"sql":"SELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\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): percentage_point_difference=float\npercentage_point_difference\n---\n-9.544015626052401\nSQL: SELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\nLIMIT 1"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.completed","item":{"id":"item_6","type":"agent_message","text":"```sql\nSELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\nLIMIT 1\n```"}} +{"type":"turn.completed","usage":{"input_tokens":197352,"cached_input_tokens":181504,"cache_write_input_tokens":0,"output_tokens":548,"reasoning_output_tokens":0}} diff --git a/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/events/bird120.prompt.txt b/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/events/bird120.prompt.txt new file mode 100644 index 00000000..379bc8d6 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/events/bird120.prompt.txt @@ -0,0 +1,637 @@ +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. +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? +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/integer-ratio-difference/codex-mcp/events/bird120.stderr b/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/events/bird120.stderr new file mode 100644 index 00000000..e69de29b diff --git a/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/records/bird120.json b/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/records/bird120.json new file mode 100644 index 00000000..483aa65d --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/records/bird120.json @@ -0,0 +1,132 @@ +{ + "instance_id": "bird120", + "profile": "codex-mcp", + "model": "gpt-6.2-astra", + "status": "predicted", + "calls": [], + "prompt_sha256": "3eac807cee3be25549744ef09937ebc66e994a5174998558002935c9c08fcc9e", + "events_sha256": "38ba1ea772a1238388f832ac7e67a9d0dbe4f8a5d93bb975007bca076e46023f", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 197352, + "cached_input_tokens": 181504, + "cache_write_input_tokens": 0, + "output_tokens": 548, + "reasoning_output_tokens": 0 + } + ], + "mcp_calls": [ + { + "id": "item_1", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"CkA9cROjGM3PdCTsL8FH_fWN9zvze8_ksmnK9vHJEKk\", \"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_2", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "badges" + }, + "result": { + "content": [ + { + "type": "text", + "text": "badges (table)\n- Id: INTEGER NOT NULL\n- UserId: INTEGER\n- Name: TEXT\n- Date: DATETIME\nPRIMARY KEY (Id)\nFOREIGN KEY (UserId) REFERENCES users (Id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_3", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "CkA9cROjGM3PdCTsL8FH_fWN9zvze8_ksmnK9vHJEKk", + "sql": "SELECT strftime('%Y', b.Date) AS award_year, COUNT(*) AS awards FROM main.badges AS b WHERE b.Name = 'Student' GROUP BY award_year ORDER BY award_year;" + }, + "result": { + "content": [ + { + "type": "text", + "text": "5 row(s):\nResult coverage: fetched_rows=5; displayed_rows=5; 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): award_year=str; awards=int\naward_year | awards\n--- | ---\n2010 | 542\n2011 | 1959\n2012 | 3349\n2013 | 4725\n2014 | 4272\nSQL: SELECT strftime('%Y', b.Date) AS award_year, COUNT(*) AS awards FROM main.badges AS b WHERE b.Name = 'Student' GROUP BY award_year ORDER BY award_year\nLIMIT 1000" + } + ], + "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\": \"bHlHZ1kmioYc4wpo9EP5JTyMIflEQwBvb0PoPiOu6DU\", \"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": "run_sql", + "arguments": { + "definition_check_id": "bHlHZ1kmioYc4wpo9EP5JTyMIflEQwBvb0PoPiOu6DU", + "expected_rows": 1, + "expected_columns": [ + "percentage_point_difference" + ], + "sql": "SELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\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): percentage_point_difference=float\npercentage_point_difference\n---\n-9.544015626052401\nSQL: SELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\nLIMIT 1" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "```sql\nSELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\nLIMIT 1\n```", + "event_parse_errors": [], + "rows": 1, + "sql": "SELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\nLIMIT 1", + "seconds": 29.758980208076537 +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/scores.json b/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/scores.json new file mode 100644 index 00000000..e1f47c17 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/scores.json @@ -0,0 +1,7 @@ +[ + { + "instance_id": "bird120", + "score": 0, + "status": "predicted" + } +] diff --git a/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/sql/bird120.sql b/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/sql/bird120.sql new file mode 100644 index 00000000..a09be8ea --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/sql/bird120.sql @@ -0,0 +1,8 @@ +SELECT + 100.0 * ( + COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010') + - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011') + ) / NULLIF(COUNT(*), 0) AS percentage_point_difference +FROM main.badges AS b +WHERE b.Name = 'Student' +LIMIT 1 diff --git a/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/status.json b/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/status.json new file mode 100644 index 00000000..f60a5664 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-difference/codex-mcp/status.json @@ -0,0 +1,4 @@ +{ + "status": "completed", + "wall_seconds": 29.759638749994338 +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio-difference/comparison/comparison.json b/bench/accuracy/mcp-review-results/integer-ratio-difference/comparison/comparison.json new file mode 100644 index 00000000..2506d08d --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-difference/comparison/comparison.json @@ -0,0 +1,386 @@ +{ + "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-official-values-remaining-all-20261127/bird-gpt-6.2-astra", + "manifest_sha256": "f0bd64b123eb987d1efb9ac8220e68e1e49bfce4908aa154de622363ee5bb685", + "scores_sha256": "846dfce87e4644b41c58d013750fefc81fd1241d79bd37082007d9127e795b54", + "settings": { + "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": "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" + } + }, + { + "path": "/Users/seyoung/workspace/benchmarks/codex-mcp-integer-ratio-difference-20261127/bird-gpt-6.2-astra", + "manifest_sha256": "5e74edce4f2406a1d4eb322534d59c2f86803baf4ca17c276c7701c59caec3ee", + "scores_sha256": "241169494771f226b3f648f24dd4a13381fb47b06d5c89e6a2149cbb5808a684", + "settings": { + "profiles": [ + { + "name": "codex-mcp", + "model": "gpt-6.2-astra", + "reasoning_effort": "high" + } + ], + "backend": "ChatGPT login -> Codex CLI -> production Lang2SQL MCP", + "revision": "b916e0de6736d94c54c5900c0b5c6b5191c3b4d0", + "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": 1, + "selected_cases": 1, + "expected_cases": 1 + }, + "review_source": null, + "failure_selection": null, + "split": "all", + "concurrency": 1, + "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 + }, + "cases": [ + { + "input": { + "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": "" + }, + "transition": "0 -> 0", + "sql_diff": "--- before.sql\n+++ after.sql\n@@ -1,8 +1,8 @@\n SELECT\n 100.0 * (\n- COUNT(*) FILTER (WHERE Date >= '2010-01-01' AND Date < '2011-01-01')\n- - COUNT(*) FILTER (WHERE Date >= '2011-01-01' AND Date < '2012-01-01')\n+ COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n+ - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\n-FROM main.badges\n-WHERE Name = 'Student'\n+FROM main.badges AS b\n+WHERE b.Name = 'Student'\n LIMIT 1", + "before": { + "score": 0, + "record_sha256": "35da72e9b86ed359871eb9ebb7bdc39a621436f4f68a65056246fbe775d2d250", + "record": { + "instance_id": "bird120", + "profile": "codex-mcp", + "model": "gpt-6.2-astra", + "status": "predicted", + "calls": [], + "prompt_sha256": "3eac807cee3be25549744ef09937ebc66e994a5174998558002935c9c08fcc9e", + "events_sha256": "b09dc4c132e555d4b8fd66ad956dcc71e05d2338e3381852c44c7222a642d1f7", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 197440, + "cached_input_tokens": 181632, + "cache_write_input_tokens": 0, + "output_tokens": 552, + "reasoning_output_tokens": 0 + } + ], + "mcp_calls": [ + { + "id": "item_1", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"bJlCH71ya06dNwXryge9oN9QAF6YrtU5o7FOi5yNdUE\", \"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_2", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "badges" + }, + "result": { + "content": [ + { + "type": "text", + "text": "badges (table)\n- Id: INTEGER NOT NULL\n- UserId: INTEGER\n- Name: TEXT\n- Date: DATETIME\nPRIMARY KEY (Id)\nFOREIGN KEY (UserId) REFERENCES users (Id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_3", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "bJlCH71ya06dNwXryge9oN9QAF6YrtU5o7FOi5yNdUE", + "sql": "SELECT COUNT(*) AS awards, MIN(Date) AS first_award, MAX(Date) AS last_award FROM main.badges WHERE Name = 'Student'" + }, + "result": { + "content": [ + { + "type": "text", + "text": "1 row(s):\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): awards=int; first_award=str; last_award=str\nawards | first_award | last_award\n--- | --- | ---\n14847 | 2010-07-19 19:39:07.0 | 2014-09-14 01:41:18.0\nSQL: SELECT COUNT(*) AS awards, MIN(Date) AS first_award, MAX(Date) AS last_award FROM main.badges WHERE Name = 'Student'\nLIMIT 1000" + } + ], + "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\": \"EJ5kqpHumxbdkzNGU_6mSLqDIBEU1nTXMJiPeJcZ2Dg\", \"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": "run_sql", + "arguments": { + "definition_check_id": "EJ5kqpHumxbdkzNGU_6mSLqDIBEU1nTXMJiPeJcZ2Dg", + "expected_rows": 1, + "expected_columns": [ + "percentage_point_difference" + ], + "sql": "SELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE Date >= '2010-01-01' AND Date < '2011-01-01')\n - COUNT(*) FILTER (WHERE Date >= '2011-01-01' AND Date < '2012-01-01')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges\nWHERE Name = 'Student'\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): percentage_point_difference=float\npercentage_point_difference\n---\n-9.544015626052401\nSQL: SELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE Date >= '2010-01-01' AND Date < '2011-01-01')\n - COUNT(*) FILTER (WHERE Date >= '2011-01-01' AND Date < '2012-01-01')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges\nWHERE Name = 'Student'\nLIMIT 1" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "```sql\nSELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE Date >= '2010-01-01' AND Date < '2011-01-01')\n - COUNT(*) FILTER (WHERE Date >= '2011-01-01' AND Date < '2012-01-01')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges\nWHERE Name = 'Student'\nLIMIT 1\n```", + "event_parse_errors": [], + "rows": 1, + "sql": "SELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE Date >= '2010-01-01' AND Date < '2011-01-01')\n - COUNT(*) FILTER (WHERE Date >= '2011-01-01' AND Date < '2012-01-01')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges\nWHERE Name = 'Student'\nLIMIT 1", + "seconds": 25.761872791917995 + }, + "result": { + "columns": [ + "percentage_point_difference" + ], + "row_count": 1, + "preview": [ + [ + "-9.544015626052401" + ] + ], + "preview_truncated": false, + "csv_sha256": "84686ba4e41daaa34c9072e6b923f195e2bbd51233d031bea66045c08aa0b411" + } + }, + "after": { + "score": 0, + "record_sha256": "a34b24d84744431ea4ccaf3eab4684cb8d2933d24490a719eff483c74d5aa761", + "record": { + "instance_id": "bird120", + "profile": "codex-mcp", + "model": "gpt-6.2-astra", + "status": "predicted", + "calls": [], + "prompt_sha256": "3eac807cee3be25549744ef09937ebc66e994a5174998558002935c9c08fcc9e", + "events_sha256": "38ba1ea772a1238388f832ac7e67a9d0dbe4f8a5d93bb975007bca076e46023f", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 197352, + "cached_input_tokens": 181504, + "cache_write_input_tokens": 0, + "output_tokens": 548, + "reasoning_output_tokens": 0 + } + ], + "mcp_calls": [ + { + "id": "item_1", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"CkA9cROjGM3PdCTsL8FH_fWN9zvze8_ksmnK9vHJEKk\", \"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_2", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "badges" + }, + "result": { + "content": [ + { + "type": "text", + "text": "badges (table)\n- Id: INTEGER NOT NULL\n- UserId: INTEGER\n- Name: TEXT\n- Date: DATETIME\nPRIMARY KEY (Id)\nFOREIGN KEY (UserId) REFERENCES users (Id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_3", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "CkA9cROjGM3PdCTsL8FH_fWN9zvze8_ksmnK9vHJEKk", + "sql": "SELECT strftime('%Y', b.Date) AS award_year, COUNT(*) AS awards FROM main.badges AS b WHERE b.Name = 'Student' GROUP BY award_year ORDER BY award_year;" + }, + "result": { + "content": [ + { + "type": "text", + "text": "5 row(s):\nResult coverage: fetched_rows=5; displayed_rows=5; 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): award_year=str; awards=int\naward_year | awards\n--- | ---\n2010 | 542\n2011 | 1959\n2012 | 3349\n2013 | 4725\n2014 | 4272\nSQL: SELECT strftime('%Y', b.Date) AS award_year, COUNT(*) AS awards FROM main.badges AS b WHERE b.Name = 'Student' GROUP BY award_year ORDER BY award_year\nLIMIT 1000" + } + ], + "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\": \"bHlHZ1kmioYc4wpo9EP5JTyMIflEQwBvb0PoPiOu6DU\", \"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": "run_sql", + "arguments": { + "definition_check_id": "bHlHZ1kmioYc4wpo9EP5JTyMIflEQwBvb0PoPiOu6DU", + "expected_rows": 1, + "expected_columns": [ + "percentage_point_difference" + ], + "sql": "SELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\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): percentage_point_difference=float\npercentage_point_difference\n---\n-9.544015626052401\nSQL: SELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\nLIMIT 1" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "```sql\nSELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\nLIMIT 1\n```", + "event_parse_errors": [], + "rows": 1, + "sql": "SELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\nLIMIT 1", + "seconds": 29.758980208076537 + }, + "result": { + "columns": [ + "percentage_point_difference" + ], + "row_count": 1, + "preview": [ + [ + "-9.544015626052401" + ] + ], + "preview_truncated": false, + "csv_sha256": "84686ba4e41daaa34c9072e6b923f195e2bbd51233d031bea66045c08aa0b411" + } + } + } + ] +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio-difference/comparison/index.html b/bench/accuracy/mcp-review-results/integer-ratio-difference/comparison/index.html new file mode 100644 index 00000000..dfe141a9 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-difference/comparison/index.html @@ -0,0 +1,353 @@ +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
+}
Provenance and settings
[
+  {
+    "path": "/Users/seyoung/workspace/benchmarks/codex-mcp-official-values-remaining-all-20261127/bird-gpt-6.2-astra",
+    "manifest_sha256": "f0bd64b123eb987d1efb9ac8220e68e1e49bfce4908aa154de622363ee5bb685",
+    "scores_sha256": "846dfce87e4644b41c58d013750fefc81fd1241d79bd37082007d9127e795b54",
+    "settings": {
+      "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": "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"
+    }
+  },
+  {
+    "path": "/Users/seyoung/workspace/benchmarks/codex-mcp-integer-ratio-difference-20261127/bird-gpt-6.2-astra",
+    "manifest_sha256": "5e74edce4f2406a1d4eb322534d59c2f86803baf4ca17c276c7701c59caec3ee",
+    "scores_sha256": "241169494771f226b3f648f24dd4a13381fb47b06d5c89e6a2149cbb5808a684",
+    "settings": {
+      "profiles": [
+        {
+          "name": "codex-mcp",
+          "model": "gpt-6.2-astra",
+          "reasoning_effort": "high"
+        }
+      ],
+      "backend": "ChatGPT login -> Codex CLI -> production Lang2SQL MCP",
+      "revision": "b916e0de6736d94c54c5900c0b5c6b5191c3b4d0",
+      "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": 1,
+        "selected_cases": 1,
+        "expected_cases": 1
+      },
+      "review_source": null,
+      "failure_selection": null,
+      "split": "all",
+      "concurrency": 1,
+      "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"
+    }
+  }
+]
bird120: 0 -> 0
{
+  "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": ""
+}

SQL diff

--- before.sql
++++ after.sql
+@@ -1,8 +1,8 @@
+ SELECT
+     100.0 * (
+-        COUNT(*) FILTER (WHERE Date >= '2010-01-01' AND Date < '2011-01-01')
+-        - COUNT(*) FILTER (WHERE Date >= '2011-01-01' AND Date < '2012-01-01')
++        COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')
++        - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')
+     ) / NULLIF(COUNT(*), 0) AS percentage_point_difference
+-FROM main.badges
+-WHERE Name = 'Student'
++FROM main.badges AS b
++WHERE b.Name = 'Student'
+ LIMIT 1

before: score 0

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

Final SQL / answer

SELECT
+    100.0 * (
+        COUNT(*) FILTER (WHERE Date >= '2010-01-01' AND Date < '2011-01-01')
+        - COUNT(*) FILTER (WHERE Date >= '2011-01-01' AND Date < '2012-01-01')
+    ) / NULLIF(COUNT(*), 0) AS percentage_point_difference
+FROM main.badges
+WHERE Name = 'Student'
+LIMIT 1

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

{
+  "columns": [
+    "percentage_point_difference"
+  ],
+  "row_count": 1,
+  "preview": [
+    [
+      "-9.544015626052401"
+    ]
+  ],
+  "preview_truncated": false,
+  "csv_sha256": "84686ba4e41daaa34c9072e6b923f195e2bbd51233d031bea66045c08aa0b411"
+}
Every MCP call: arguments and results
[
+  {
+    "id": "item_1",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "resolve_business_terms",
+    "arguments": {
+      "terms": []
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "{\"definition_check_id\": \"bJlCH71ya06dNwXryge9oN9QAF6YrtU5o7FOi5yNdUE\", \"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_2",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "explore_schema",
+    "arguments": {
+      "table": "badges"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "badges (table)\n- Id: INTEGER NOT NULL\n- UserId: INTEGER\n- Name: TEXT\n- Date: DATETIME\nPRIMARY KEY (Id)\nFOREIGN KEY (UserId) REFERENCES users (Id)"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_3",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "run_sql",
+    "arguments": {
+      "definition_check_id": "bJlCH71ya06dNwXryge9oN9QAF6YrtU5o7FOi5yNdUE",
+      "sql": "SELECT COUNT(*) AS awards, MIN(Date) AS first_award, MAX(Date) AS last_award FROM main.badges WHERE Name = 'Student'"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "1 row(s):\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): awards=int; first_award=str; last_award=str\nawards | first_award | last_award\n--- | --- | ---\n14847 | 2010-07-19 19:39:07.0 | 2014-09-14 01:41:18.0\nSQL: SELECT COUNT(*) AS awards, MIN(Date) AS first_award, MAX(Date) AS last_award FROM main.badges WHERE Name = 'Student'\nLIMIT 1000"
+        }
+      ],
+      "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\": \"EJ5kqpHumxbdkzNGU_6mSLqDIBEU1nTXMJiPeJcZ2Dg\", \"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": "run_sql",
+    "arguments": {
+      "definition_check_id": "EJ5kqpHumxbdkzNGU_6mSLqDIBEU1nTXMJiPeJcZ2Dg",
+      "expected_rows": 1,
+      "expected_columns": [
+        "percentage_point_difference"
+      ],
+      "sql": "SELECT\n    100.0 * (\n        COUNT(*) FILTER (WHERE Date >= '2010-01-01' AND Date < '2011-01-01')\n        - COUNT(*) FILTER (WHERE Date >= '2011-01-01' AND Date < '2012-01-01')\n    ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges\nWHERE Name = 'Student'\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): percentage_point_difference=float\npercentage_point_difference\n---\n-9.544015626052401\nSQL: SELECT\n    100.0 * (\n        COUNT(*) FILTER (WHERE Date >= '2010-01-01' AND Date < '2011-01-01')\n        - COUNT(*) FILTER (WHERE Date >= '2011-01-01' AND Date < '2012-01-01')\n    ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges\nWHERE Name = 'Student'\nLIMIT 1"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  }
+]

after: score 0

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

Final SQL / answer

SELECT
+    100.0 * (
+        COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')
+        - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')
+    ) / NULLIF(COUNT(*), 0) AS percentage_point_difference
+FROM main.badges AS b
+WHERE b.Name = 'Student'
+LIMIT 1

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

{
+  "columns": [
+    "percentage_point_difference"
+  ],
+  "row_count": 1,
+  "preview": [
+    [
+      "-9.544015626052401"
+    ]
+  ],
+  "preview_truncated": false,
+  "csv_sha256": "84686ba4e41daaa34c9072e6b923f195e2bbd51233d031bea66045c08aa0b411"
+}
Every MCP call: arguments and results
[
+  {
+    "id": "item_1",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "resolve_business_terms",
+    "arguments": {
+      "terms": []
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "{\"definition_check_id\": \"CkA9cROjGM3PdCTsL8FH_fWN9zvze8_ksmnK9vHJEKk\", \"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_2",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "explore_schema",
+    "arguments": {
+      "table": "badges"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "badges (table)\n- Id: INTEGER NOT NULL\n- UserId: INTEGER\n- Name: TEXT\n- Date: DATETIME\nPRIMARY KEY (Id)\nFOREIGN KEY (UserId) REFERENCES users (Id)"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_3",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "run_sql",
+    "arguments": {
+      "definition_check_id": "CkA9cROjGM3PdCTsL8FH_fWN9zvze8_ksmnK9vHJEKk",
+      "sql": "SELECT strftime('%Y', b.Date) AS award_year, COUNT(*) AS awards FROM main.badges AS b WHERE b.Name = 'Student' GROUP BY award_year ORDER BY award_year;"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "5 row(s):\nResult coverage: fetched_rows=5; displayed_rows=5; 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): award_year=str; awards=int\naward_year | awards\n--- | ---\n2010 | 542\n2011 | 1959\n2012 | 3349\n2013 | 4725\n2014 | 4272\nSQL: SELECT strftime('%Y', b.Date) AS award_year, COUNT(*) AS awards FROM main.badges AS b WHERE b.Name = 'Student' GROUP BY award_year ORDER BY award_year\nLIMIT 1000"
+        }
+      ],
+      "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\": \"bHlHZ1kmioYc4wpo9EP5JTyMIflEQwBvb0PoPiOu6DU\", \"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": "run_sql",
+    "arguments": {
+      "definition_check_id": "bHlHZ1kmioYc4wpo9EP5JTyMIflEQwBvb0PoPiOu6DU",
+      "expected_rows": 1,
+      "expected_columns": [
+        "percentage_point_difference"
+      ],
+      "sql": "SELECT\n    100.0 * (\n        COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n        - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n    ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\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): percentage_point_difference=float\npercentage_point_difference\n---\n-9.544015626052401\nSQL: SELECT\n    100.0 * (\n        COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n        - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n    ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\nLIMIT 1"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  }
+]
\ No newline at end of file diff --git a/bench/accuracy/mcp-review-results/integer-ratio-difference/manifest.json b/bench/accuracy/mcp-review-results/integer-ratio-difference/manifest.json new file mode 100644 index 00000000..053da440 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-difference/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": "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": "" + } + ], + "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/integer-ratio-difference/protocol.json b/bench/accuracy/mcp-review-results/integer-ratio-difference/protocol.json new file mode 100644 index 00000000..2d99d8d2 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-difference/protocol.json @@ -0,0 +1,15 @@ +{ + "revision": "b916e0de6736d94c54c5900c0b5c6b5191c3b4d0", + "baseline": "/Users/seyoung/workspace/benchmarks/codex-mcp-official-values-remaining-all-20261127/bird-gpt-6.2-astra", + "ids": [ + "bird120" + ], + "model": "gpt-6.2-astra/high", + "expected_cases": 1, + "change": "Same integer_ratio_sql tool availability as previous pilot. A different still-failed ratio-composition case. No prompt change, feedback, source answer, grade, reference or analyst hint.", + "limits": [ + "Selected single failure, not full accuracy.", + "Check actual tool usage; success alone is not compiler attribution.", + "Do not repeat unchanged." + ] +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio-difference/settings.json b/bench/accuracy/mcp-review-results/integer-ratio-difference/settings.json new file mode 100644 index 00000000..a3e5a50f --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-difference/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": "b916e0de6736d94c54c5900c0b5c6b5191c3b4d0", + "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": 1, + "selected_cases": 1, + "expected_cases": 1 + }, + "review_source": null, + "failure_selection": null, + "split": "all", + "concurrency": 1, + "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/integer-ratio-difference/sha256.json b/bench/accuracy/mcp-review-results/integer-ratio-difference/sha256.json new file mode 100644 index 00000000..49bc67ae --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-difference/sha256.json @@ -0,0 +1,18 @@ +{ + "analysis.json": "8d93b8b57abe10725a792a5231c7f0339a64fd5ad2346449aa719c478903f1e2", + "codex-mcp/csv/bird120.csv": "84686ba4e41daaa34c9072e6b923f195e2bbd51233d031bea66045c08aa0b411", + "codex-mcp/events/bird120.answer.txt": "f461c7403015d1c1fa0700f64d4ad89e7596836680bacbbd7ab45d576bc5579c", + "codex-mcp/events/bird120.jsonl": "38ba1ea772a1238388f832ac7e67a9d0dbe4f8a5d93bb975007bca076e46023f", + "codex-mcp/events/bird120.prompt.txt": "3eac807cee3be25549744ef09937ebc66e994a5174998558002935c9c08fcc9e", + "codex-mcp/events/bird120.stderr": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "codex-mcp/records/bird120.json": "a34b24d84744431ea4ccaf3eab4684cb8d2933d24490a719eff483c74d5aa761", + "codex-mcp/scores.json": "241169494771f226b3f648f24dd4a13381fb47b06d5c89e6a2149cbb5808a684", + "codex-mcp/sql/bird120.sql": "a336bfaab4893570c42d07dac3ce3399b480371e56d3865b3c0d4c3e2949c2af", + "codex-mcp/status.json": "a2fd3b44d2635079fed757eed225b56a75b7751a64e0b54a75623d77576486b2", + "comparison/comparison.json": "4b681977d98284d72ae0a02ac43e41a4b2a5a9fd86e93b4ce12b2b076605a722", + "comparison/index.html": "11e5697c0302a7a42e577b664a88f47459a9d63942a7fa0998e63483bfdab186", + "manifest.json": "5e74edce4f2406a1d4eb322534d59c2f86803baf4ca17c276c7701c59caec3ee", + "protocol.json": "ffc150e4a67487f84db48c10711272061b9924d3989752ef4782766cf3a9c5e1", + "settings.json": "83c2360b95d2eb2809ec4b6a63e4930b80402563859deddf6ae1c13e187af5b9", + "summary.json": "8f3fcdc8d7ea6392ccdeb7e607ede75cb9f00743b9684fbfb5d23fb5f6863318" +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio-difference/summary.json b/bench/accuracy/mcp-review-results/integer-ratio-difference/summary.json new file mode 100644 index 00000000..b787263e --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-difference/summary.json @@ -0,0 +1,8 @@ +[ + { + "profile": "codex-mcp", + "correct": 0, + "total": 1, + "accuracy": 0.0 + } +] diff --git a/bench/accuracy/mcp-review-results/integer-ratio-guidance/analysis.json b/bench/accuracy/mcp-review-results/integer-ratio-guidance/analysis.json new file mode 100644 index 00000000..42d13d1e --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-guidance/analysis.json @@ -0,0 +1,13 @@ +{ + "correct": 1, + "total": 1, + "compiler_calls": 1, + "compiled_ctes_present_verbatim_in_final_sql": true, + "finding": "Separately computes2010and2011 percentages with guarded integer scaling, then subtracts their REAL outputs. Official0->1 after a tool-only0/1 run.", + "input": "Same original task bytes; one generic existing numeric-instruction extension after compiler validation. No prior answer or feedback supplied.", + "limits": [ + "One selected case; not full accuracy or repeatability.", + "Tool adoption and stage preservation both changed; no isolated attribution between them.", + "Previously passed cases not rerun during development; broad regression assessment remains outstanding." + ] +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/csv/bird120.csv b/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/csv/bird120.csv new file mode 100644 index 00000000..08611176 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/csv/bird120.csv @@ -0,0 +1,2 @@ +difference_percentage_points +-9.544015626052403 diff --git a/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/events/bird120.answer.txt b/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/events/bird120.answer.txt new file mode 100644 index 00000000..659e6a3f --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/events/bird120.answer.txt @@ -0,0 +1,37 @@ +```sql +WITH badge_counts AS ( + SELECT + COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010, + COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011, + COUNT(*) AS total + FROM main.badges AS b + WHERE b.Name = 'Student' +), ratio_input(group_id, numerator, denominator) AS ( + SELECT 2010, count_2010, total FROM badge_counts + UNION ALL + SELECT 2011, count_2011, total FROM badge_counts +), ratio_checked AS ( + SELECT group_id, numerator, denominator, + CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input' + WHEN typeof(numerator) NOT IN ('integer', 'real') + OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input' + WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409 + OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow' + WHEN numerator <> CAST(numerator AS INTEGER) + OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input' + WHEN denominator = 0 THEN 'zero_denominator' + ELSE 'ok' END AS status + FROM ratio_input +), ratio_result AS ( + SELECT group_id, numerator, denominator, status, + CASE WHEN status = 'ok' THEN + (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER) + END AS ratio_value + FROM ratio_checked +) +SELECT + MAX(CASE WHEN group_id = 2010 THEN ratio_value END) + - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points +FROM ratio_result +LIMIT 1 +``` \ No newline at end of file diff --git a/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/events/bird120.jsonl b/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/events/bird120.jsonl new file mode 100644 index 00000000..58d01ce8 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/events/bird120.jsonl @@ -0,0 +1,17 @@ +{"type":"thread.started","thread_id":"01a21a46-a9af-7e00-ba7b-ba96f5d642db"} +{"type":"turn.started"} +{"type":"item.completed","item":{"id":"item_0","type":"agent_message","text":"I’ll check the badge schema and share definition in Lang2SQL, then run the query and verify the result."}} +{"type":"item.started","item":{"id":"item_1","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_1","type":"mcp_tool_call","server":"lang2sql","tool":"resolve_business_terms","arguments":{"terms":[]},"result":{"content":[{"type":"text","text":"{\"definition_check_id\": \"pGO-tgaqrUkmG2xB23Syy-LBoGXnwoI46TTRtejqWuI\", \"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_2","type":"mcp_tool_call","server":"lang2sql","tool":"integer_ratio_sql","arguments":{"dialect":"sqlite","multiplier":100},"result":null,"error":null,"status":"in_progress"}} +{"type":"item.completed","item":{"id":"item_2","type":"mcp_tool_call","server":"lang2sql","tool":"integer_ratio_sql","arguments":{"dialect":"sqlite","multiplier":100},"result":{"content":[{"type":"text","text":"SQLite only. Supply WITH ratio_input AS (your SELECT exposing group_id, numerator, denominator), append these CTEs, and SELECT from ratio_result. Reserve ratio_* names. One output row per input row, including failures; no grouping, filtering or deduplication. Only exact integer quantities are supported, including REAL values that already equal integers. Do not round or cast away fractional source data to satisfy this contract. Inspect status: null_input, invalid_input, overflow and zero_denominator retain their row with NULL ratio_value. For ok rows, integer scaling is exact within the shared binary64 exact-integer bound; only the final division rounds to REAL. This is not an exact decimal representation or a decimal-place rounding policy. Use the requested numerator, denominator and units; this tool cannot validate those choices.\n\nratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)"}],"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":"badges"},"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":"badges"},"result":{"content":[{"type":"text","text":"badges (table)\n- Id: INTEGER NOT NULL\n- UserId: INTEGER\n- Name: TEXT\n- Date: DATETIME\nPRIMARY KEY (Id)\nFOREIGN KEY (UserId) REFERENCES users (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":"pGO-tgaqrUkmG2xB23Syy-LBoGXnwoI46TTRtejqWuI","sql":"WITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT * FROM ratio_result"},"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":"pGO-tgaqrUkmG2xB23Syy-LBoGXnwoI46TTRtejqWuI","sql":"WITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT * FROM ratio_result"},"result":{"content":[{"type":"text","text":"2 row(s):\nResult coverage: fetched_rows=2; displayed_rows=2; 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): group_id=int; numerator=int; denominator=int; status=str; ratio_value=float\ngroup_id | numerator | denominator | status | ratio_value\n--- | --- | --- | --- | ---\n2010 | 542 | 14847 | ok | 3.6505691385465076\n2011 | 1959 | 14847 | ok | 13.19458476459891\nSQL: WITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT * FROM ratio_result\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\": \"2f0Df26qCrIurvyCMQpe1nBRBLicnBf_rFuxl_cttSU\", \"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":"2f0Df26qCrIurvyCMQpe1nBRBLicnBf_rFuxl_cttSU","expected_rows":1,"expected_columns":["difference_percentage_points"],"sql":"WITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT\n MAX(CASE WHEN group_id = 2010 THEN ratio_value END)\n - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points\nFROM ratio_result\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":"2f0Df26qCrIurvyCMQpe1nBRBLicnBf_rFuxl_cttSU","expected_rows":1,"expected_columns":["difference_percentage_points"],"sql":"WITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT\n MAX(CASE WHEN group_id = 2010 THEN ratio_value END)\n - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points\nFROM ratio_result\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): difference_percentage_points=float\ndifference_percentage_points\n---\n-9.544015626052403\nSQL: WITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT\n MAX(CASE WHEN group_id = 2010 THEN ratio_value END)\n - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points\nFROM ratio_result\nLIMIT 1"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.completed","item":{"id":"item_7","type":"agent_message","text":"```sql\nWITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT\n MAX(CASE WHEN group_id = 2010 THEN ratio_value END)\n - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points\nFROM ratio_result\nLIMIT 1\n```"}} +{"type":"turn.completed","usage":{"input_tokens":201814,"cached_input_tokens":184832,"cache_write_input_tokens":0,"output_tokens":1199,"reasoning_output_tokens":0}} diff --git a/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/events/bird120.prompt.txt b/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/events/bird120.prompt.txt new file mode 100644 index 00000000..379bc8d6 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/events/bird120.prompt.txt @@ -0,0 +1,637 @@ +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. +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? +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/integer-ratio-guidance/codex-mcp/events/bird120.stderr b/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/events/bird120.stderr new file mode 100644 index 00000000..e69de29b diff --git a/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/records/bird120.json b/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/records/bird120.json new file mode 100644 index 00000000..cc76984b --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/records/bird120.json @@ -0,0 +1,153 @@ +{ + "instance_id": "bird120", + "profile": "codex-mcp", + "model": "gpt-6.2-astra", + "status": "predicted", + "calls": [], + "prompt_sha256": "3eac807cee3be25549744ef09937ebc66e994a5174998558002935c9c08fcc9e", + "events_sha256": "cb523d4478033f57c9caece399de3cc9448df8fb17aa55a5fae2376ce05748e5", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 201814, + "cached_input_tokens": 184832, + "cache_write_input_tokens": 0, + "output_tokens": 1199, + "reasoning_output_tokens": 0 + } + ], + "mcp_calls": [ + { + "id": "item_1", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"pGO-tgaqrUkmG2xB23Syy-LBoGXnwoI46TTRtejqWuI\", \"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_2", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "integer_ratio_sql", + "arguments": { + "dialect": "sqlite", + "multiplier": 100 + }, + "result": { + "content": [ + { + "type": "text", + "text": "SQLite only. Supply WITH ratio_input AS (your SELECT exposing group_id, numerator, denominator), append these CTEs, and SELECT from ratio_result. Reserve ratio_* names. One output row per input row, including failures; no grouping, filtering or deduplication. Only exact integer quantities are supported, including REAL values that already equal integers. Do not round or cast away fractional source data to satisfy this contract. Inspect status: null_input, invalid_input, overflow and zero_denominator retain their row with NULL ratio_value. For ok rows, integer scaling is exact within the shared binary64 exact-integer bound; only the final division rounds to REAL. This is not an exact decimal representation or a decimal-place rounding policy. Use the requested numerator, denominator and units; this tool cannot validate those choices.\n\nratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_3", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "badges" + }, + "result": { + "content": [ + { + "type": "text", + "text": "badges (table)\n- Id: INTEGER NOT NULL\n- UserId: INTEGER\n- Name: TEXT\n- Date: DATETIME\nPRIMARY KEY (Id)\nFOREIGN KEY (UserId) REFERENCES users (Id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_4", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "pGO-tgaqrUkmG2xB23Syy-LBoGXnwoI46TTRtejqWuI", + "sql": "WITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT * FROM ratio_result" + }, + "result": { + "content": [ + { + "type": "text", + "text": "2 row(s):\nResult coverage: fetched_rows=2; displayed_rows=2; 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): group_id=int; numerator=int; denominator=int; status=str; ratio_value=float\ngroup_id | numerator | denominator | status | ratio_value\n--- | --- | --- | --- | ---\n2010 | 542 | 14847 | ok | 3.6505691385465076\n2011 | 1959 | 14847 | ok | 13.19458476459891\nSQL: WITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT * FROM ratio_result\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\": \"2f0Df26qCrIurvyCMQpe1nBRBLicnBf_rFuxl_cttSU\", \"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": "2f0Df26qCrIurvyCMQpe1nBRBLicnBf_rFuxl_cttSU", + "expected_rows": 1, + "expected_columns": [ + "difference_percentage_points" + ], + "sql": "WITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT\n MAX(CASE WHEN group_id = 2010 THEN ratio_value END)\n - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points\nFROM ratio_result\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): difference_percentage_points=float\ndifference_percentage_points\n---\n-9.544015626052403\nSQL: WITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT\n MAX(CASE WHEN group_id = 2010 THEN ratio_value END)\n - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points\nFROM ratio_result\nLIMIT 1" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "```sql\nWITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT\n MAX(CASE WHEN group_id = 2010 THEN ratio_value END)\n - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points\nFROM ratio_result\nLIMIT 1\n```", + "event_parse_errors": [], + "rows": 1, + "sql": "WITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT\n MAX(CASE WHEN group_id = 2010 THEN ratio_value END)\n - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points\nFROM ratio_result\nLIMIT 1", + "seconds": 42.964088208042085 +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/scores.json b/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/scores.json new file mode 100644 index 00000000..43685857 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/scores.json @@ -0,0 +1,7 @@ +[ + { + "instance_id": "bird120", + "score": 1, + "status": "predicted" + } +] diff --git a/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/sql/bird120.sql b/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/sql/bird120.sql new file mode 100644 index 00000000..3396eebc --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/sql/bird120.sql @@ -0,0 +1,35 @@ +WITH badge_counts AS ( + SELECT + COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010, + COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011, + COUNT(*) AS total + FROM main.badges AS b + WHERE b.Name = 'Student' +), ratio_input(group_id, numerator, denominator) AS ( + SELECT 2010, count_2010, total FROM badge_counts + UNION ALL + SELECT 2011, count_2011, total FROM badge_counts +), ratio_checked AS ( + SELECT group_id, numerator, denominator, + CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input' + WHEN typeof(numerator) NOT IN ('integer', 'real') + OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input' + WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409 + OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow' + WHEN numerator <> CAST(numerator AS INTEGER) + OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input' + WHEN denominator = 0 THEN 'zero_denominator' + ELSE 'ok' END AS status + FROM ratio_input +), ratio_result AS ( + SELECT group_id, numerator, denominator, status, + CASE WHEN status = 'ok' THEN + (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER) + END AS ratio_value + FROM ratio_checked +) +SELECT + MAX(CASE WHEN group_id = 2010 THEN ratio_value END) + - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points +FROM ratio_result +LIMIT 1 diff --git a/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/status.json b/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/status.json new file mode 100644 index 00000000..e27b1661 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-guidance/codex-mcp/status.json @@ -0,0 +1,4 @@ +{ + "status": "completed", + "wall_seconds": 42.964820499997586 +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio-guidance/comparison/comparison.json b/bench/accuracy/mcp-review-results/integer-ratio-guidance/comparison/comparison.json new file mode 100644 index 00000000..f0286a69 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-guidance/comparison/comparison.json @@ -0,0 +1,413 @@ +{ + "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-integer-ratio-difference-20261127/bird-gpt-6.2-astra", + "manifest_sha256": "5e74edce4f2406a1d4eb322534d59c2f86803baf4ca17c276c7701c59caec3ee", + "scores_sha256": "241169494771f226b3f648f24dd4a13381fb47b06d5c89e6a2149cbb5808a684", + "settings": { + "profiles": [ + { + "name": "codex-mcp", + "model": "gpt-6.2-astra", + "reasoning_effort": "high" + } + ], + "backend": "ChatGPT login -> Codex CLI -> production Lang2SQL MCP", + "revision": "b916e0de6736d94c54c5900c0b5c6b5191c3b4d0", + "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": 1, + "selected_cases": 1, + "expected_cases": 1 + }, + "review_source": null, + "failure_selection": null, + "split": "all", + "concurrency": 1, + "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-integer-ratio-guidance-20261127/bird-gpt-6.2-astra", + "manifest_sha256": "5e74edce4f2406a1d4eb322534d59c2f86803baf4ca17c276c7701c59caec3ee", + "scores_sha256": "e30edf0fb90744c443ff76ab38b69ca7ec2b6d09fad1e55450e496dad366c146", + "settings": { + "profiles": [ + { + "name": "codex-mcp", + "model": "gpt-6.2-astra", + "reasoning_effort": "high" + } + ], + "backend": "ChatGPT login -> Codex CLI -> production Lang2SQL MCP", + "revision": "36031d24fce99dfab8bbb4d45a4494dd582958c7", + "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": 1, + "selected_cases": 1, + "expected_cases": 1 + }, + "review_source": null, + "failure_selection": null, + "split": "all", + "concurrency": 1, + "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 -> 1": 1 + }, + "cases": [ + { + "input": { + "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": "" + }, + "transition": "0 -> 1", + "sql_diff": "--- before.sql\n+++ after.sql\n@@ -1,8 +1,35 @@\n+WITH badge_counts AS (\n+ SELECT\n+ COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n+ COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n+ COUNT(*) AS total\n+ FROM main.badges AS b\n+ WHERE b.Name = 'Student'\n+), ratio_input(group_id, numerator, denominator) AS (\n+ SELECT 2010, count_2010, total FROM badge_counts\n+ UNION ALL\n+ SELECT 2011, count_2011, total FROM badge_counts\n+), ratio_checked AS (\n+ SELECT group_id, numerator, denominator,\n+ CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n+ WHEN typeof(numerator) NOT IN ('integer', 'real')\n+ OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n+ WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n+ OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n+ WHEN numerator <> CAST(numerator AS INTEGER)\n+ OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n+ WHEN denominator = 0 THEN 'zero_denominator'\n+ ELSE 'ok' END AS status\n+ FROM ratio_input\n+), ratio_result AS (\n+ SELECT group_id, numerator, denominator, status,\n+ CASE WHEN status = 'ok' THEN\n+ (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n+ END AS ratio_value\n+ FROM ratio_checked\n+)\n SELECT\n- 100.0 * (\n- COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n- - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n- ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\n-FROM main.badges AS b\n-WHERE b.Name = 'Student'\n+ MAX(CASE WHEN group_id = 2010 THEN ratio_value END)\n+ - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points\n+FROM ratio_result\n LIMIT 1", + "before": { + "score": 0, + "record_sha256": "a34b24d84744431ea4ccaf3eab4684cb8d2933d24490a719eff483c74d5aa761", + "record": { + "instance_id": "bird120", + "profile": "codex-mcp", + "model": "gpt-6.2-astra", + "status": "predicted", + "calls": [], + "prompt_sha256": "3eac807cee3be25549744ef09937ebc66e994a5174998558002935c9c08fcc9e", + "events_sha256": "38ba1ea772a1238388f832ac7e67a9d0dbe4f8a5d93bb975007bca076e46023f", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 197352, + "cached_input_tokens": 181504, + "cache_write_input_tokens": 0, + "output_tokens": 548, + "reasoning_output_tokens": 0 + } + ], + "mcp_calls": [ + { + "id": "item_1", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"CkA9cROjGM3PdCTsL8FH_fWN9zvze8_ksmnK9vHJEKk\", \"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_2", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "badges" + }, + "result": { + "content": [ + { + "type": "text", + "text": "badges (table)\n- Id: INTEGER NOT NULL\n- UserId: INTEGER\n- Name: TEXT\n- Date: DATETIME\nPRIMARY KEY (Id)\nFOREIGN KEY (UserId) REFERENCES users (Id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_3", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "CkA9cROjGM3PdCTsL8FH_fWN9zvze8_ksmnK9vHJEKk", + "sql": "SELECT strftime('%Y', b.Date) AS award_year, COUNT(*) AS awards FROM main.badges AS b WHERE b.Name = 'Student' GROUP BY award_year ORDER BY award_year;" + }, + "result": { + "content": [ + { + "type": "text", + "text": "5 row(s):\nResult coverage: fetched_rows=5; displayed_rows=5; 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): award_year=str; awards=int\naward_year | awards\n--- | ---\n2010 | 542\n2011 | 1959\n2012 | 3349\n2013 | 4725\n2014 | 4272\nSQL: SELECT strftime('%Y', b.Date) AS award_year, COUNT(*) AS awards FROM main.badges AS b WHERE b.Name = 'Student' GROUP BY award_year ORDER BY award_year\nLIMIT 1000" + } + ], + "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\": \"bHlHZ1kmioYc4wpo9EP5JTyMIflEQwBvb0PoPiOu6DU\", \"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": "run_sql", + "arguments": { + "definition_check_id": "bHlHZ1kmioYc4wpo9EP5JTyMIflEQwBvb0PoPiOu6DU", + "expected_rows": 1, + "expected_columns": [ + "percentage_point_difference" + ], + "sql": "SELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\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): percentage_point_difference=float\npercentage_point_difference\n---\n-9.544015626052401\nSQL: SELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\nLIMIT 1" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "```sql\nSELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\nLIMIT 1\n```", + "event_parse_errors": [], + "rows": 1, + "sql": "SELECT\n 100.0 * (\n COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\nLIMIT 1", + "seconds": 29.758980208076537 + }, + "result": { + "columns": [ + "percentage_point_difference" + ], + "row_count": 1, + "preview": [ + [ + "-9.544015626052401" + ] + ], + "preview_truncated": false, + "csv_sha256": "84686ba4e41daaa34c9072e6b923f195e2bbd51233d031bea66045c08aa0b411" + } + }, + "after": { + "score": 1, + "record_sha256": "6b1d65022b9367adfc9c042f477a42137fc6bb38fedf0e1eafd4b95aef4d3244", + "record": { + "instance_id": "bird120", + "profile": "codex-mcp", + "model": "gpt-6.2-astra", + "status": "predicted", + "calls": [], + "prompt_sha256": "3eac807cee3be25549744ef09937ebc66e994a5174998558002935c9c08fcc9e", + "events_sha256": "cb523d4478033f57c9caece399de3cc9448df8fb17aa55a5fae2376ce05748e5", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 201814, + "cached_input_tokens": 184832, + "cache_write_input_tokens": 0, + "output_tokens": 1199, + "reasoning_output_tokens": 0 + } + ], + "mcp_calls": [ + { + "id": "item_1", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"pGO-tgaqrUkmG2xB23Syy-LBoGXnwoI46TTRtejqWuI\", \"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_2", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "integer_ratio_sql", + "arguments": { + "dialect": "sqlite", + "multiplier": 100 + }, + "result": { + "content": [ + { + "type": "text", + "text": "SQLite only. Supply WITH ratio_input AS (your SELECT exposing group_id, numerator, denominator), append these CTEs, and SELECT from ratio_result. Reserve ratio_* names. One output row per input row, including failures; no grouping, filtering or deduplication. Only exact integer quantities are supported, including REAL values that already equal integers. Do not round or cast away fractional source data to satisfy this contract. Inspect status: null_input, invalid_input, overflow and zero_denominator retain their row with NULL ratio_value. For ok rows, integer scaling is exact within the shared binary64 exact-integer bound; only the final division rounds to REAL. This is not an exact decimal representation or a decimal-place rounding policy. Use the requested numerator, denominator and units; this tool cannot validate those choices.\n\nratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_3", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "explore_schema", + "arguments": { + "table": "badges" + }, + "result": { + "content": [ + { + "type": "text", + "text": "badges (table)\n- Id: INTEGER NOT NULL\n- UserId: INTEGER\n- Name: TEXT\n- Date: DATETIME\nPRIMARY KEY (Id)\nFOREIGN KEY (UserId) REFERENCES users (Id)" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + }, + { + "id": "item_4", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "pGO-tgaqrUkmG2xB23Syy-LBoGXnwoI46TTRtejqWuI", + "sql": "WITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT * FROM ratio_result" + }, + "result": { + "content": [ + { + "type": "text", + "text": "2 row(s):\nResult coverage: fetched_rows=2; displayed_rows=2; 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): group_id=int; numerator=int; denominator=int; status=str; ratio_value=float\ngroup_id | numerator | denominator | status | ratio_value\n--- | --- | --- | --- | ---\n2010 | 542 | 14847 | ok | 3.6505691385465076\n2011 | 1959 | 14847 | ok | 13.19458476459891\nSQL: WITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT * FROM ratio_result\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\": \"2f0Df26qCrIurvyCMQpe1nBRBLicnBf_rFuxl_cttSU\", \"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": "2f0Df26qCrIurvyCMQpe1nBRBLicnBf_rFuxl_cttSU", + "expected_rows": 1, + "expected_columns": [ + "difference_percentage_points" + ], + "sql": "WITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT\n MAX(CASE WHEN group_id = 2010 THEN ratio_value END)\n - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points\nFROM ratio_result\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): difference_percentage_points=float\ndifference_percentage_points\n---\n-9.544015626052403\nSQL: WITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT\n MAX(CASE WHEN group_id = 2010 THEN ratio_value END)\n - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points\nFROM ratio_result\nLIMIT 1" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "```sql\nWITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT\n MAX(CASE WHEN group_id = 2010 THEN ratio_value END)\n - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points\nFROM ratio_result\nLIMIT 1\n```", + "event_parse_errors": [], + "rows": 1, + "sql": "WITH badge_counts AS (\n SELECT\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n COUNT(*) AS total\n FROM main.badges AS b\n WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n SELECT 2010, count_2010, total FROM badge_counts\n UNION ALL\n SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n SELECT group_id, numerator, denominator,\n CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n WHEN typeof(numerator) NOT IN ('integer', 'real')\n OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n WHEN numerator <> CAST(numerator AS INTEGER)\n OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n WHEN denominator = 0 THEN 'zero_denominator'\n ELSE 'ok' END AS status\n FROM ratio_input\n), ratio_result AS (\n SELECT group_id, numerator, denominator, status,\n CASE WHEN status = 'ok' THEN\n (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n END AS ratio_value\n FROM ratio_checked\n)\nSELECT\n MAX(CASE WHEN group_id = 2010 THEN ratio_value END)\n - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points\nFROM ratio_result\nLIMIT 1", + "seconds": 42.964088208042085 + }, + "result": { + "columns": [ + "difference_percentage_points" + ], + "row_count": 1, + "preview": [ + [ + "-9.544015626052403" + ] + ], + "preview_truncated": false, + "csv_sha256": "43afb207d8132fecd672be8cf9025691cdc2a3b205067419c67d701582e78263" + } + } + } + ] +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio-guidance/comparison/index.html b/bench/accuracy/mcp-review-results/integer-ratio-guidance/comparison/index.html new file mode 100644 index 00000000..a69bae3d --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-guidance/comparison/index.html @@ -0,0 +1,436 @@ +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 -> 1": 1
+}
Provenance and settings
[
+  {
+    "path": "/Users/seyoung/workspace/benchmarks/codex-mcp-integer-ratio-difference-20261127/bird-gpt-6.2-astra",
+    "manifest_sha256": "5e74edce4f2406a1d4eb322534d59c2f86803baf4ca17c276c7701c59caec3ee",
+    "scores_sha256": "241169494771f226b3f648f24dd4a13381fb47b06d5c89e6a2149cbb5808a684",
+    "settings": {
+      "profiles": [
+        {
+          "name": "codex-mcp",
+          "model": "gpt-6.2-astra",
+          "reasoning_effort": "high"
+        }
+      ],
+      "backend": "ChatGPT login -> Codex CLI -> production Lang2SQL MCP",
+      "revision": "b916e0de6736d94c54c5900c0b5c6b5191c3b4d0",
+      "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": 1,
+        "selected_cases": 1,
+        "expected_cases": 1
+      },
+      "review_source": null,
+      "failure_selection": null,
+      "split": "all",
+      "concurrency": 1,
+      "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-integer-ratio-guidance-20261127/bird-gpt-6.2-astra",
+    "manifest_sha256": "5e74edce4f2406a1d4eb322534d59c2f86803baf4ca17c276c7701c59caec3ee",
+    "scores_sha256": "e30edf0fb90744c443ff76ab38b69ca7ec2b6d09fad1e55450e496dad366c146",
+    "settings": {
+      "profiles": [
+        {
+          "name": "codex-mcp",
+          "model": "gpt-6.2-astra",
+          "reasoning_effort": "high"
+        }
+      ],
+      "backend": "ChatGPT login -> Codex CLI -> production Lang2SQL MCP",
+      "revision": "36031d24fce99dfab8bbb4d45a4494dd582958c7",
+      "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": 1,
+        "selected_cases": 1,
+        "expected_cases": 1
+      },
+      "review_source": null,
+      "failure_selection": null,
+      "split": "all",
+      "concurrency": 1,
+      "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"
+    }
+  }
+]
bird120: 0 -> 1
{
+  "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": ""
+}

SQL diff

--- before.sql
++++ after.sql
+@@ -1,8 +1,35 @@
++WITH badge_counts AS (
++  SELECT
++    COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,
++    COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,
++    COUNT(*) AS total
++  FROM main.badges AS b
++  WHERE b.Name = 'Student'
++), ratio_input(group_id, numerator, denominator) AS (
++  SELECT 2010, count_2010, total FROM badge_counts
++  UNION ALL
++  SELECT 2011, count_2011, total FROM badge_counts
++), ratio_checked AS (
++  SELECT group_id, numerator, denominator,
++    CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'
++      WHEN typeof(numerator) NOT IN ('integer', 'real')
++        OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'
++      WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409
++        OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'
++      WHEN numerator <> CAST(numerator AS INTEGER)
++        OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'
++      WHEN denominator = 0 THEN 'zero_denominator'
++      ELSE 'ok' END AS status
++  FROM ratio_input
++), ratio_result AS (
++  SELECT group_id, numerator, denominator, status,
++    CASE WHEN status = 'ok' THEN
++      (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)
++    END AS ratio_value
++  FROM ratio_checked
++)
+ SELECT
+-    100.0 * (
+-        COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')
+-        - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')
+-    ) / NULLIF(COUNT(*), 0) AS percentage_point_difference
+-FROM main.badges AS b
+-WHERE b.Name = 'Student'
++  MAX(CASE WHEN group_id = 2010 THEN ratio_value END)
++  - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points
++FROM ratio_result
+ LIMIT 1

before: score 0

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

Final SQL / answer

SELECT
+    100.0 * (
+        COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')
+        - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')
+    ) / NULLIF(COUNT(*), 0) AS percentage_point_difference
+FROM main.badges AS b
+WHERE b.Name = 'Student'
+LIMIT 1

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

{
+  "columns": [
+    "percentage_point_difference"
+  ],
+  "row_count": 1,
+  "preview": [
+    [
+      "-9.544015626052401"
+    ]
+  ],
+  "preview_truncated": false,
+  "csv_sha256": "84686ba4e41daaa34c9072e6b923f195e2bbd51233d031bea66045c08aa0b411"
+}
Every MCP call: arguments and results
[
+  {
+    "id": "item_1",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "resolve_business_terms",
+    "arguments": {
+      "terms": []
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "{\"definition_check_id\": \"CkA9cROjGM3PdCTsL8FH_fWN9zvze8_ksmnK9vHJEKk\", \"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_2",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "explore_schema",
+    "arguments": {
+      "table": "badges"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "badges (table)\n- Id: INTEGER NOT NULL\n- UserId: INTEGER\n- Name: TEXT\n- Date: DATETIME\nPRIMARY KEY (Id)\nFOREIGN KEY (UserId) REFERENCES users (Id)"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_3",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "run_sql",
+    "arguments": {
+      "definition_check_id": "CkA9cROjGM3PdCTsL8FH_fWN9zvze8_ksmnK9vHJEKk",
+      "sql": "SELECT strftime('%Y', b.Date) AS award_year, COUNT(*) AS awards FROM main.badges AS b WHERE b.Name = 'Student' GROUP BY award_year ORDER BY award_year;"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "5 row(s):\nResult coverage: fetched_rows=5; displayed_rows=5; 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): award_year=str; awards=int\naward_year | awards\n--- | ---\n2010 | 542\n2011 | 1959\n2012 | 3349\n2013 | 4725\n2014 | 4272\nSQL: SELECT strftime('%Y', b.Date) AS award_year, COUNT(*) AS awards FROM main.badges AS b WHERE b.Name = 'Student' GROUP BY award_year ORDER BY award_year\nLIMIT 1000"
+        }
+      ],
+      "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\": \"bHlHZ1kmioYc4wpo9EP5JTyMIflEQwBvb0PoPiOu6DU\", \"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": "run_sql",
+    "arguments": {
+      "definition_check_id": "bHlHZ1kmioYc4wpo9EP5JTyMIflEQwBvb0PoPiOu6DU",
+      "expected_rows": 1,
+      "expected_columns": [
+        "percentage_point_difference"
+      ],
+      "sql": "SELECT\n    100.0 * (\n        COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n        - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n    ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\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): percentage_point_difference=float\npercentage_point_difference\n---\n-9.544015626052401\nSQL: SELECT\n    100.0 * (\n        COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2010')\n        - COUNT(*) FILTER (WHERE strftime('%Y', b.Date) = '2011')\n    ) / NULLIF(COUNT(*), 0) AS percentage_point_difference\nFROM main.badges AS b\nWHERE b.Name = 'Student'\nLIMIT 1"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  }
+]

after: score 1

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

Final SQL / answer

WITH badge_counts AS (
+  SELECT
+    COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,
+    COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,
+    COUNT(*) AS total
+  FROM main.badges AS b
+  WHERE b.Name = 'Student'
+), ratio_input(group_id, numerator, denominator) AS (
+  SELECT 2010, count_2010, total FROM badge_counts
+  UNION ALL
+  SELECT 2011, count_2011, total FROM badge_counts
+), ratio_checked AS (
+  SELECT group_id, numerator, denominator,
+    CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'
+      WHEN typeof(numerator) NOT IN ('integer', 'real')
+        OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'
+      WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409
+        OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'
+      WHEN numerator <> CAST(numerator AS INTEGER)
+        OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'
+      WHEN denominator = 0 THEN 'zero_denominator'
+      ELSE 'ok' END AS status
+  FROM ratio_input
+), ratio_result AS (
+  SELECT group_id, numerator, denominator, status,
+    CASE WHEN status = 'ok' THEN
+      (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)
+    END AS ratio_value
+  FROM ratio_checked
+)
+SELECT
+  MAX(CASE WHEN group_id = 2010 THEN ratio_value END)
+  - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points
+FROM ratio_result
+LIMIT 1

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

{
+  "columns": [
+    "difference_percentage_points"
+  ],
+  "row_count": 1,
+  "preview": [
+    [
+      "-9.544015626052403"
+    ]
+  ],
+  "preview_truncated": false,
+  "csv_sha256": "43afb207d8132fecd672be8cf9025691cdc2a3b205067419c67d701582e78263"
+}
Every MCP call: arguments and results
[
+  {
+    "id": "item_1",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "resolve_business_terms",
+    "arguments": {
+      "terms": []
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "{\"definition_check_id\": \"pGO-tgaqrUkmG2xB23Syy-LBoGXnwoI46TTRtejqWuI\", \"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_2",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "integer_ratio_sql",
+    "arguments": {
+      "dialect": "sqlite",
+      "multiplier": 100
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "SQLite only. Supply WITH ratio_input AS (your SELECT exposing group_id, numerator, denominator), append these CTEs, and SELECT from ratio_result. Reserve ratio_* names. One output row per input row, including failures; no grouping, filtering or deduplication. Only exact integer quantities are supported, including REAL values that already equal integers. Do not round or cast away fractional source data to satisfy this contract. Inspect status: null_input, invalid_input, overflow and zero_denominator retain their row with NULL ratio_value. For ok rows, integer scaling is exact within the shared binary64 exact-integer bound; only the final division rounds to REAL. This is not an exact decimal representation or a decimal-place rounding policy. Use the requested numerator, denominator and units; this tool cannot validate those choices.\n\nratio_checked AS (\n  SELECT group_id, numerator, denominator,\n    CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n      WHEN typeof(numerator) NOT IN ('integer', 'real')\n        OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n      WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n        OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n      WHEN numerator <> CAST(numerator AS INTEGER)\n        OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n      WHEN denominator = 0 THEN 'zero_denominator'\n      ELSE 'ok' END AS status\n  FROM ratio_input\n), ratio_result AS (\n  SELECT group_id, numerator, denominator, status,\n    CASE WHEN status = 'ok' THEN\n      (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n    END AS ratio_value\n  FROM ratio_checked\n)"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_3",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "explore_schema",
+    "arguments": {
+      "table": "badges"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "badges (table)\n- Id: INTEGER NOT NULL\n- UserId: INTEGER\n- Name: TEXT\n- Date: DATETIME\nPRIMARY KEY (Id)\nFOREIGN KEY (UserId) REFERENCES users (Id)"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  },
+  {
+    "id": "item_4",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "run_sql",
+    "arguments": {
+      "definition_check_id": "pGO-tgaqrUkmG2xB23Syy-LBoGXnwoI46TTRtejqWuI",
+      "sql": "WITH badge_counts AS (\n  SELECT\n    COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n    COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n    COUNT(*) AS total\n  FROM main.badges AS b\n  WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n  SELECT 2010, count_2010, total FROM badge_counts\n  UNION ALL\n  SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n  SELECT group_id, numerator, denominator,\n    CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n      WHEN typeof(numerator) NOT IN ('integer', 'real')\n        OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n      WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n        OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n      WHEN numerator <> CAST(numerator AS INTEGER)\n        OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n      WHEN denominator = 0 THEN 'zero_denominator'\n      ELSE 'ok' END AS status\n  FROM ratio_input\n), ratio_result AS (\n  SELECT group_id, numerator, denominator, status,\n    CASE WHEN status = 'ok' THEN\n      (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n    END AS ratio_value\n  FROM ratio_checked\n)\nSELECT * FROM ratio_result"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "2 row(s):\nResult coverage: fetched_rows=2; displayed_rows=2; 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): group_id=int; numerator=int; denominator=int; status=str; ratio_value=float\ngroup_id | numerator | denominator | status | ratio_value\n--- | --- | --- | --- | ---\n2010 | 542 | 14847 | ok | 3.6505691385465076\n2011 | 1959 | 14847 | ok | 13.19458476459891\nSQL: WITH badge_counts AS (\n  SELECT\n    COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n    COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n    COUNT(*) AS total\n  FROM main.badges AS b\n  WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n  SELECT 2010, count_2010, total FROM badge_counts\n  UNION ALL\n  SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n  SELECT group_id, numerator, denominator,\n    CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n      WHEN typeof(numerator) NOT IN ('integer', 'real')\n        OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n      WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n        OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n      WHEN numerator <> CAST(numerator AS INTEGER)\n        OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n      WHEN denominator = 0 THEN 'zero_denominator'\n      ELSE 'ok' END AS status\n  FROM ratio_input\n), ratio_result AS (\n  SELECT group_id, numerator, denominator, status,\n    CASE WHEN status = 'ok' THEN\n      (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n    END AS ratio_value\n  FROM ratio_checked\n)\nSELECT * FROM ratio_result\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\": \"2f0Df26qCrIurvyCMQpe1nBRBLicnBf_rFuxl_cttSU\", \"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": "2f0Df26qCrIurvyCMQpe1nBRBLicnBf_rFuxl_cttSU",
+      "expected_rows": 1,
+      "expected_columns": [
+        "difference_percentage_points"
+      ],
+      "sql": "WITH badge_counts AS (\n  SELECT\n    COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n    COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n    COUNT(*) AS total\n  FROM main.badges AS b\n  WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n  SELECT 2010, count_2010, total FROM badge_counts\n  UNION ALL\n  SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n  SELECT group_id, numerator, denominator,\n    CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n      WHEN typeof(numerator) NOT IN ('integer', 'real')\n        OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n      WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n        OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n      WHEN numerator <> CAST(numerator AS INTEGER)\n        OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n      WHEN denominator = 0 THEN 'zero_denominator'\n      ELSE 'ok' END AS status\n  FROM ratio_input\n), ratio_result AS (\n  SELECT group_id, numerator, denominator, status,\n    CASE WHEN status = 'ok' THEN\n      (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n    END AS ratio_value\n  FROM ratio_checked\n)\nSELECT\n  MAX(CASE WHEN group_id = 2010 THEN ratio_value END)\n  - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points\nFROM ratio_result\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): difference_percentage_points=float\ndifference_percentage_points\n---\n-9.544015626052403\nSQL: WITH badge_counts AS (\n  SELECT\n    COUNT(CASE WHEN strftime('%Y', b.Date) = '2010' THEN 1 END) AS count_2010,\n    COUNT(CASE WHEN strftime('%Y', b.Date) = '2011' THEN 1 END) AS count_2011,\n    COUNT(*) AS total\n  FROM main.badges AS b\n  WHERE b.Name = 'Student'\n), ratio_input(group_id, numerator, denominator) AS (\n  SELECT 2010, count_2010, total FROM badge_counts\n  UNION ALL\n  SELECT 2011, count_2011, total FROM badge_counts\n), ratio_checked AS (\n  SELECT group_id, numerator, denominator,\n    CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input'\n      WHEN typeof(numerator) NOT IN ('integer', 'real')\n        OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input'\n      WHEN numerator NOT BETWEEN -90071992547409 AND 90071992547409\n        OR denominator NOT BETWEEN -9007199254740991 AND 9007199254740991 THEN 'overflow'\n      WHEN numerator <> CAST(numerator AS INTEGER)\n        OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input'\n      WHEN denominator = 0 THEN 'zero_denominator'\n      ELSE 'ok' END AS status\n  FROM ratio_input\n), ratio_result AS (\n  SELECT group_id, numerator, denominator, status,\n    CASE WHEN status = 'ok' THEN\n      (CAST(numerator AS INTEGER) * 100) * 1.0 / CAST(denominator AS INTEGER)\n    END AS ratio_value\n  FROM ratio_checked\n)\nSELECT\n  MAX(CASE WHEN group_id = 2010 THEN ratio_value END)\n  - MAX(CASE WHEN group_id = 2011 THEN ratio_value END) AS difference_percentage_points\nFROM ratio_result\nLIMIT 1"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  }
+]
\ No newline at end of file diff --git a/bench/accuracy/mcp-review-results/integer-ratio-guidance/manifest.json b/bench/accuracy/mcp-review-results/integer-ratio-guidance/manifest.json new file mode 100644 index 00000000..053da440 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-guidance/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": "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": "" + } + ], + "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/integer-ratio-guidance/protocol.json b/bench/accuracy/mcp-review-results/integer-ratio-guidance/protocol.json new file mode 100644 index 00000000..c54bd961 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-guidance/protocol.json @@ -0,0 +1,16 @@ +{ + "revision": "36031d24fce99dfab8bbb4d45a4494dd582958c7", + "baseline": "/Users/seyoung/workspace/benchmarks/codex-mcp-integer-ratio-difference-20261127/bird-gpt-6.2-astra", + "ids": [ + "bird120" + ], + "model": "gpt-6.2-astra/high", + "expected_cases": 1, + "change": "After verified compiler and two tool-only trials, extend one existing numeric instruction with generic compiler use and separate requested component ratios. Compiler, executor and official scorer unchanged.", + "input": "Original task/context only; no prior SQL, feedback, grade, reference, numerical diagnosis or task-specific hint.", + "limits": [ + "Selected single failure, not full accuracy.", + "Initial prompt bytes should stay equal; server instructions intentionally differ.", + "No unchanged retry." + ] +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio-guidance/settings.json b/bench/accuracy/mcp-review-results/integer-ratio-guidance/settings.json new file mode 100644 index 00000000..8cfec194 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-guidance/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": "36031d24fce99dfab8bbb4d45a4494dd582958c7", + "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": 1, + "selected_cases": 1, + "expected_cases": 1 + }, + "review_source": null, + "failure_selection": null, + "split": "all", + "concurrency": 1, + "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/integer-ratio-guidance/sha256.json b/bench/accuracy/mcp-review-results/integer-ratio-guidance/sha256.json new file mode 100644 index 00000000..21739932 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-guidance/sha256.json @@ -0,0 +1,18 @@ +{ + "analysis.json": "be6871f62d7d8d7f37470e631142f5ed48fdc26c0947660a159746cb48a9710c", + "codex-mcp/csv/bird120.csv": "43afb207d8132fecd672be8cf9025691cdc2a3b205067419c67d701582e78263", + "codex-mcp/events/bird120.answer.txt": "8dbe196637f3619f0117b548d14e5c16bcda1fb13e53cee6c45303861c8e087c", + "codex-mcp/events/bird120.jsonl": "cb523d4478033f57c9caece399de3cc9448df8fb17aa55a5fae2376ce05748e5", + "codex-mcp/events/bird120.prompt.txt": "3eac807cee3be25549744ef09937ebc66e994a5174998558002935c9c08fcc9e", + "codex-mcp/events/bird120.stderr": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "codex-mcp/records/bird120.json": "6b1d65022b9367adfc9c042f477a42137fc6bb38fedf0e1eafd4b95aef4d3244", + "codex-mcp/scores.json": "e30edf0fb90744c443ff76ab38b69ca7ec2b6d09fad1e55450e496dad366c146", + "codex-mcp/sql/bird120.sql": "7a65f5883ca12bbafee086af18a61d2b9b45eb4691bd8d589f6f953eb4d930da", + "codex-mcp/status.json": "11c0e743526c2b152ffba2c4c055bc5ac20ac22004ebd61242b995a4369d898d", + "comparison/comparison.json": "2f93db3c78a2f49eacb3b2fc775197173a68e5347f6991375b342b7931e8e0e0", + "comparison/index.html": "5caf8af40cfb29e516986545017658256c0536cf859a48f49ebe057ea360a258", + "manifest.json": "5e74edce4f2406a1d4eb322534d59c2f86803baf4ca17c276c7701c59caec3ee", + "protocol.json": "6ab38d9f4ca628c844f09b7e8a726f15e826f73ba4130984dda12d01aed5511e", + "settings.json": "8821783d47f58958c612c19f2d5995b2cf65d4399d93d21b9d4c6b67697d5e9c", + "summary.json": "c2e70d4a98f94e810170577bdc4875048efc680796036987c763c95e565e03fd" +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio-guidance/summary.json b/bench/accuracy/mcp-review-results/integer-ratio-guidance/summary.json new file mode 100644 index 00000000..6c4374a9 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio-guidance/summary.json @@ -0,0 +1,8 @@ +[ + { + "profile": "codex-mcp", + "correct": 1, + "total": 1, + "accuracy": 1.0 + } +] diff --git a/bench/accuracy/mcp-review-results/integer-ratio/analysis.json b/bench/accuracy/mcp-review-results/integer-ratio/analysis.json new file mode 100644 index 00000000..15c44ba2 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio/analysis.json @@ -0,0 +1,8 @@ +{ + "correct": 1, + "total": 1, + "compiler_tool_calls": 0, + "finding": "Model wrote multiply-before-divide SQL directly; official0->1. Initial user prompt is byte-identical to baseline. New tool availability does not prove it caused the repair.", + "decision": "Do not rerun this passed case during development. No full accuracy or repeatability claim.", + "compiler_validation": "Separate4000Fraction comparisons and actual stdio compilation/execution prove arithmetic contract, not model adoption." +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/csv/bird007.csv b/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/csv/bird007.csv new file mode 100644 index 00000000..09f087e2 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/csv/bird007.csv @@ -0,0 +1,2 @@ +Percent (%) Eligible Free (K-12),District Code +70.15113350125945,64857 diff --git a/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/events/bird007.answer.txt b/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/events/bird007.answer.txt new file mode 100644 index 00000000..10dd556c --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/events/bird007.answer.txt @@ -0,0 +1,9 @@ +```sql +SELECT + 100.0 * f."Free Meal Count (K-12)" / NULLIF(f."Enrollment (K-12)", 0) AS "Percent (%) Eligible Free (K-12)", + f."District Code" +FROM main.schools AS s +JOIN main.frpm AS f ON f.CDSCode = s.CDSCode +WHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3) +LIMIT 1000 +``` \ No newline at end of file diff --git a/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/events/bird007.jsonl b/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/events/bird007.jsonl new file mode 100644 index 00000000..c996048f --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/events/bird007.jsonl @@ -0,0 +1,13 @@ +{"type":"thread.started","thread_id":"01a21a42-ffcf-7692-8691-e06b89f44ec1"} +{"type":"turn.started"} +{"type":"item.completed","item":{"id":"item_0","type":"agent_message","text":"I’ll check the schema in Lang2SQL, then run the query using the free-meal eligibility formula you provided."}} +{"type":"item.started","item":{"id":"item_1","type":"mcp_tool_call","server":"lang2sql","tool":"explore_schema","arguments":{"table":"frpm"},"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":"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"}} +{"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\": \"_bBi-K8y6zSvMpU4yaPrzwkVjNWY82LW_lFiexU8jfM\", \"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":"schools"},"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":"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"}} +{"type":"item.started","item":{"id":"item_4","type":"mcp_tool_call","server":"lang2sql","tool":"run_sql","arguments":{"definition_check_id":"_bBi-K8y6zSvMpU4yaPrzwkVjNWY82LW_lFiexU8jfM","sql":"SELECT\n 100.0 * f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) AS \"Percent (%) Eligible Free (K-12)\",\n f.\"District Code\"\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3);","expected_columns":["Percent (%) Eligible Free (K-12)","District Code"]},"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":"_bBi-K8y6zSvMpU4yaPrzwkVjNWY82LW_lFiexU8jfM","sql":"SELECT\n 100.0 * f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) AS \"Percent (%) Eligible Free (K-12)\",\n f.\"District Code\"\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3);","expected_columns":["Percent (%) Eligible Free (K-12)","District Code"]},"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=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): Percent (%) Eligible Free (K-12)=float; District Code=int\nPercent (%) Eligible Free (K-12) | District Code\n--- | ---\n70.15113350125945 | 64857\nSQL: SELECT\n 100.0 * f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) AS \"Percent (%) Eligible Free (K-12)\",\n f.\"District Code\"\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3)\nLIMIT 1000"}],"structured_content":null},"error":null,"status":"completed"}} +{"type":"item.completed","item":{"id":"item_5","type":"agent_message","text":"```sql\nSELECT\n 100.0 * f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) AS \"Percent (%) Eligible Free (K-12)\",\n f.\"District Code\"\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3)\nLIMIT 1000\n```"}} +{"type":"turn.completed","usage":{"input_tokens":152892,"cached_input_tokens":134144,"cache_write_input_tokens":0,"output_tokens":481,"reasoning_output_tokens":0}} diff --git a/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/events/bird007.prompt.txt b/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/events/bird007.prompt.txt new file mode 100644 index 00000000..09b27dd5 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/events/bird007.prompt.txt @@ -0,0 +1,742 @@ +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. +What is the Percent (%) Eligible Free (K-12) in the school administered by an administrator whose first name is Alusine. List the district code of the school. +Provided evidence: +K-12 free-meal eligibility percentage is K-12 free-meal recipients divided by K-12 enrollment, times 100. +Official schema metadata (examples are not exhaustive): +CREATE TABLE `frpm` ( + `CDSCode` TEXT, -- CDSCode; example: ['01100170109835', '01100170112607'] + `Academic Year` TEXT, -- Academic Year; example: ['2014-2015'] + `County Code` TEXT, -- County Code; example: ['01'] + `District Code` INTEGER, -- District Code; example: [10017] + `School Code` TEXT, -- School Code; example: ['0109835', '0112607'] + `County Name` TEXT, -- County Code; example: ['Alameda'] + `District Name` TEXT, -- District Name; example: ['Alameda County Office of Education'] + `School Name` TEXT, -- School Name; example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] + `District Type` TEXT, -- District Type; example: ['County Office of Education (COE)'] + `School Type` TEXT, -- School Type; example: ['K-12 Schools (Public)', 'High Schools (Public)'] + `Educational Option Type` TEXT, -- Educational Option Type; example: ['Traditional'] + `NSLP Provision Status` TEXT, -- NSLP Provision Status; example: ['Breakfast Provision 2'] + `Charter School (Y/N)` INTEGER, -- Charter School (Y/N); example: [1] + `Charter School Number` TEXT, -- Charter School Number; example: ['0728', '0811'] + `Charter Funding Type` TEXT, -- Charter Funding Type; example: ['Directly funded'] + `IRC` INTEGER, -- example: [1] + `Low Grade` TEXT, -- Low Grade; example: ['K', '9'] + `High Grade` TEXT, -- High Grade; example: ['12', '8'] + `Enrollment (K-12)` REAL, -- Enrollment (K-12); example: [1087.0, 395.0] + `Free Meal Count (K-12)` REAL, -- Free Meal Count (K-12); example: [565.0, 186.0] + `Percent (%) Eligible Free (K-12)` REAL, -- example: [0.519779208831647, 0.470886075949367] + `FRPM Count (K-12)` REAL, -- Free or Reduced Price Meal Count (K-12); example: [715.0, 186.0] + `Percent (%) Eligible FRPM (K-12)` REAL, -- example: [0.657773689052438, 0.470886075949367] + `Enrollment (Ages 5-17)` REAL, -- Enrollment (Ages 5-17); example: [1070.0, 376.0] + `Free Meal Count (Ages 5-17)` REAL, -- Free Meal Count (Ages 5-17); example: [553.0, 182.0] + `Percent (%) Eligible Free (Ages 5-17)` REAL, -- example: [0.516822429906542, 0.484042553191489] + `FRPM Count (Ages 5-17)` REAL, -- example: [702.0, 182.0] + `Percent (%) Eligible FRPM (Ages 5-17)` REAL, -- example: [0.65607476635514, 0.484042553191489] + `2013-14 CALPADS Fall 1 Certification Status` INTEGER, -- 2013-14 CALPADS Fall 1 Certification Status; example: [1] + PRIMARY KEY (`CDSCode`), + FOREIGN KEY (`CDSCode`) REFERENCES `schools` (`CDSCode`) +); + +CREATE TABLE `satscores` ( + `cds` TEXT, -- California Department Schools; example: ['01100170000000', '01100170109835'] + `rtype` TEXT, -- rtype; example: ['D', 'S'] + `sname` TEXT, -- school name; example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] + `dname` TEXT, -- district segment; example: ['Alameda County Office of Education', 'Alameda Unified'] + `cname` TEXT, -- county name; example: ['Alameda'] + `enroll12` INTEGER, -- enrollment (1st-12nd grade); example: [398, 62] + `NumTstTakr` INTEGER, -- Number of Test Takers in this school; example: [88, 17] + `AvgScrRead` INTEGER, -- average scores in Reading; example: [418, 503] + `AvgScrMath` INTEGER, -- average scores in Math; example: [418, 546] + `AvgScrWrite` INTEGER, -- average scores in writing; example: [417, 505] + `NumGE1500` INTEGER, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500; example: [14, 9] + PRIMARY KEY (`cds`), + FOREIGN KEY (`cds`) REFERENCES `schools` (`CDSCode`) +); + +CREATE TABLE `schools` ( + `CDSCode` TEXT, -- CDSCode; example: ['01100170000000', '01100170109835'] + `NCESDist` TEXT, -- This field represents the 7-digit National Center for Educational Statistics (NCES) school district identification numbe; example: ['0691051'] + `NCESSchool` TEXT, -- This field represents the 5-digit NCES school identification number. The NCESSchool combined with the NCESDist form a un; example: ['10546', '10947'] + `StatusType` TEXT, -- This field identifies the status of the district.; example: ['Active', 'Closed'] + `County` TEXT, -- County name; example: ['Alameda'] + `District` TEXT, -- District; example: ['Alameda County Office of Education'] + `School` TEXT, -- School; example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] + `Street` TEXT, -- Street; example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] + `StreetAbr` TEXT, -- The abbreviated street address of the school, district, or administrative authority’s physical location.; example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] + `City` TEXT, -- City; example: ['Hayward', 'Newark'] + `Zip` TEXT, -- Zip; example: ['94544-1136', '94560-5359'] + `State` TEXT, -- State; example: ['CA'] + `MailStreet` TEXT, -- MailStreet; example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] + `MailStrAbr` TEXT, -- mailing street address; example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] + `MailCity` TEXT, -- mailing city; example: ['Hayward', 'Newark'] + `MailZip` TEXT, -- mailing zip; example: ['94544-1136', '94560-5359'] + `MailState` TEXT, -- mailing state; example: ['CA'] + `Phone` TEXT, -- Phone; example: ['(510) 887-0152', '(510) 596-8901'] + `Ext` TEXT, -- The phone number extension of the school, district, or administrative authority.; example: [] + `Website` TEXT, -- The website address of the school, district, or administrative authority.; example: ['www.acoe.org', 'www.envisionacademy.org/'] + `OpenDate` DATE, -- The date the school opened.; example: ['2005-08-29', '2006-08-28'] + `ClosedDate` DATE, -- The date the school closed.; example: ['2015-07-31', '2015-06-30'] + `Charter` INTEGER, -- This field identifies a charter school.; example: [1] + `CharterNum` TEXT, -- The charter school number,; example: ['0728', '0811'] + `FundingType` TEXT, -- Indicates the charter school funding type; example: ['Directly funded'] + `DOC` TEXT, -- District Ownership Code; example: ['00'] + `DOCType` TEXT, -- The District Ownership Code Type is the text description of the DOC category.; example: ['County Office of Education (COE)'] + `SOC` TEXT, -- The School Ownership Code is a numeric code used to identify the type of school.; example: ['65', '66'] + `SOCType` TEXT, -- The School Ownership Code Type is the text description of the type of school.; example: ['K-12 Schools (Public)', 'High Schools (Public)'] + `EdOpsCode` TEXT, -- The Education Option Code is a short text description of the type of education offered.; example: ['TRAD'] + `EdOpsName` TEXT, -- Educational Option Name; example: ['Traditional'] + `EILCode` TEXT, -- The Educational Instruction Level Code is a short text description of the institution's type relative to the grade range; example: ['ELEMHIGH', 'HS'] + `EILName` TEXT, -- The Educational Instruction Level Name is the long text description of the institution’s type relative to the grade rang; example: ['Elementary-High Combination', 'High School'] + `GSoffered` TEXT, -- The grade span offered is the lowest grade and the highest grade offered or supported by the school, district, or admini; example: ['K-12', '9-12'] + `GSserved` TEXT, -- It is the lowest grade and the highest grade of student enrollment as reported in the most recent certified CALPADS Fall; example: ['K-12', '9-12'] + `Virtual` TEXT, -- This field identifies the type of virtual instruction offered by the school. Virtual instruction is instruction in which; example: ['P', 'N'] + `Magnet` INTEGER, -- This field identifies whether a school is a magnet school and/or provides a magnet program.; example: [0] + `Latitude` REAL, -- The angular distance (expressed in degrees) between the location of the school, district, or administrative authority an; example: [37.658212, 37.521436] + `Longitude` REAL, -- The angular distance (expressed in degrees) between the location of the school, district, or administrative authority an; example: [-122.09713, -121.99391] + `AdmFName1` TEXT, -- administrator's first name; example: ['L Karen', 'Laura'] + `AdmLName1` TEXT, -- administrator's last name; example: ['Monroe', 'Robell'] + `AdmEmail1` TEXT, -- administrator's email address; example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] + `AdmFName2` TEXT, -- example: [] + `AdmLName2` TEXT, -- example: [] + `AdmEmail2` TEXT, -- example: [] + `AdmFName3` TEXT, -- example: [] + `AdmLName3` TEXT, -- example: [] + `AdmEmail3` TEXT, -- example: [] + `LastUpdate` DATE, -- example: ['2015-06-23', '2015-09-01'] + PRIMARY KEY (`CDSCode`) +); + + +Official column/value descriptions (2024 Dev release): +{ + "frpm": [ + { + "original_column_name": "CDSCode", + "column_name": "", + "column_description": "CDSCode", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "Academic Year", + "column_name": "", + "column_description": "Academic Year", + "data_format": "integer ", + "value_description": "" + }, + { + "original_column_name": "County Code", + "column_name": "", + "column_description": "County Code", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "District Code", + "column_name": "", + "column_description": "District Code", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "School Code ", + "column_name": "", + "column_description": "School Code", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "County Name", + "column_name": "", + "column_description": "County Code ", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "District Name ", + "column_name": "", + "column_description": "District Name ", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "School Name", + "column_name": "", + "column_description": "School Name ", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "District Type", + "column_name": "", + "column_description": "District Type", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "School Type ", + "column_name": "", + "column_description": "School Type ", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "Educational Option Type", + "column_name": "", + "column_description": "Educational Option Type", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "NSLP Provision Status", + "column_name": "", + "column_description": "NSLP Provision Status", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "Charter School (Y/N)", + "column_name": "", + "column_description": "Charter School (Y/N)", + "data_format": "integer", + "value_description": "0: N;\n1: Y" + }, + { + "original_column_name": "Charter School Number", + "column_name": "", + "column_description": "Charter School Number", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "Charter Funding Type", + "column_name": "", + "column_description": "Charter Funding Type", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "IRC", + "column_name": "", + "column_description": "", + "data_format": "integer", + "value_description": "Not useful" + }, + { + "original_column_name": "Low Grade", + "column_name": "", + "column_description": "Low Grade", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "High Grade", + "column_name": "", + "column_description": "High Grade", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "Enrollment (K-12)", + "column_name": "", + "column_description": "Enrollment (K-12)", + "data_format": "real", + "value_description": "commonsense evidence:\n\nK-12: 1st grade - 12nd grade " + }, + { + "original_column_name": "Free Meal Count (K-12)", + "column_name": "", + "column_description": "Free Meal Count (K-12)", + "data_format": "real", + "value_description": "commonsense evidence:\n\neligible free rate = Free Meal Count / Enrollment" + }, + { + "original_column_name": "Percent (%) Eligible Free (K-12)", + "column_name": "", + "column_description": "", + "data_format": "real", + "value_description": "" + }, + { + "original_column_name": "FRPM Count (K-12)", + "column_name": "", + "column_description": "Free or Reduced Price Meal Count (K-12)", + "data_format": "real", + "value_description": "commonsense evidence:\n\neligible FRPM rate = FRPM / Enrollment" + }, + { + "original_column_name": "Percent (%) Eligible FRPM (K-12)", + "column_name": "", + "column_description": "", + "data_format": "real", + "value_description": "" + }, + { + "original_column_name": "Enrollment (Ages 5-17)", + "column_name": "", + "column_description": "Enrollment (Ages 5-17)", + "data_format": "real", + "value_description": "" + }, + { + "original_column_name": "Free Meal Count (Ages 5-17)", + "column_name": "", + "column_description": "Free Meal Count (Ages 5-17)", + "data_format": "real", + "value_description": "commonsense evidence:\n\neligible free rate = Free Meal Count / Enrollment" + }, + { + "original_column_name": " Percent (%) Eligible Free (Ages 5-17)", + "column_name": "", + "column_description": "", + "data_format": "real", + "value_description": "" + }, + { + "original_column_name": "FRPM Count (Ages 5-17)", + "column_name": "", + "column_description": "", + "data_format": "real", + "value_description": "" + }, + { + "original_column_name": "Percent (%) Eligible FRPM (Ages 5-17)", + "column_name": "", + "column_description": "", + "data_format": "real", + "value_description": "" + }, + { + "original_column_name": "2013-14 CALPADS Fall 1 Certification Status", + "column_name": "", + "column_description": "2013-14 CALPADS Fall 1 Certification Status", + "data_format": "integer", + "value_description": "" + } + ], + "satscores": [ + { + "original_column_name": "cds", + "column_name": "", + "column_description": "California Department Schools", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "rtype", + "column_name": "", + "column_description": "rtype", + "data_format": "text", + "value_description": "unuseful" + }, + { + "original_column_name": "sname", + "column_name": "school name", + "column_description": "school name", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "dname", + "column_name": "district name", + "column_description": "district segment", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "cname", + "column_name": "county name", + "column_description": "county name", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "enroll12", + "column_name": "enrollment (1st-12nd grade)", + "column_description": "enrollment (1st-12nd grade)", + "data_format": "integer", + "value_description": "" + }, + { + "original_column_name": "NumTstTakr", + "column_name": "Number of Test Takers", + "column_description": "Number of Test Takers in this school", + "data_format": "integer", + "value_description": "number of test takers in each school" + }, + { + "original_column_name": "AvgScrRead", + "column_name": "average scores in Reading", + "column_description": "average scores in Reading", + "data_format": "integer", + "value_description": "average scores in Reading" + }, + { + "original_column_name": "AvgScrMath", + "column_name": "average scores in Math", + "column_description": "average scores in Math", + "data_format": "integer", + "value_description": "average scores in Math" + }, + { + "original_column_name": "AvgScrWrite", + "column_name": "average scores in writing", + "column_description": "average scores in writing", + "data_format": "integer", + "value_description": "average scores in writing" + }, + { + "original_column_name": "NumGE1500", + "column_name": "Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500", + "column_description": "Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500", + "data_format": "integer", + "value_description": "Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500\n\ncommonsense evidence:\n\nExcellence Rate = NumGE1500 / NumTstTakr" + } + ], + "schools": [ + { + "original_column_name": "CDSCode", + "column_name": "CDSCode", + "column_description": "CDSCode", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "NCESDist", + "column_name": "National Center for Educational Statistics school district identification number", + "column_description": "This field represents the 7-digit National Center for Educational Statistics (NCES) school district identification number. The first 2 digits identify the state and the last 5 digits identify the school district. Combined, they make a unique 7-digit ID for each school district.", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "NCESSchool", + "column_name": "National Center for Educational Statistics school identification number", + "column_description": "This field represents the 5-digit NCES school identification number. The NCESSchool combined with the NCESDist form a unique 12-digit ID for each school.", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "StatusType", + "column_name": "", + "column_description": "This field identifies the status of the district. ", + "data_format": "text", + "value_description": "Definitions of the valid status types are listed below:\n· Active: The district is in operation and providing instructional services.\n· Closed: The district is not in operation and no longer providing instructional services.\n· Merged: The district has combined with another district or districts.\n· Pending: The district has not opened for operation and instructional services yet, but plans to open within the next 9–12 months." + }, + { + "original_column_name": "County", + "column_name": "", + "column_description": "County name", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "District", + "column_name": "", + "column_description": "District", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "School", + "column_name": "", + "column_description": "School", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "Street", + "column_name": "", + "column_description": "Street", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "StreetAbr", + "column_name": "street address ", + "column_description": "The abbreviated street address of the school, district, or administrative authority’s physical location.", + "data_format": "text", + "value_description": "The abbreviated street address of the school, district, or administrative authority’s physical location. Note: Some records (primarily records of closed or retired schools) may not have data in this field." + }, + { + "original_column_name": "City", + "column_name": "", + "column_description": "City", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "Zip", + "column_name": "", + "column_description": "Zip", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "State", + "column_name": "", + "column_description": "State", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "MailStreet", + "column_name": "", + "column_description": "MailStreet", + "data_format": "text", + "value_description": "The unabbreviated mailing address of the school, district, or administrative authority. Note: 1) Some entities (primarily closed or retired schools) may not have data in this field; 2) Many active entities have not provided a mailing street address. For your convenience we have filled the unpopulated MailStreet cells with Street data." + }, + { + "original_column_name": "MailStrAbr", + "column_name": "mailing street address ", + "column_description": "", + "data_format": "text", + "value_description": "the abbreviated mailing street address of the school, district, or administrative authority.Note: Many active entities have not provided a mailing street address. For your convenience we have filled the unpopulated MailStrAbr cells with StreetAbr data." + }, + { + "original_column_name": "MailCity", + "column_name": "mailing city", + "column_description": "", + "data_format": "text", + "value_description": "The city associated with the mailing address of the school, district, or administrative authority. Note: Many entities have not provided a mailing address city. For your convenience we have filled the unpopulated MailCity cells with City data." + }, + { + "original_column_name": "MailZip", + "column_name": "mailing zip ", + "column_description": "", + "data_format": "text", + "value_description": "The zip code associated with the mailing address of the school, district, or administrative authority. Note: Many entities have not provided a mailing address zip code. For your convenience we have filled the unpopulated MailZip cells with Zip data." + }, + { + "original_column_name": "MailState", + "column_name": "mailing state", + "column_description": "", + "data_format": "text", + "value_description": "The state within the mailing address. For your convenience we have filled the unpopulated MailState cells with State data." + }, + { + "original_column_name": "Phone", + "column_name": "", + "column_description": "Phone", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "Ext", + "column_name": "extension", + "column_description": "The phone number extension of the school, district, or administrative authority.", + "data_format": "text", + "value_description": "The phone number extension of the school, district, or administrative authority." + }, + { + "original_column_name": "Website", + "column_name": "", + "column_description": "The website address of the school, district, or administrative authority.", + "data_format": "text", + "value_description": "The website address of the school, district, or administrative authority." + }, + { + "original_column_name": "OpenDate", + "column_name": "", + "column_description": "The date the school opened.", + "data_format": "date", + "value_description": "" + }, + { + "original_column_name": "ClosedDate", + "column_name": "", + "column_description": "The date the school closed.", + "data_format": "date", + "value_description": "" + }, + { + "original_column_name": "Charter", + "column_name": "", + "column_description": "This field identifies a charter school. ", + "data_format": "integer", + "value_description": "The field is coded as follows:\n\n·       1 = The school is a charter\n\n·       0 = The school is not a charter" + }, + { + "original_column_name": "CharterNum", + "column_name": "", + "column_description": "The charter school number,", + "data_format": "text", + "value_description": "4-digit number assigned to a charter school." + }, + { + "original_column_name": "FundingType", + "column_name": "", + "column_description": "Indicates the charter school funding type", + "data_format": "text", + "value_description": "Values are as follows:\n\n·       Not in CS (California School) funding model\n\n·       Locally funded\n\n·       Directly funded" + }, + { + "original_column_name": "DOC", + "column_name": "District Ownership Code", + "column_description": "District Ownership Code", + "data_format": "text", + "value_description": "The District Ownership Code (DOC) is the numeric code used to identify the category of the Administrative Authority.\n• 00 - County Office of Education\n• 02 – State Board of Education\n• 03 – Statewide Benefit Charter\n• 31 – State Special Schools\n• 34 – Non-school Location*\n• 52 – Elementary School District\n• 54 – Unified School District\n• 56 – High School District\n• 98 – Regional Occupational Center/Program (ROC/P)\ncommonsense evidence:\n*Only the California Education Authority has been included in the non-school location category." + }, + { + "original_column_name": "DOCType", + "column_name": "The District Ownership Code Type", + "column_description": "The District Ownership Code Type is the text description of the DOC category.", + "data_format": "text", + "value_description": "(See text values in DOC field description above)" + }, + { + "original_column_name": "SOC", + "column_name": "School Ownership Code", + "column_description": "The School Ownership Code is a numeric code used to identify the type of school.", + "data_format": "text", + "value_description": "• 08 - Preschool \n• 09 – Special Education Schools (Public)\n• 11 – Youth Authority Facilities (CEA)\n• 13 – Opportunity Schools\n• 14 – Juvenile Court Schools\n• 15 – Other County or District Programs\n• 31 – State Special Schools\n• 60 – Elementary School (Public)\n• 61 – Elementary School in 1 School District (Public)\n• 62 – Intermediate/Middle Schools (Public)\n• 63 – Alternative Schools of Choice\n• 64 – Junior High Schools (Public)\n• 65 – K-12 Schools (Public)\n• 66 – High Schools (Public)\n• 67 – High Schools in 1 School District (Public)\n• 68 – Continuation High Schools\n• 69 – District Community Day Schools\n• 70 – Adult Education Centers\n• 98 – Regional Occupational Center/Program (ROC/P)" + }, + { + "original_column_name": "SOCType", + "column_name": "School Ownership Code Type", + "column_description": "The School Ownership Code Type is the text description of the type of school.", + "data_format": "text", + "value_description": "The School Ownership Code Type is the text description of the type of school." + }, + { + "original_column_name": "EdOpsCode", + "column_name": "Education Option Code", + "column_description": "The Education Option Code is a short text description of the type of education offered.", + "data_format": "text", + "value_description": "\n• ALTSOC – Alternative School of Choice\n• COMM – County Community School\n• COMMDAY – Community Day School\n• CON – Continuation School\n• JUV – Juvenile Court School\n• OPP – Opportunity School\n• YTH – Youth Authority School\n• SSS – State Special School\n• SPEC – Special Education School\n• TRAD – Traditional\n• ROP – Regional Occupational Program\n• HOMHOS – Home and Hospital\n• SPECON – District Consortia Special Education School" + }, + { + "original_column_name": "EdOpsName", + "column_name": "Educational Option Name", + "column_description": "Educational Option Name", + "data_format": "text", + "value_description": "The Educational Option Name is the long text description of the type of education being offered." + }, + { + "original_column_name": "EILCode", + "column_name": "Educational Instruction Level Code", + "column_description": "The Educational Instruction Level Code is a short text description of the institution's type relative to the grade range served.", + "data_format": "text", + "value_description": "• A – Adult\n• ELEM – Elementary\n• ELEMHIGH – Elementary-High Combination\n• HS – High School\n• INTMIDJR – Intermediate/Middle/Junior High\n• PS – Preschool\n• UG – Ungraded" + }, + { + "original_column_name": "EILName", + "column_name": "Educational Instruction Level Name ", + "column_description": "The Educational Instruction Level Name is the long text description of the institution’s type relative to the grade range served.", + "data_format": "text", + "value_description": "The Educational Instruction Level Name is the long text description of the institution’s type relative to the grade range served." + }, + { + "original_column_name": "GSoffered", + "column_name": "grade span offered", + "column_description": "The grade span offered is the lowest grade and the highest grade offered or supported by the school, district, or administrative authority. This field might differ from the grade span served as reported in the most recent certified California Longitudinal Pupil Achievement (CALPADS) Fall 1 data collection.", + "data_format": "text", + "value_description": "For example XYZ School might display the following data:\n\nGSoffered = P–Adult\n\nGSserved = K–12" + }, + { + "original_column_name": "GSserved", + "column_name": "grade span served.", + "column_description": "It is the lowest grade and the highest grade of student enrollment as reported in the most recent certified CALPADS Fall 1 data collection. Only K–12 enrollment is reported through CALPADS. This field may differ from the grade span offered.", + "data_format": "text", + "value_description": "commonsense evidence:\n\n1.     Only K–12 enrollment is reported through CALPADS\n\n2.     Note: Special programs at independent study, alternative education, and special education schools will often exceed the typical grade span for schools of that type" + }, + { + "original_column_name": "Virtual", + "column_name": "", + "column_description": "This field identifies the type of virtual instruction offered by the school. Virtual instruction is instruction in which students and teachers are separated by time and/or location, and interaction occurs via computers and/or telecommunications technologies. ", + "data_format": "text", + "value_description": "The field is coded as follows:\n\n·       F = Exclusively Virtual – The school has no physical building where students meet with each other or with teachers, all instruction is virtual.\n\n·       V = Primarily Virtual – The school focuses on a systematic program of virtual instruction but includes some physical meetings among students or with teachers.\n\n·       C = Primarily Classroom – The school offers virtual courses but virtual instruction is not the primary means of instruction.\n\n·       N = Not Virtual – The school does not offer any virtual instruction.\n\n·       P = Partial Virtual – The school offers some, but not all, instruction through virtual instruction. Note: This value was retired and replaced with the Primarily Virtual and Primarily Classroom values beginning with the 2016–17 school year." + }, + { + "original_column_name": "Magnet", + "column_name": "", + "column_description": "This field identifies whether a school is a magnet school and/or provides a magnet program. ", + "data_format": "integer", + "value_description": "The field is coded as follows:\n\n·       1 = Magnet - The school is a magnet school and/or offers a magnet program.\n\n·       0 = Not Magnet - The school is not a magnet school and/or does not offer a magnet program.\n\ncommonsense evidence:\n\nNote: Preschools and adult education centers do not contain a magnet school indicator." + }, + { + "original_column_name": "Latitude", + "column_name": "", + "column_description": "The angular distance (expressed in degrees) between the location of the school, district, or administrative authority and the equator measured north to south.", + "data_format": "real", + "value_description": "The angular distance (expressed in degrees) between the location of the school, district, or administrative authority and the equator measured north to south." + }, + { + "original_column_name": "Longitude", + "column_name": "", + "column_description": "The angular distance (expressed in degrees) between the location of the school, district, or administrative authority and the prime meridian (Greenwich, England) measured from west to east.", + "data_format": "real", + "value_description": "The angular distance (expressed in degrees) between the location of the school, district, or administrative authority and the prime meridian (Greenwich, England) measured from west to east." + }, + { + "original_column_name": "AdmFName1", + "column_name": "administrator's first name", + "column_description": "administrator's first name", + "data_format": "text", + "value_description": "The superintendent’s or principal’s first name.\n\ncommonsense evidence:\n\nOnly active and pending districts and schools will display administrator information, if applicable." + }, + { + "original_column_name": "AdmLName1", + "column_name": "administrator's last name", + "column_description": "administrator's last name", + "data_format": "text", + "value_description": "The superintendent’s or principal’s last name.\n\ncommonsense evidence:\nOnly active and pending districts and schools will display administrator information, if applicable." + }, + { + "original_column_name": "AdmEmail1", + "column_name": "administrator's email address", + "column_description": "administrator's email address", + "data_format": "text", + "value_description": "The superintendent’s or principal’s email address.\n\ncommonsense evidence:\n\nOnly active and pending districts and schools will display administrator information, if applicable." + }, + { + "original_column_name": "AdmFName2", + "column_name": "", + "column_description": "", + "data_format": "text", + "value_description": "SAME as 1" + }, + { + "original_column_name": "AdmLName2", + "column_name": "", + "column_description": "", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "AdmEmail2", + "column_name": "", + "column_description": "", + "data_format": "text", + "value_description": "" + }, + { + "original_column_name": "AdmFName3", + "column_name": "", + "column_description": "", + "data_format": "text", + "value_description": "not useful" + }, + { + "original_column_name": "AdmLName3", + "column_name": "", + "column_description": "", + "data_format": "text", + "value_description": "not useful" + }, + { + "original_column_name": "AdmEmail3", + "column_name": "", + "column_description": "", + "data_format": "text", + "value_description": "not useful" + }, + { + "original_column_name": "LastUpdate", + "column_name": "", + "column_description": "", + "data_format": "date", + "value_description": "when is this record updated last time" + } + ] +} +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/integer-ratio/codex-mcp/events/bird007.stderr b/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/events/bird007.stderr new file mode 100644 index 00000000..e69de29b diff --git a/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/records/bird007.json b/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/records/bird007.json new file mode 100644 index 00000000..494106f6 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/records/bird007.json @@ -0,0 +1,111 @@ +{ + "instance_id": "bird007", + "profile": "codex-mcp", + "model": "gpt-6.2-astra", + "status": "predicted", + "calls": [], + "prompt_sha256": "86fe6f1a9afcd6ba71b23966bcdc0db57dc0561037611d7762ff40173e3974b0", + "events_sha256": "6e56b0a973413e766a06e80384ad709fc8cff0abcac9cc68229b3de70d3b2543", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 152892, + "cached_input_tokens": 134144, + "cache_write_input_tokens": 0, + "output_tokens": 481, + "reasoning_output_tokens": 0 + } + ], + "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": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"_bBi-K8y6zSvMpU4yaPrzwkVjNWY82LW_lFiexU8jfM\", \"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": "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_4", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "_bBi-K8y6zSvMpU4yaPrzwkVjNWY82LW_lFiexU8jfM", + "sql": "SELECT\n 100.0 * f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) AS \"Percent (%) Eligible Free (K-12)\",\n f.\"District Code\"\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3);", + "expected_columns": [ + "Percent (%) Eligible Free (K-12)", + "District Code" + ] + }, + "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=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): Percent (%) Eligible Free (K-12)=float; District Code=int\nPercent (%) Eligible Free (K-12) | District Code\n--- | ---\n70.15113350125945 | 64857\nSQL: SELECT\n 100.0 * f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) AS \"Percent (%) Eligible Free (K-12)\",\n f.\"District Code\"\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3)\nLIMIT 1000" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "```sql\nSELECT\n 100.0 * f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) AS \"Percent (%) Eligible Free (K-12)\",\n f.\"District Code\"\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3)\nLIMIT 1000\n```", + "event_parse_errors": [], + "rows": 1, + "sql": "SELECT\n 100.0 * f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) AS \"Percent (%) Eligible Free (K-12)\",\n f.\"District Code\"\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3)\nLIMIT 1000", + "seconds": 24.72279074997641 +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/scores.json b/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/scores.json new file mode 100644 index 00000000..805446e4 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/scores.json @@ -0,0 +1,7 @@ +[ + { + "instance_id": "bird007", + "score": 1, + "status": "predicted" + } +] diff --git a/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/sql/bird007.sql b/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/sql/bird007.sql new file mode 100644 index 00000000..e6f764c8 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/sql/bird007.sql @@ -0,0 +1,7 @@ +SELECT + 100.0 * f."Free Meal Count (K-12)" / NULLIF(f."Enrollment (K-12)", 0) AS "Percent (%) Eligible Free (K-12)", + f."District Code" +FROM main.schools AS s +JOIN main.frpm AS f ON f.CDSCode = s.CDSCode +WHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3) +LIMIT 1000 diff --git a/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/status.json b/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/status.json new file mode 100644 index 00000000..81fa0690 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio/codex-mcp/status.json @@ -0,0 +1,4 @@ +{ + "status": "completed", + "wall_seconds": 24.72352016705554 +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio/comparison/comparison.json b/bench/accuracy/mcp-review-results/integer-ratio/comparison/comparison.json new file mode 100644 index 00000000..97fedb0b --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio/comparison/comparison.json @@ -0,0 +1,350 @@ +{ + "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-bird-full-context-validation-20261127/checkpoints/001/bird", + "manifest_sha256": "38183dca92fc36dd6b2ce180292bf2639e874b9a1f6ea059ee1fd04b2ef0d00e", + "scores_sha256": "f911002a97ae59d92643d3e5c8ef8dfa7fd952c1053c2fc28b6ae3361f0093eb", + "settings": { + "profiles": [ + { + "name": "codex-mcp", + "model": "gpt-6.2-astra", + "reasoning_effort": "high" + } + ], + "backend": "ChatGPT login -> Codex CLI -> production Lang2SQL MCP", + "revision": "0b6250ff917b23a2659dc96d722094ba7840778b", + "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": 500, + "selected_cases": 500, + "expected_cases": 500 + }, + "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" + } + }, + { + "path": "/Users/seyoung/workspace/benchmarks/codex-mcp-integer-ratio-20261127/bird-gpt-6.2-astra", + "manifest_sha256": "b63538f0ce2389d31b3a2f2b9a29db410cda268f069fa421441ac8133f6ec4d5", + "scores_sha256": "8cff960ea66b42bb4a9fbc18bac737a546799a067e25c1e368528c70dd758f57", + "settings": { + "profiles": [ + { + "name": "codex-mcp", + "model": "gpt-6.2-astra", + "reasoning_effort": "high" + } + ], + "backend": "ChatGPT login -> Codex CLI -> production Lang2SQL MCP", + "revision": "3bbfe6d0aae835b9caa01d9011a363764ec67c52", + "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": 1, + "selected_cases": 1, + "expected_cases": 1 + }, + "review_source": null, + "failure_selection": null, + "split": "all", + "concurrency": 1, + "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 -> 1": 1 + }, + "cases": [ + { + "input": { + "instance_id": "bird007", + "db": "california_schools", + "question": "What is the Percent (%) Eligible Free (K-12) in the school administered by an administrator whose first name is Alusine. List the district code of the school.", + "evidence": "K-12 free-meal eligibility percentage is K-12 free-meal recipients divided by K-12 enrollment, times 100." + }, + "transition": "0 -> 1", + "sql_diff": "--- before.sql\n+++ after.sql\n@@ -1,8 +1,7 @@\n SELECT\n- f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) * 100.0\n- AS \"Percent (%) Eligible Free (K-12)\",\n+ 100.0 * f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) AS \"Percent (%) Eligible Free (K-12)\",\n f.\"District Code\"\n-FROM schools AS s\n-JOIN frpm AS f ON f.CDSCode = s.CDSCode\n+FROM main.schools AS s\n+JOIN main.frpm AS f ON f.CDSCode = s.CDSCode\n WHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3)\n LIMIT 1000", + "before": { + "score": 0, + "record_sha256": "e163238dcab117dbcfb55b0cc1cb0224ca15a26ffcf8cb693b6234bad19f1a05", + "record": { + "instance_id": "bird007", + "profile": "codex-mcp", + "model": "gpt-6.2-astra", + "status": "predicted", + "calls": [], + "prompt_sha256": "86fe6f1a9afcd6ba71b23966bcdc0db57dc0561037611d7762ff40173e3974b0", + "events_sha256": "4f2ee6ed3ebf71e05a7a35621988ca1cccceba573de7cde90a9308480ba6d3cc", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 152863, + "cached_input_tokens": 134144, + "cache_write_input_tokens": 0, + "output_tokens": 460, + "reasoning_output_tokens": 0 + } + ], + "mcp_calls": [ + { + "id": "item_1", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"cSCTkmogjDUUqmAxVMXHmV4hwqknv48CFq11CGqnrYA\", \"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_2", + "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_3", + "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_4", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "cSCTkmogjDUUqmAxVMXHmV4hwqknv48CFq11CGqnrYA", + "sql": "SELECT\n f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) * 100.0\n AS \"Percent (%) Eligible Free (K-12)\",\n f.\"District Code\"\nFROM schools AS s\nJOIN frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3);" + }, + "result": { + "content": [ + { + "type": "text", + "text": "1 row(s):\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): Percent (%) Eligible Free (K-12)=float; District Code=int\nPercent (%) Eligible Free (K-12) | District Code\n--- | ---\n70.15113350125944 | 64857\nSQL: SELECT\n f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) * 100.0\n AS \"Percent (%) Eligible Free (K-12)\",\n f.\"District Code\"\nFROM schools AS s\nJOIN frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3)\nLIMIT 1000" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "```sql\nSELECT\n f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) * 100.0\n AS \"Percent (%) Eligible Free (K-12)\",\n f.\"District Code\"\nFROM schools AS s\nJOIN frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3)\nLIMIT 1000\n```", + "event_parse_errors": [], + "rows": 1, + "sql": "SELECT\n f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) * 100.0\n AS \"Percent (%) Eligible Free (K-12)\",\n f.\"District Code\"\nFROM schools AS s\nJOIN frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3)\nLIMIT 1000", + "seconds": 23.31159220810514 + }, + "result": { + "columns": [ + "Percent (%) Eligible Free (K-12)", + "District Code" + ], + "row_count": 1, + "preview": [ + [ + "70.15113350125944", + "64857" + ] + ], + "preview_truncated": false, + "csv_sha256": "8ab61c01e5f85fd720dc38101ffe75ef60096be52e9850619380293ef9bfb189" + } + }, + "after": { + "score": 1, + "record_sha256": "51e635d1bebe84b0517acb3478bcf37516b73615dc5eced897e100ad7edfeaa2", + "record": { + "instance_id": "bird007", + "profile": "codex-mcp", + "model": "gpt-6.2-astra", + "status": "predicted", + "calls": [], + "prompt_sha256": "86fe6f1a9afcd6ba71b23966bcdc0db57dc0561037611d7762ff40173e3974b0", + "events_sha256": "6e56b0a973413e766a06e80384ad709fc8cff0abcac9cc68229b3de70d3b2543", + "cli_exit_code": 0, + "cli_usage": [ + { + "input_tokens": 152892, + "cached_input_tokens": 134144, + "cache_write_input_tokens": 0, + "output_tokens": 481, + "reasoning_output_tokens": 0 + } + ], + "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": "resolve_business_terms", + "arguments": { + "terms": [] + }, + "result": { + "content": [ + { + "type": "text", + "text": "{\"definition_check_id\": \"_bBi-K8y6zSvMpU4yaPrzwkVjNWY82LW_lFiexU8jfM\", \"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": "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_4", + "type": "mcp_tool_call", + "server": "lang2sql", + "tool": "run_sql", + "arguments": { + "definition_check_id": "_bBi-K8y6zSvMpU4yaPrzwkVjNWY82LW_lFiexU8jfM", + "sql": "SELECT\n 100.0 * f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) AS \"Percent (%) Eligible Free (K-12)\",\n f.\"District Code\"\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3);", + "expected_columns": [ + "Percent (%) Eligible Free (K-12)", + "District Code" + ] + }, + "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=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): Percent (%) Eligible Free (K-12)=float; District Code=int\nPercent (%) Eligible Free (K-12) | District Code\n--- | ---\n70.15113350125945 | 64857\nSQL: SELECT\n 100.0 * f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) AS \"Percent (%) Eligible Free (K-12)\",\n f.\"District Code\"\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3)\nLIMIT 1000" + } + ], + "structured_content": null + }, + "error": null, + "status": "completed" + } + ], + "answer": "```sql\nSELECT\n 100.0 * f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) AS \"Percent (%) Eligible Free (K-12)\",\n f.\"District Code\"\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3)\nLIMIT 1000\n```", + "event_parse_errors": [], + "rows": 1, + "sql": "SELECT\n 100.0 * f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) AS \"Percent (%) Eligible Free (K-12)\",\n f.\"District Code\"\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3)\nLIMIT 1000", + "seconds": 24.72279074997641 + }, + "result": { + "columns": [ + "Percent (%) Eligible Free (K-12)", + "District Code" + ], + "row_count": 1, + "preview": [ + [ + "70.15113350125945", + "64857" + ] + ], + "preview_truncated": false, + "csv_sha256": "806f1760dd4ff2d5ef69449716826d1e85454095565b7af5c5b45155e09c5c6f" + } + } + } + ] +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio/comparison/index.html b/bench/accuracy/mcp-review-results/integer-ratio/comparison/index.html new file mode 100644 index 00000000..c9e28912 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio/comparison/index.html @@ -0,0 +1,315 @@ +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 -> 1": 1
+}
Provenance and settings
[
+  {
+    "path": "/Users/seyoung/workspace/benchmarks/codex-mcp-bird-full-context-validation-20261127/checkpoints/001/bird",
+    "manifest_sha256": "38183dca92fc36dd6b2ce180292bf2639e874b9a1f6ea059ee1fd04b2ef0d00e",
+    "scores_sha256": "f911002a97ae59d92643d3e5c8ef8dfa7fd952c1053c2fc28b6ae3361f0093eb",
+    "settings": {
+      "profiles": [
+        {
+          "name": "codex-mcp",
+          "model": "gpt-6.2-astra",
+          "reasoning_effort": "high"
+        }
+      ],
+      "backend": "ChatGPT login -> Codex CLI -> production Lang2SQL MCP",
+      "revision": "0b6250ff917b23a2659dc96d722094ba7840778b",
+      "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": 500,
+        "selected_cases": 500,
+        "expected_cases": 500
+      },
+      "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"
+    }
+  },
+  {
+    "path": "/Users/seyoung/workspace/benchmarks/codex-mcp-integer-ratio-20261127/bird-gpt-6.2-astra",
+    "manifest_sha256": "b63538f0ce2389d31b3a2f2b9a29db410cda268f069fa421441ac8133f6ec4d5",
+    "scores_sha256": "8cff960ea66b42bb4a9fbc18bac737a546799a067e25c1e368528c70dd758f57",
+    "settings": {
+      "profiles": [
+        {
+          "name": "codex-mcp",
+          "model": "gpt-6.2-astra",
+          "reasoning_effort": "high"
+        }
+      ],
+      "backend": "ChatGPT login -> Codex CLI -> production Lang2SQL MCP",
+      "revision": "3bbfe6d0aae835b9caa01d9011a363764ec67c52",
+      "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": 1,
+        "selected_cases": 1,
+        "expected_cases": 1
+      },
+      "review_source": null,
+      "failure_selection": null,
+      "split": "all",
+      "concurrency": 1,
+      "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"
+    }
+  }
+]
bird007: 0 -> 1
{
+  "instance_id": "bird007",
+  "db": "california_schools",
+  "question": "What is the Percent (%) Eligible Free (K-12) in the school administered by an administrator whose first name is Alusine. List the district code of the school.",
+  "evidence": "K-12 free-meal eligibility percentage is K-12 free-meal recipients divided by K-12 enrollment, times 100."
+}

SQL diff

--- before.sql
++++ after.sql
+@@ -1,8 +1,7 @@
+ SELECT
+-    f."Free Meal Count (K-12)" / NULLIF(f."Enrollment (K-12)", 0) * 100.0
+-        AS "Percent (%) Eligible Free (K-12)",
++    100.0 * f."Free Meal Count (K-12)" / NULLIF(f."Enrollment (K-12)", 0) AS "Percent (%) Eligible Free (K-12)",
+     f."District Code"
+-FROM schools AS s
+-JOIN frpm AS f ON f.CDSCode = s.CDSCode
++FROM main.schools AS s
++JOIN main.frpm AS f ON f.CDSCode = s.CDSCode
+ WHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3)
+ LIMIT 1000

before: score 0

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

Final SQL / answer

SELECT
+    f."Free Meal Count (K-12)" / NULLIF(f."Enrollment (K-12)", 0) * 100.0
+        AS "Percent (%) Eligible Free (K-12)",
+    f."District Code"
+FROM schools AS s
+JOIN frpm AS f ON f.CDSCode = s.CDSCode
+WHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3)
+LIMIT 1000

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

{
+  "columns": [
+    "Percent (%) Eligible Free (K-12)",
+    "District Code"
+  ],
+  "row_count": 1,
+  "preview": [
+    [
+      "70.15113350125944",
+      "64857"
+    ]
+  ],
+  "preview_truncated": false,
+  "csv_sha256": "8ab61c01e5f85fd720dc38101ffe75ef60096be52e9850619380293ef9bfb189"
+}
Every MCP call: arguments and results
[
+  {
+    "id": "item_1",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "resolve_business_terms",
+    "arguments": {
+      "terms": []
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "{\"definition_check_id\": \"cSCTkmogjDUUqmAxVMXHmV4hwqknv48CFq11CGqnrYA\", \"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_2",
+    "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_3",
+    "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_4",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "run_sql",
+    "arguments": {
+      "definition_check_id": "cSCTkmogjDUUqmAxVMXHmV4hwqknv48CFq11CGqnrYA",
+      "sql": "SELECT\n    f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) * 100.0\n        AS \"Percent (%) Eligible Free (K-12)\",\n    f.\"District Code\"\nFROM schools AS s\nJOIN frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3);"
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "1 row(s):\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): Percent (%) Eligible Free (K-12)=float; District Code=int\nPercent (%) Eligible Free (K-12) | District Code\n--- | ---\n70.15113350125944 | 64857\nSQL: SELECT\n    f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) * 100.0\n        AS \"Percent (%) Eligible Free (K-12)\",\n    f.\"District Code\"\nFROM schools AS s\nJOIN frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3)\nLIMIT 1000"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  }
+]

after: score 1

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

Final SQL / answer

SELECT
+    100.0 * f."Free Meal Count (K-12)" / NULLIF(f."Enrollment (K-12)", 0) AS "Percent (%) Eligible Free (K-12)",
+    f."District Code"
+FROM main.schools AS s
+JOIN main.frpm AS f ON f.CDSCode = s.CDSCode
+WHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3)
+LIMIT 1000

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

{
+  "columns": [
+    "Percent (%) Eligible Free (K-12)",
+    "District Code"
+  ],
+  "row_count": 1,
+  "preview": [
+    [
+      "70.15113350125945",
+      "64857"
+    ]
+  ],
+  "preview_truncated": false,
+  "csv_sha256": "806f1760dd4ff2d5ef69449716826d1e85454095565b7af5c5b45155e09c5c6f"
+}
Every MCP call: arguments and results
[
+  {
+    "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": "resolve_business_terms",
+    "arguments": {
+      "terms": []
+    },
+    "result": {
+      "content": [
+        {
+          "type": "text",
+          "text": "{\"definition_check_id\": \"_bBi-K8y6zSvMpU4yaPrzwkVjNWY82LW_lFiexU8jfM\", \"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": "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_4",
+    "type": "mcp_tool_call",
+    "server": "lang2sql",
+    "tool": "run_sql",
+    "arguments": {
+      "definition_check_id": "_bBi-K8y6zSvMpU4yaPrzwkVjNWY82LW_lFiexU8jfM",
+      "sql": "SELECT\n    100.0 * f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) AS \"Percent (%) Eligible Free (K-12)\",\n    f.\"District Code\"\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3);",
+      "expected_columns": [
+        "Percent (%) Eligible Free (K-12)",
+        "District Code"
+      ]
+    },
+    "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=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): Percent (%) Eligible Free (K-12)=float; District Code=int\nPercent (%) Eligible Free (K-12) | District Code\n--- | ---\n70.15113350125945 | 64857\nSQL: SELECT\n    100.0 * f.\"Free Meal Count (K-12)\" / NULLIF(f.\"Enrollment (K-12)\", 0) AS \"Percent (%) Eligible Free (K-12)\",\n    f.\"District Code\"\nFROM main.schools AS s\nJOIN main.frpm AS f ON f.CDSCode = s.CDSCode\nWHERE 'Alusine' IN (s.AdmFName1, s.AdmFName2, s.AdmFName3)\nLIMIT 1000"
+        }
+      ],
+      "structured_content": null
+    },
+    "error": null,
+    "status": "completed"
+  }
+]
\ No newline at end of file diff --git a/bench/accuracy/mcp-review-results/integer-ratio/manifest.json b/bench/accuracy/mcp-review-results/integer-ratio/manifest.json new file mode 100644 index 00000000..8d908fe7 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio/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": "bird007", + "db": "california_schools", + "question": "What is the Percent (%) Eligible Free (K-12) in the school administered by an administrator whose first name is Alusine. List the district code of the school.", + "evidence": "K-12 free-meal eligibility percentage is K-12 free-meal recipients divided by K-12 enrollment, times 100." + } + ], + "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/integer-ratio/protocol.json b/bench/accuracy/mcp-review-results/integer-ratio/protocol.json new file mode 100644 index 00000000..ce49fba8 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio/protocol.json @@ -0,0 +1,16 @@ +{ + "revision": "3bbfe6d0aae835b9caa01d9011a363764ec67c52", + "baseline": "/Users/seyoung/workspace/benchmarks/codex-mcp-bird-full-context-validation-20261127/checkpoints/001/bird", + "ids": [ + "bird007" + ], + "model": "gpt-6.2-astra", + "reasoning_effort": "high", + "expected_cases": 1, + "change": "Guarded integer_ratio_sql compiler added to normal/tool-only registries and shared Codex MCP allowlist. No user/system-prompt edits. No prior SQL, grade, counterfactual, reference or analyst hint supplied.", + "limits": [ + "One selected current failure, not full accuracy.", + "Model tool use must be checked; success without tool use is not evidence of compiler causality.", + "No unchanged retries." + ] +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio/settings.json b/bench/accuracy/mcp-review-results/integer-ratio/settings.json new file mode 100644 index 00000000..4fb02fc1 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio/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": "3bbfe6d0aae835b9caa01d9011a363764ec67c52", + "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": 1, + "selected_cases": 1, + "expected_cases": 1 + }, + "review_source": null, + "failure_selection": null, + "split": "all", + "concurrency": 1, + "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/integer-ratio/sha256.json b/bench/accuracy/mcp-review-results/integer-ratio/sha256.json new file mode 100644 index 00000000..0c43364b --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio/sha256.json @@ -0,0 +1,18 @@ +{ + "analysis.json": "f25bd136ededbbeb07ffc5419a4445d1b1a894eadf8ded9e34233c8c577237dd", + "codex-mcp/csv/bird007.csv": "806f1760dd4ff2d5ef69449716826d1e85454095565b7af5c5b45155e09c5c6f", + "codex-mcp/events/bird007.answer.txt": "90264b088fb0cc3fba48fe3675b54242fca65db91f217d1433ce59fe81d277e9", + "codex-mcp/events/bird007.jsonl": "6e56b0a973413e766a06e80384ad709fc8cff0abcac9cc68229b3de70d3b2543", + "codex-mcp/events/bird007.prompt.txt": "86fe6f1a9afcd6ba71b23966bcdc0db57dc0561037611d7762ff40173e3974b0", + "codex-mcp/events/bird007.stderr": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "codex-mcp/records/bird007.json": "51e635d1bebe84b0517acb3478bcf37516b73615dc5eced897e100ad7edfeaa2", + "codex-mcp/scores.json": "8cff960ea66b42bb4a9fbc18bac737a546799a067e25c1e368528c70dd758f57", + "codex-mcp/sql/bird007.sql": "174e68cdbf362259f3141e5115bc61f1d17799e8a5830ef2eff8cbe06992aa2d", + "codex-mcp/status.json": "0a678aa69e8f81893a17580fbdea547cc0c042ab271c03ed6e1a905504559105", + "comparison/comparison.json": "aad3843a0bfd72f253f171d5ba05277dead48cbc3b53ab54ecb8a01bd91318ab", + "comparison/index.html": "418c68aadae4ccf52807e7431faf257bfafcb2a4ccf803e22fb13c1f5f9b2906", + "manifest.json": "b63538f0ce2389d31b3a2f2b9a29db410cda268f069fa421441ac8133f6ec4d5", + "protocol.json": "c4cd2de24f10813dccc33f54a23170fc900b1509ee3754c3e518ebdb59b7762c", + "settings.json": "b898676f58a2243ce74f6d5e5c2808f372c41c03b91744cbcbbd51e37393832a", + "summary.json": "c2e70d4a98f94e810170577bdc4875048efc680796036987c763c95e565e03fd" +} diff --git a/bench/accuracy/mcp-review-results/integer-ratio/summary.json b/bench/accuracy/mcp-review-results/integer-ratio/summary.json new file mode 100644 index 00000000..6c4374a9 --- /dev/null +++ b/bench/accuracy/mcp-review-results/integer-ratio/summary.json @@ -0,0 +1,8 @@ +[ + { + "profile": "codex-mcp", + "correct": 1, + "total": 1, + "accuracy": 1.0 + } +] diff --git a/bench/oracle_view/codex_demo.py b/bench/oracle_view/codex_demo.py index c3f03965..3c95e231 100644 --- a/bench/oracle_view/codex_demo.py +++ b/bench/oracle_view/codex_demo.py @@ -9,7 +9,7 @@ import tempfile from pathlib import Path -READ_TOOLS = ["resolve_business_terms", "explore_schema", "run_sql", "calendar_interval_sql", "fixed_decimal_sql"] +READ_TOOLS = ["resolve_business_terms", "explore_schema", "run_sql", "calendar_interval_sql", "fixed_decimal_sql", "integer_ratio_sql"] def mcp_settings(server_args, *, tools=READ_TOOLS, extra_env=()): diff --git a/src/lang2sql/harness/system_prompt.py b/src/lang2sql/harness/system_prompt.py index e68e7e08..5fc6e0c5 100644 --- a/src/lang2sql/harness/system_prompt.py +++ b/src/lang2sql/harness/system_prompt.py @@ -26,7 +26,7 @@ - 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. Separate intermediate calculations from the final answer selection: compute the required groups, then apply the requested final ranking, filter or aggregation. Do not return all intermediate groups when the final request asks only for selected groups; retain detailed rows and ties when requested. - 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 rounding, not printf/text formatting. For SQLite rounded AVG/SUM of known fixed-scale decimals, when fixed_decimal_sql is available, verify source precision and use its integer-based compiler; inspect the returned statuses before answering. Do not invent missing input precision. 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. +- Preserve result types: a request for decimal places means numeric rounding, not printf/text formatting. For SQLite rounded AVG/SUM of known fixed-scale decimals, when fixed_decimal_sql is available, verify source precision and use its integer-based compiler; inspect the returned statuses before answering. Do not invent missing input precision. For SQLite ratios of exact integer quantities, when integer_ratio_sql is available, use its guarded compiler with the requested unit multiplier and inspect statuses; compute separately requested ratios before combining their results. 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. - Preserve the database's declared/default text collation unless the question or supplied definition explicitly requires a different one. Do not add COLLATE NOCASE, LOWER/UPPER sort keys, or other normalization merely to make ordering seem natural. For concatenated lists, order the aggregate inputs explicitly; sorting the final result rows does not order elements inside each string. Data verification: diff --git a/src/lang2sql/tenancy/tool_runtime.py b/src/lang2sql/tenancy/tool_runtime.py index fa54d220..5379028d 100644 --- a/src/lang2sql/tenancy/tool_runtime.py +++ b/src/lang2sql/tenancy/tool_runtime.py @@ -17,6 +17,7 @@ from ..tools.context_candidates import ContextCandidates from ..tools.explore_schema import ExploreSchema from ..tools.fixed_decimal_sql import FixedDecimalSQL +from ..tools.integer_ratio_sql import IntegerRatioSQL from ..tools.recall_memory import RecallMemory from ..tools.remember import Remember from ..tools.run_sql import RunSQL @@ -57,6 +58,7 @@ def build_tool_context( RunSQL(), CalendarIntervalSQL(), FixedDecimalSQL(), + IntegerRatioSQL(), ContextCandidates(), ExploreSchema(), SemanticFederationTool(), diff --git a/src/lang2sql/tools/__init__.py b/src/lang2sql/tools/__init__.py index 14734dec..48fecddc 100644 --- a/src/lang2sql/tools/__init__.py +++ b/src/lang2sql/tools/__init__.py @@ -19,6 +19,7 @@ from .explore_schema import ExploreSchema from .fixed_decimal_sql import FixedDecimalSQL from .ingest_doc import IngestDoc +from .integer_ratio_sql import IntegerRatioSQL from .org_setup import OrgSetupTool from .remember import Remember from .run_sql import RunSQL @@ -32,6 +33,7 @@ "ExploreSchema", "FixedDecimalSQL", "IngestDoc", + "IntegerRatioSQL", "OrgSetupTool", "Remember", "RunSQL", @@ -52,6 +54,7 @@ def build_default_tools( RunSQL(), CalendarIntervalSQL(), FixedDecimalSQL(), + IntegerRatioSQL(), ExploreSchema(), EnrichSchema(), SemanticFederationTool(), diff --git a/src/lang2sql/tools/integer_ratio_sql.py b/src/lang2sql/tools/integer_ratio_sql.py new file mode 100644 index 00000000..5734d94c --- /dev/null +++ b/src/lang2sql/tools/integer_ratio_sql.py @@ -0,0 +1,75 @@ +"""Compile integer ratios with exact scaling followed by one REAL division.""" + +from __future__ import annotations + +from ..core.types import ToolResult, ToolSpec +from .fixed_decimal_sql import _MAX_EXACT_INTEGER + + +def integer_ratio_ctes(multiplier: int) -> str: + """Consume ratio_input(group_id, numerator, denominator), without aggregation.""" + if type(multiplier) is not int or not 1 <= multiplier <= _MAX_EXACT_INTEGER: + raise ValueError(f"multiplier must be an integer from 1 to {_MAX_EXACT_INTEGER}") + bound = _MAX_EXACT_INTEGER // multiplier + return f"""ratio_checked AS ( + SELECT group_id, numerator, denominator, + CASE WHEN numerator IS NULL OR denominator IS NULL THEN 'null_input' + WHEN typeof(numerator) NOT IN ('integer', 'real') + OR typeof(denominator) NOT IN ('integer', 'real') THEN 'invalid_input' + WHEN numerator NOT BETWEEN {-bound} AND {bound} + OR denominator NOT BETWEEN {-_MAX_EXACT_INTEGER} AND {_MAX_EXACT_INTEGER} THEN 'overflow' + WHEN numerator <> CAST(numerator AS INTEGER) + OR denominator <> CAST(denominator AS INTEGER) THEN 'invalid_input' + WHEN denominator = 0 THEN 'zero_denominator' + ELSE 'ok' END AS status + FROM ratio_input +), ratio_result AS ( + SELECT group_id, numerator, denominator, status, + CASE WHEN status = 'ok' THEN + (CAST(numerator AS INTEGER) * {multiplier}) * 1.0 / CAST(denominator AS INTEGER) + END AS ratio_value + FROM ratio_checked +)""" + + +class IntegerRatioSQL: + @property + def spec(self) -> ToolSpec: + return ToolSpec( + name="integer_ratio_sql", + description=( + "Generate tested SQLite SQL for a ratio or percentage of exact integer quantities. " + "Scale the numerator exactly before one REAL division, avoiding integer division " + "and an extra rounding step from divide-then-scale. Accepts integral REAL values " + "within safe bounds; rejects fractional/text inputs rather than rounding them. " + "Returns CTEs to execute through run_sql; no business meaning or precision inferred." + ), + parameters={ + "type": "object", + "properties": { + "dialect": {"type": "string", "enum": ["sqlite"]}, + "multiplier": { + "type": "integer", "minimum": 1, "maximum": _MAX_EXACT_INTEGER, + "description": "Explicit requested scale: 1 for a fraction, 100 for percent. No default.", + }, + }, + "required": ["dialect", "multiplier"], + }, + ) + + async def run(self, args, ctx) -> ToolResult: + if set(args) != {"dialect", "multiplier"} or args["dialect"] != "sqlite": + raise ValueError("Require dialect=sqlite and multiplier") + ctes = integer_ratio_ctes(args["multiplier"]) + return ToolResult(call_id="", content=( + "SQLite only. Supply WITH ratio_input AS (your SELECT exposing group_id, numerator, " + "denominator), append these CTEs, and SELECT from ratio_result. Reserve ratio_* names. " + "One output row per input row, including failures; no grouping, filtering or deduplication. " + "Only exact integer quantities are supported, including REAL values that already equal " + "integers. Do not round or cast away fractional source data to satisfy this contract. " + "Inspect status: null_input, invalid_input, overflow and zero_denominator retain their " + "row with NULL ratio_value. For ok rows, integer scaling is exact within the shared " + "binary64 exact-integer bound; only the final division rounds to REAL. This is not an " + "exact decimal representation or a decimal-place rounding policy. Use the requested " + "numerator, denominator and units; this tool cannot validate those choices.\n\n" + ctes + )) diff --git a/tests/test_integer_ratio_sql.py b/tests/test_integer_ratio_sql.py new file mode 100644 index 00000000..c7a7e521 --- /dev/null +++ b/tests/test_integer_ratio_sql.py @@ -0,0 +1,67 @@ +"""Compiled SQL must agree with exact rational arithmetic within its contract.""" + +import random +import sqlite3 +from fractions import Fraction + +import pytest + +from lang2sql.tools.fixed_decimal_sql import _MAX_EXACT_INTEGER +from lang2sql.tools.integer_ratio_sql import IntegerRatioSQL, integer_ratio_ctes + + +def execute(rows, multiplier=100): + with sqlite3.connect(":memory:") as conn: + conn.execute("CREATE TABLE ratio_input(group_id, numerator, denominator)") + conn.executemany("INSERT INTO ratio_input VALUES (?, ?, ?)", rows) + return conn.execute("WITH " + integer_ratio_ctes(multiplier) + + " SELECT group_id, status, ratio_value FROM ratio_result").fetchall() + + +@pytest.mark.parametrize("multiplier", [1, 100, 10000, _MAX_EXACT_INTEGER]) +def test_ratios_match_fraction_without_intermediate_rounding(multiplier): + rng = random.Random(913) + bound = _MAX_EXACT_INTEGER // multiplier + rows = [] + for i in range(1000): + n = rng.randint(-bound, bound) + d = rng.randint(1, _MAX_EXACT_INTEGER) * (-1 if i % 2 else 1) + rows.append((i, float(n) if i % 3 else n, float(d) if i % 4 else d)) + result = execute(rows, multiplier) + assert all(status == "ok" and value == float(Fraction(int(rows[i][1]) * multiplier, int(rows[i][2]))) + for i, status, value in result) + + +def test_real_integral_counts_and_scaling_order(): + result = execute([(1, 1.0, 3.0), (2, -1, 3), (3, 0, -3)]) + assert result == [(1, "ok", float(Fraction(100, 3))), + (2, "ok", float(Fraction(-100, 3))), (3, "ok", 0.0)] + assert result[0][2] != 1.0 / 3.0 * 100.0 + + +def test_invalid_rows_are_retained_with_null_results(): + bound = _MAX_EXACT_INTEGER // 100 + rows = [(1, None, 3), (2, 1, None), (3, 1, 0), (4, "1", 3), + (5, 1.5, 3), (6, 1, 2.5), (7, bound + 1, 3), + (8, -(2**63), 1), (9, 1, 2**53), (10, float("inf"), 1), + (11, 1, b"3"), (12, bound, _MAX_EXACT_INTEGER)] + result = execute(rows) + assert [r[1] for r in result] == ["null_input", "null_input", "zero_denominator", + "invalid_input", "invalid_input", "invalid_input", "overflow", "overflow", + "overflow", "overflow", "invalid_input", "ok"] + assert all(r[2] is None for r in result[:-1]) + assert result[-1][2] == float(Fraction(bound * 100, _MAX_EXACT_INTEGER)) + + +@pytest.mark.parametrize("multiplier", [True, 0, -1, 1.5, "100", 2**53]) +def test_invalid_settings(multiplier): + with pytest.raises(ValueError): + integer_ratio_ctes(multiplier) + + +@pytest.mark.asyncio +async def test_tool_compiles_without_database_or_model(): + result = await IntegerRatioSQL().run({"dialect": "sqlite", "multiplier": 100}, None) + assert integer_ratio_ctes(100) in result.content + with pytest.raises(ValueError): + await IntegerRatioSQL().run({"dialect": "oracle", "multiplier": 100}, None) diff --git a/tests/test_integration.py b/tests/test_integration.py index 963a4288..acb2b070 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -29,6 +29,7 @@ def test_v1_tools_registered(): assert names == { "calendar_interval_sql", "fixed_decimal_sql", + "integer_ratio_sql", "run_sql", "explore_schema", "enrich_schema", diff --git a/tests/test_mcp.py b/tests/test_mcp.py index 9c2ab241..0d6f4eb7 100644 --- a/tests/test_mcp.py +++ b/tests/test_mcp.py @@ -73,6 +73,7 @@ async def test_stdio_schema_sql_memory_and_errors(tmp_path): "context_candidates", "calendar_interval_sql", "fixed_decimal_sql", + "integer_ratio_sql", "run_sql", "explore_schema", "term_custom", @@ -566,3 +567,22 @@ async def execute(self, sql, limit): assert any(e.action == 'run_sql_contract_failed' and 'expected=1' in e.detail['contract_error'] for e in events) finally: ctx.store.close() + + +@pytest.mark.asyncio +async def test_integer_ratio_compiler_executes_via_stdio(tmp_path): + from lang2sql.tools.integer_ratio_sql import integer_ratio_ctes + + async with connected(fixture_db(tmp_path), tmp_path / "metadata.db") as client: + compiled = await client.call_tool("integer_ratio_sql", {"dialect": "sqlite", "multiplier": 100}) + assert not compiled.isError + ctes = integer_ratio_ctes(100) + assert ctes in compiled.content[0].text + check = await client.call_tool("resolve_business_terms", {"terms": []}) + result = await client.call_tool("run_sql", { + "definition_check_id": json.loads(check.content[0].text)["definition_check_id"], + "sql": "WITH ratio_input AS (SELECT 1 AS group_id, 1.0 AS numerator, 3.0 AS denominator), " + + ctes + " SELECT status, ratio_value FROM ratio_result", + }) + assert not result.isError + assert "ok | 33.333333333333336" in result.content[0].text