Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Aug 9, 2025

This PR aligns the ask_followup_question tool implementation with the patterns used by other tools in the codebase.

Changes Made

Tool Implementation (askFollowupQuestionTool.ts)

  • ✅ Added early return for partial blocks when required parameters are incomplete
  • ✅ Made follow_up parameter required and added proper validation
  • ✅ Added validation to ensure at least one suggestion is provided
  • ✅ Improved error messages to be more specific and actionable
  • ✅ Aligned error handling with other tools using consecutiveMistakeCount and recordToolError

Prompt Description (ask-followup-question.ts)

  • ✅ Updated documentation to clarify that follow_up is a required parameter
  • ✅ Minor text improvements for clarity

Testing

  • All existing tests pass without modification
  • Ran full test suite for core/tools/__tests__ - all 161 tests passing
  • Linting and type checking pass successfully

Context

This change was requested via Slack to ensure the ask_followup_question tool follows the same patterns as other tools like writeToFileTool, switchModeTool, and attemptCompletionTool for consistency and maintainability.


Important

Refactor ask_followup_question tool for parameter validation, error handling, and documentation alignment with other tools.

  • Tool Implementation (askFollowupQuestionTool.ts):
    • Added early return for incomplete question parameter.
    • Made follow_up parameter required with validation.
    • Ensured at least one suggestion is provided in follow_up.
    • Improved error messages and aligned error handling with consecutiveMistakeCount and recordToolError.
  • Prompt Description (ask-followup-question.ts):
    • Updated documentation to specify follow_up as required.
    • Minor text improvements for clarity.
  • Testing:
    • All existing tests pass without modification.
    • Ran full test suite for core/tools/__tests__ - all 161 tests passing.
    • Linting and type checking pass successfully.

This description was created by Ellipsis for edf3ca5. You can customize this summary. It will automatically update as commits are pushed.

- 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
@roomote roomote bot requested review from cte, jr and mrubens as code owners August 9, 2025 17:56
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. documentation Improvements or additions to documentation labels Aug 9, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 9, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Aug 9, 2025
Copy link
Contributor Author

@roomote roomote bot left a 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
Copy link
Contributor Author

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}`))
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@hannesrudolph hannesrudolph deleted the feature/align-ask-followup-question-patterns branch August 9, 2025 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants