Repository navigation
Warn when a result fills its LIMIT, explain invalid values (v1.9.2) - #22
Merged
Merged
Conversation
Testing the AI chat plugin with a smaller self-hosted model showed two gaps: - The model set LIMIT 100 by itself in most queries. The truncation notice only covered statements without LIMIT, so a result cut at an explicit 100 went unnoticed. The notice now also appears when the row count equals a LIMIT of 100 or more, and at the 10,000 row maximum, where it points to OFFSET. A smaller LIMIT is a deliberate top-N and stays quiet. The instructions now say LIMIT 100 is no better than none and prefer COUNT, SUM and GROUP BY. - A select value in the wrong case failed with "failed to convert value: invalid value", which names neither the column nor the cause. Those errors and "type mismatch" now get a hint on options and the date format, and count under the new reason invalid_value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
Testing the AI chat plugin with a smaller self-hosted model answered all seven test prompts correctly, but showed two gaps:
LIMIT 100: the model set it by itself in most queries. The truncation notice from 1.9.0 only covers statements withoutLIMIT, so a result cut at an explicit 100 goes unnoticed. With more than 100 matching rows, an answer like "these customers have no order" would be silently incomplete.failed to convert value: invalid value: a select value in the wrong case ('Inaktiv'instead of'inaktiv') fails with a message that names neither the column nor the cause. The model recovered throughget_schemahere, but the error gives it nothing to go on.What changes
Truncation notice (
truncationNotice())LIMITLIMIT 100or moreLIMIT 10000or higherLIMITbelow 100 (a deliberate top-N)The instructions and the
query_sqldescription now sayLIMIT 100is no better than none, useLIMIT 10000to read all rows, and preferCOUNT,SUMandGROUP BY.A false alarm is possible when a table has exactly as many rows as the limit. It costs one extra query and gives no wrong answer.
Hint on invalid values
failed to convert valueandtype mismatchnow get: "a value does not fit its column type. Select columns accept only existing options, spelled exactly (get_schema lists them); dates need the format YYYY-MM-DD". They count under the new reasoninvalid_value.execute_sql's description says the same up front.Version 1.9.2.
Verified against SeaTable 7.0.11
LIMIT 100on 150 rowsLIMIT 1000on 150 rowsORDER BY … LIMIT 3LIMITLIMIT 100 OFFSET 100,LIMIT 100, 100SET Status = 'Inaktiv'(option isinaktiv)invalid_valueSET Seit = '15.01.2026'2026-01-15worksSET Umsatz = 'abc'type mismatch+ hintSET Status = 'inaktiv'The 10,000 row maximum is covered by unit tests only; the local test table has 150 rows.
npm test(381), typecheck, lint and build pass.🤖 Generated with Claude Code