fix(todo): improve validation error messages to help model self-correct#3723
Open
sandikodev wants to merge 1 commit intoaws:mainfrom
Open
fix(todo): improve validation error messages to help model self-correct#3723sandikodev wants to merge 1 commit intoaws:mainfrom
sandikodev wants to merge 1 commit intoaws:mainfrom
Conversation
When the model sends invalid todo_list parameters (duplicate indices, mismatched task/index counts, or out-of-bounds indices), the error messages were terse and lacked context needed for the model to retry correctly. Improve all three validation error messages: - 'Insertion indices must be unique' → clarifies each task needs a distinct index - 'Must provide an index for every new task' → shows actual counts (N tasks, M indices) - 'Index N is out of bounds' → shows valid range and current list size for all operations This helps the model understand exactly what correction is needed without requiring a full retry from scratch. Fixes aws#3184
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.
Issue
Closes #3184
Problem
When the model sends invalid
todo_listparameters for large todo lists, the validation error messages were too terse for the model to self-correct:These messages don't give the model enough context to understand what correction is needed — especially the count mismatch and bounds errors.
Fix
Improve all three validation error messages with actionable context:
Insertion indices must be uniqueInsertion indices must be unique — each task must have a distinct indexMust provide an index for every new taskMust provide an index for every new task — got 5 tasks but 3 indicesIndex 44 is out of bounds for length 43,Index 44 is out of bounds — valid insertion indices are 0..=43 (current list has 43 tasks)The same improvement is applied to
CompleteandRemoveoperations.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.