Skip to content

Commit 38bfb52

Browse files
kulvirgitclaudeanandgupta42
authored
fix: sql_analyze reports "unknown error" for successful analyses (AI-5975) (#426)
sql.analyze returned success:false when it found lint/semantic/safety issues, causing telemetry to log ~4,000 false "unknown error" failures per day. Finding issues IS a successful analysis. - Change success flag to true when analysis completes without exceptions - Surface actual error messages to metadata.error so telemetry can distinguish real failures from successful analyses Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: anandgupta42 <93243293+anandgupta42@users.noreply.github.com>
1 parent 8e11c7f commit 38bfb52

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/opencode/src/altimate/native/sql/register.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ register("sql.analyze", async (params) => {
7575
}
7676

7777
return {
78-
success: issues.length === 0,
78+
success: true,
7979
issues,
8080
issue_count: issues.length,
8181
confidence: "high",

packages/opencode/src/altimate/tools/sql-analyze.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,20 @@ export const SqlAnalyzeTool = Tool.define("sql_analyze", {
2222
})
2323

2424
return {
25-
title: `Analyze: ${result.success ? `${result.issue_count} issue${result.issue_count !== 1 ? "s" : ""}` : "PARSE ERROR"} [${result.confidence}]`,
25+
title: `Analyze: ${result.error ? "PARSE ERROR" : `${result.issue_count} issue${result.issue_count !== 1 ? "s" : ""}`} [${result.confidence}]`,
2626
metadata: {
2727
success: result.success,
2828
issueCount: result.issue_count,
2929
confidence: result.confidence,
30+
...(result.error && { error: result.error }),
3031
},
3132
output: formatAnalysis(result),
3233
}
3334
} catch (e) {
3435
const msg = e instanceof Error ? e.message : String(e)
3536
return {
3637
title: "Analyze: ERROR",
37-
metadata: { success: false, issueCount: 0, confidence: "unknown" },
38+
metadata: { success: false, issueCount: 0, confidence: "unknown", error: msg },
3839
output: `Failed to analyze SQL: ${msg}\n\nCheck your connection configuration and try again.`,
3940
}
4041
}

0 commit comments

Comments
 (0)