fix: use parsed arguments instead of toolcall.arguments#9168
fix: use parsed arguments instead of toolcall.arguments#9168uinstinct wants to merge 1 commit intocontinuedev:mainfrom
Conversation
Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
1 similar comment
Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
There was a problem hiding this comment.
@uinstinct if I understand the problem correctly, this happens when the tool call state ends up in an invalid place because the model hits max tokens or similar. This fix would only work because we use incremental JSON parsing to create parsedArgs. But I think if it ends up invalid we should throw an error, since e.g. the file being created will be truncated
I think in that case it should throw an error that the tool call args were invalid, basically a try again with smaller/more targeted output message
Yes, the error now shows the correct missing argument. Although I think resolving the error would require increasing max tokens because the agent does not send the contents argument in any case. Should we modify the createnewfile tool to support creating files without contents? (and then maybe edittool can be used to add contents to the new file) |
This makes sense. Since
I think a good solution is to throw an error instructing the model to try again with smaller output. If we take that route I guess the main question is how do we know if this was caused by max token limit being reached? Here are 2 ideas
I think the best solution is here in We should not safe parse args here, we should detect invalid JSON and throw a sensible error which explains that this often happens when huge args are passed, try smaller ones.
Thoughts on just doing the first approach for now? something to keep in mind is that the incremental args parsing is just so that we can display tool calls as they stream in, so all that should stay in place, but if they end up invalid it makes sense to throw |
Tried this now. In this approach, in most of the cases, the arguments from the model are valid JSON but have the missing parameter - which can only be detected during tool call. Hence, I think throwing errors while parsing would not be useful.
In this case, I think we should only narrow it down to a specific models where there is a chance of huge args being sent to the tool call. Otherwise, if the tool call argument is missing, the model should avoid retrying and add that first. |


Description
When createnewfile is sent without the
contentsparameter, the error shows that "filepathis missing". This PR fixes that by showing the correct missing parameter.resolves CON-5065
AI Code Review
@continue-reviewChecklist
Screen recording or screenshot
[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See this PR as a good example. ]
Tests
[ What tests were added or updated to ensure the changes work as expected? ]
Summary by cubic
Fixes incorrect missing-field errors for createnewfile by sending parsed arguments to core, so validation reports the right parameter. Addresses CON-5065.
Written for commit 6222d35. Summary will update automatically on new commits.