Who fixes a wrong SQL-agent answer? Start by replaying it
Give the next owner the failed query, the original access scope and a test that tells them whether the fix worked.
A SQL agent gives a wrong number. Before editing its prompt, replay the question against the data the agent was allowed to see. If a human cannot compute the answer under those conditions, the data contract may be at fault. If the human can, compare the generated SQL with that reference. And if the reference itself is disputed, don’t use it to grade the agent until a metric owner settles what the question means. Alation’s Nov. 24 essay argues for routing fixes to the layer that caused the error. Here is a proposed handoff for teams that want to put that advice into practice.
Open one ticket that another owner can replay
Record the original question and answer, generated SQL and warehouse query ID if available, execution time and time zone, and the effective role and allowed tables. Add the expected number, who supplied it, and the metric definition in force at the time. Keep sensitive rows out of the ticket; attach an access-controlled replay or a small, sanitized fixture instead. Ask the incident lead to record three outcomes separately: can the role see enough data, does the approved reference match the definition, and does the agent match that reference on the same snapshot?
Route by the first failed check
Data-model owner: the answer is not available to the agent’s role. Hand over the approved objects, the missing field or relationship, and a reference query that demonstrates the gap. The owner can add a governed data path or document that the question should be declined; the acceptance test is a correct result under the intended role or an explicit refusal. In the real-estate evaluation we covered, maintainers reproduced all nine previously unavailable frozen answers after extending the marts. That checks the known cases, not generalization to an untouched holdout.
Agent owner: the reference works but the generated SQL disagrees. Give them both queries, a minimal set of rows that exposes the difference, and the first incorrect decision: for example, selecting project rows for a permit-level metric. Require the original case to pass and add a neighboring question that legitimately needs project grain, so the repair cannot pass by always choosing permits.
Metric or evaluation owner: the reference disagrees with the definition. Attach the old result, the candidate replacement, and the rule each query implements. In the BIRD-FanOut gold-query audit, §4 and Figure 5, training question 9279’s reference counted 404 rentals across 15 inactive customers. Counting distinct customers reduced the answer to 15; the subsequent review added the missing requirement that the rental had not been returned, reducing it to four. That is an audited reference case, not the paper’s illustrative shipping-fee example. Our benchmark coverage explains the wider audit. In production, have the metric owner sign off on both the counted entity and the qualifying filter, then version the reference and regrade affected runs before treating the incident as a model regression.
Close the ticket with the owner’s decision, a link to the change, and the replay result. If the answer was already distributed, record which consumers received it and which corrected result replaces it. Passing the replay closes this incident; passing fresh cases is a separate release check.
sources
comments · 0
- Snowflake Code Bundles are generally available. A bundle name doesn’t pin the evaluator.Nov 24, 2026
- Snowflake’s serverless App Runtime keeps the URL, not the SQL agent’s session stateNov 24, 2026
- Fabric’s F0 preview has no upfront compute charge. For SQL spend limits, check the billing category.Nov 24, 2026