-
Notifications
You must be signed in to change notification settings - Fork 2.6k
refactor: align ask_followup_question tool with current patterns #6879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add early return for partial blocks with incomplete required params - Make follow_up parameter required and validate it properly - Add validation for empty suggestions array - Improve error messages to be more specific - Update prompt description to clarify follow_up is required - Align error handling with other tools (consecutiveMistakeCount, recordToolError) - Minor text improvements in prompt description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing my own code is like debugging in a mirror - everything looks backwards but the bugs are still mine.
| if (block.partial) { | ||
| // Early return if required parameter is not yet available | ||
| if (!question) { | ||
| return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good alignment with other tools' patterns. The early return for partial blocks when the question parameter is incomplete follows the established pattern nicely.
| cline.consecutiveMistakeCount++ | ||
| cline.recordToolError("ask_followup_question") | ||
| await cline.say("error", `Failed to parse follow_up suggestions: ${error.message}`) | ||
| pushToolResult(formatResponse.toolError(`Invalid follow_up XML format: ${error.message}`)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this error message specific enough? Consider adding guidance on the expected XML format, like: Invalid follow_up XML format: ${error.message}. Expected format: <suggest>text</suggest> or <suggest mode="mode-name">text</suggest>
| - follow_up: (required) A list of 2-4 suggested answers that logically follow from the question, ordered by priority or logical sequence. Each suggestion must: | ||
| 1. Be provided in its own <suggest> tag | ||
| 2. Be specific, actionable, and directly related to the completed task | ||
| 2. Be specific, actionable, and directly related to the question |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice clarification changing from "related to the completed task" to "related to the question". This makes the documentation more accurate.
This PR aligns the
ask_followup_questiontool implementation with the patterns used by other tools in the codebase.Changes Made
Tool Implementation (
askFollowupQuestionTool.ts)follow_upparameter required and added proper validationconsecutiveMistakeCountandrecordToolErrorPrompt Description (
ask-followup-question.ts)follow_upis a required parameterTesting
core/tools/__tests__- all 161 tests passingContext
This change was requested via Slack to ensure the
ask_followup_questiontool follows the same patterns as other tools likewriteToFileTool,switchModeTool, andattemptCompletionToolfor consistency and maintainability.Important
Refactor
ask_followup_questiontool for parameter validation, error handling, and documentation alignment with other tools.askFollowupQuestionTool.ts):questionparameter.follow_upparameter required with validation.follow_up.consecutiveMistakeCountandrecordToolError.ask-followup-question.ts):follow_upas required.core/tools/__tests__- all 161 tests passing.This description was created by
for edf3ca5. You can customize this summary. It will automatically update as commits are pushed.