[superlog] Log SQL tool query failures as WARN instead of ERROR#500
Open
superlog-app[bot] wants to merge 1 commit into
Open
[superlog] Log SQL tool query failures as WARN instead of ERROR#500superlog-app[bot] wants to merge 1 commit into
superlog-app[bot] wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
The latest updates on your projects. Learn more about Unkey Deploy
|
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Insights generation jobs that succeed are being logged at ERROR severity, creating false-positive incidents. Both sampled occurrences show
job_status: "succeeded"andrun_status: "succeeded"alongsidelevel: "error"— the jobs completed and produced insights.The insights service wires the AI package's tool logger to the insights job's wide-event logger (
RequestLogger). WhenexecuteTimedQuerycatches a ClickHouse query failure inside theexecute_sqlAI tool, it callsrequestLogger.error()on the job logger. In evlog, this permanently upgrades the wide event's severity to ERROR. Even though the AI agent recovers from the query failure and completes successfully, the finallogger.emit({ job_status: "succeeded" })fires at ERROR level.The fix changes
logger.error()tologger.warn()for SQL query failures inexecuteTimedQuery. Tool-level query failures are recoverable — the AI agent catches the error and can try a different approach or proceed — so WARN is the correct severity. All diagnostic fields (SQL, execution time, error message) remain captured. Jobs that actually fail at the job level (thrown errors inprocessInsightsJob) continue to emit at ERROR via the explicitlogger.error(err)call in the failure path.Alternative: a per-context severity override could be added to
createToolLoggerso API and insights contexts can configure tool failure severity independently. This one-line change is the most targeted fix with the least blast radius.Incident on Superlog
Was this PR helpful? Leave feedback — goes straight to the Superlog team.
Summary by cubic
Downgraded SQL tool query failures from ERROR to WARN in
executeTimedQueryto prevent false-positive incidents on successful insight jobs. Diagnostics are unchanged; real job failures still log as ERROR.logger.error("Query failed", ...)tologger.warn(...)inpackages/ai/src/ai/tools/utils/query.ts, avoiding job-wide ERROR severity when the agent recovers.Written for commit 97cc2a6. Summary will update on new commits.