You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR fixes the bug where analytics tool returns a lot of rows, which
results in huge token count. We do it by checking the number of
characters in the tool call, and if it is more than 50000 characters, we
send an error message rather than the rows and ask the ai to make more
focused queries.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* AI assistant shows friendlier, categorized error messages and captures
unexpected errors for diagnosis.
* UI now displays classifier-derived, user-friendly AI error text.
* **Bug Fixes & Improvements**
* Enforced a hard size budget for SQL query results and gracefully
handles oversized responses.
* Centralized safer database error messaging to avoid leaking internal
details.
* Strengthened AI guidance to prefer narrower queries, safer column
selection, and pairing GROUP BY with ORDER BY + LIMIT.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
captureError("unknown-clickhouse-error-for-query-not-clickhouse-error",newStackAssertionError("Unknown error from Clickhouse is not a Clickhouse error",{cause: error,query: query}));
captureError("unknown-clickhouse-error-for-query",newStackAssertionError(`Unknown Clickhouse error: code ${errorCode} not in safe or unsafe codes`,{cause: error,query: query}));
return`${DEFAULT_CLICKHOUSE_ERROR_MESSAGE}${!isKnown ? "\n\nThis error is not known and you should probably add it to the safe or unsafe codes in analytics/query/route.ts." : ""}\n\nAs you are in development mode, you can see the full error: ${errorCode}${message}`;
captureError("unknown-clickhouse-error-for-query-not-clickhouse-error",newStackAssertionError("Unknown error from Clickhouse is not a Clickhouse error",{cause: error,query: query}));
captureError("unknown-clickhouse-error-for-query",newStackAssertionError(`Unknown Clickhouse error: code ${errorCode} not in safe or unsafe codes`,{cause: error,query: query}));
return`${DEFAULT_CLICKHOUSE_ERROR_MESSAGE}${!isKnown ? "\n\nThis error is not known and you should probably add it to the safe or unsafe codes in clickhouse-errors.ts." : ""}\n\nAs you are in development mode, you can see the full error: ${errorCode}${message}`;
0 commit comments