[superlog] Log query failures at WARN in executeTimedQuery to prevent false-positive ERROR incidents#497
Open
superlog-app[bot] wants to merge 1 commit into
Conversation
… false-positive ERROR incidents
|
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 job-level logs were being emitted at ERROR severity when a single ClickHouse sub-query failed inside the AI agent's multi-query
execute_sqltool — even though the job itself completed successfully and generated insights.The
executeTimedQueryutility calledlogger.error("Query failed", ...)in its catch block, which calledrequestLogger.error()on the job's evlog wide-eventRequestLogger.evlogescalates the final wide-event severity to ERROR whenever.error()is called during the request scope. Theexecute_sqltool catches per-query errors gracefully (catch (err) { return { error, data: [] }; }), so the agent continues — but by that point the wide event is already marked ERROR, causing the job summary to emit at ERROR despitejob_status: "succeeded".The fix changes
logger.errortologger.warninexecuteTimedQuery's catch block. Since the error is always re-thrown, the caller decides severity: recoverable callers (the multi-querysqlTool) catch it and keep the job at INFO/WARN; fatal errors propagate to the job-level catch injobs.tswhich correctly callslogger.error(err)and setsjob_status: "failed". This matches the pattern infetch-context.tswhere pre-fetch query failures already userequestLogger.warn().Incident on Superlog
Was this PR helpful? Leave feedback — goes straight to the Superlog team.
Summary by cubic
Log query failures at WARN in
executeTimedQueryso recoverable sub-query errors don’t escalate job-wide logs to ERROR. Prevents false-positive ERROR incidents whenexecute_sqlhandles a failed sub-query and the job still succeeds.logger.errortologger.warninexecuteTimedQueryand rethrow the error so the caller decides severity.execute_sql) now keep jobs at INFO/WARN; fatal errors still surface as ERROR at the job level.fetch-context.tsbehavior and avoids false-positive incidents in Superlog.packages/ai/src/ai/tools/utils/query.ts.Written for commit db5aa8f. Summary will update on new commits.