Skip to content

fix: bind benchmark exports to actual MCP execution - #342

Open
seyoung4503 wants to merge 1 commit into
fix/sql-projection-precedencefrom
fix/codex-executed-sql-binding
Open

seyoung4503 wants to merge 1 commit into
fix/sql-projection-precedencefrom
fix/codex-executed-sql-binding

Conversation

@seyoung4503

Copy link
Copy Markdown
Collaborator

The benchmark accepted the submitted run_sql argument as execution evidence even when the MCP server's safety layer executed a rewritten query. For example, a request without LIMIT could be exported and graded without LIMIT even though the server executed LIMIT 1. A two-row fixture reproduced an export of two rows after only one row was executed.

Bind final-answer aliases to the successful server SQL: execution footer. Exact executed SQL remains valid; a submitted-query alias resolves to its actual rewrite. Formatting equivalence still uses the existing SQLite bytecode comparison, preserves literals, and binds to the executed query. Repeated aliases use the latest successful execution. A success-looking row header with no execution footer is rejected rather than treated as proof. Original answer text and raw events remain preserved alongside bound record.sql.

This changes provenance/export binding, not the official comparator, question, reference output, denominator, product prompt or model. It cannot award credit based on gold. No model evaluations were rerun for this change.

Validation:

  • Two tests failed before the fix: unbounded export after LIMIT1 execution; missing execution footer accepted.
  • New tests cover bounded result cardinality, formatting aliases, changed literals and repeated aliases. Existing real stdio MCP tests assert binding to the actual safety rewrite for populated and empty output-column-contract results.
  • Root tests: 299 passed, 1 skipped. Ruff and diff check passed. No CODE MAP generator exists.
  • Offline provenance replay of 152 saved predictions from completed integrated, previous-full-failure and review runs: zero rejected; two SQL texts rebound (local259, bird357); both native result sets unchanged. Existing accuracy is unchanged. Replay JSON and exact audit script are under bench/accuracy/diagnostics/executed-sql-binding/. Raw event hashes and changed-case database hashes verified; old attempts were not overwritten.

Reuses executed_sql, query_rows, existing raw-event capture and result exporter; no new production function. Runner net +5 lines; tests/docs net +57 lines, plus diagnostic artifacts. The server-side runtime remains unchanged. No merge.

Principle Result Evidence
Reuse O Existing provenance, bytecode, export and hashing paths
Cause scope O Pre-safety input vs actual-executed SQL mismatch only
Logging O Rewrite binding/missing-footer logs include tool call ID; case failure logs retain case ID
Error handling O Missing evidence fails; no silent fallback to unexecuted SQL
Environment N/A No new env/settings
Issue comments O No issue-number comments
Verification O Red reproduction; 299 passed/1 skipped; Ruff/diff; 152-record replay
Authorization O PR only, no merge
Call path O Final answer + MCP events -> executed_sql -> export_result -> unchanged official scorer
Sync/async O Existing synchronous provenance helper; no duplicate execution worker
Constants/deployment N/A No new runtime parameter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant