Roo-Code/src/core/tools
Hannes Rudolph 4664955127
feat: add optional todos parameter to new_task tool with experimental setting (#6329) (#6775)
* feat: add optional todos parameter to new_task tool with experimental setting (#6329)

- Add optional todos parameter to new_task tool for hierarchical task planning
- Implement experimental setting to optionally require todos parameter
- Add clean state-based UI rendering to avoid spurious messages
- Export and reuse parseMarkdownChecklist function
- Add comprehensive test coverage for both optional and required modes
- Maintain full backward compatibility (todos optional by default)

* fix: update new_task tool example to include todos parameter

- Updated the example in tool-use.ts to show the todos parameter
- This prevents AI confusion about whether todos is a valid parameter
- The example now demonstrates the complete tool usage pattern

* fix: make new_task tool definition dynamic based on experimental setting

- Tool description now changes based on newTaskRequireTodos setting
- When disabled: shows todos as (optional)
- When enabled: shows todos as (required) with no mention of configuration
- Added tests to verify dynamic behavior
- Ensures AI models get unambiguous instructions based on current settings

* fix: add translations for newTaskRequireTodos experimental setting

- Added translations for all 17 supported languages
- Ensures consistent UI experience across all locales

* test: update snapshots for new_task tool example with todos parameter

- Updated 13 snapshot files to reflect the new tool-use example
- All tests now pass with the updated example format

* Update src/core/tools/newTaskTool.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: address PR review comments

- Replace any[] with TodoItem[] type in ExtensionStateContext.tsx for better type safety
- Remove redundant initialTodos parameter from startTask call in Task.ts (todos already set in constructor)
- Improve code clarity in newTaskTool.ts by checking provider reference early and reusing state

# Conflicts:
#	src/core/task/Task.ts
#	webview-ui/src/context/ExtensionStateContext.tsx

* fix: revert order of operations in startTask to fix integration test timeout

The change in order of operations (calling say() before postStateToWebview()) was causing the XML content file test to timeout. Reverting to the original order fixes the issue.

* fix: hide todos parameter from new_task tool prompt when experiment is disabled

- Modified getNewTaskDescription to completely omit todos parameter when experiment is off
- Updated tests to verify todos parameter is not shown at all when disabled
- Ensures tool prompt remains unchanged when experimental setting is disabled
- Maintains backward compatibility while providing cleaner prompt interface

* fix: update snapshots for new_task tool todos parameter

- Updated snapshots in add-custom-instructions.spec.ts
- Updated snapshots in system-prompt.spec.ts
- All tests now passing with the new todos parameter documentation

* feat: move newTaskRequireTodos from experimental to VSCode settings

- Added newTaskRequireTodos as a VSCode configuration property in src/package.json
- Added description in src/package.nls.json
- Updated newTaskTool.ts to read from VSCode configuration instead of experiments
- Removed NEW_TASK_REQUIRE_TODOS from experimental settings in src/shared/experiments.ts
- Removed newTaskRequireTodos from packages/types/src/experiment.ts
- Updated tests to use VSCode configuration mocking instead of experiments
- Removed references from experiments test file
- Maintains backward compatibility (defaults to false)

* fix: make new_task tool description dynamically reflect VSCode setting

- Updated new-task.ts to check args.settings instead of args.experiments
- Added newTaskRequireTodos to SystemPromptSettings interface
- Pass newTaskRequireTodos setting through Task.ts and generateSystemPrompt.ts
- Updated all related tests to use settings instead of experiments
- Fixed TypeScript errors in test files by adding newTaskRequireTodos property

This ensures the tool description correctly shows todos parameter as required/optional
based on the VSCode setting value, fixing the issue where Roo would try to use
new_task without the todos parameter when it was required.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Merge Resolver <merge-resolver@roo-code.com>
Co-authored-by: Roo Code <roomote@roocode.com>
2025-08-21 13:02:05 -07:00
..
__tests__ feat: add optional todos parameter to new_task tool with experimental setting (#6329) (#6775) 2025-08-21 13:02:05 -07:00
helpers feat(tools): add image support to read_file tool (#5172) 2025-07-28 23:23:33 -04:00
accessMcpResourceTool.ts fix access_mcp_resource fails to handle images correctly (#5254) 2025-07-02 23:50:15 -04:00
applyDiffTool.ts feat: Add experimental setting to prevent editor focus disruption (#6214) 2025-07-28 23:14:53 -04:00
askFollowupQuestionTool.ts Add optional mode suggestions to follow-up questions (#5200) 2025-06-27 16:26:17 -04:00
attemptCompletionTool.ts Task and TaskProvider event emitter cleanup + a few new events (#6606) 2025-08-02 11:12:44 -07:00
browserActionTool.ts Rename Cline to Task (#3352) 2025-05-08 12:47:50 -07:00
codebaseSearchTool.ts fix: Use cline.cwd as primary source for workspace path in codebaseSearchTool (#6902) 2025-08-14 18:17:14 -04:00
executeCommandTool.ts Fix terminal reuse logic (#7157) 2025-08-16 23:10:59 -07:00
fetchInstructionsTool.ts Rename Cline to Task (#3352) 2025-05-08 12:47:50 -07:00
insertContentTool.ts fix: show diff view before approval when PREVENT_FOCUS_DISRUPTION is disabled (#6386) 2025-07-29 17:52:30 -04:00
listCodeDefinitionNamesTool.ts Make listing tools respect auto-approve settings for outside of the workspace (#4682) 2025-06-13 23:12:31 -04:00
listFilesTool.ts Make listing tools respect auto-approve settings for outside of the workspace (#4682) 2025-06-13 23:12:31 -04:00
multiApplyDiffTool.ts fix: add type check before calling .match() on diffItem.content (#6905) (#6906) 2025-08-14 20:05:45 -04:00
newTaskTool.ts feat: add optional todos parameter to new_task tool with experimental setting (#6329) (#6775) 2025-08-21 13:02:05 -07:00
readFileTool.ts feat(tools): add image support to read_file tool (#5172) 2025-07-28 23:23:33 -04:00
searchAndReplaceTool.ts fix: show diff view before approval when PREVENT_FOCUS_DISRUPTION is disabled (#6386) 2025-07-29 17:52:30 -04:00
searchFilesTool.ts Adjust searching outside of the workspace to respect the auto-approve… (#4670) 2025-06-13 18:49:39 -04:00
simpleReadFileTool.ts feat: simple read_file tool for single-file-only models (#7222) 2025-08-19 10:57:57 -07:00
switchModeTool.ts Rename Cline to Task (#3352) 2025-05-08 12:47:50 -07:00
ToolRepetitionDetector.ts fix: correct tool repetition detector to not block first tool call when limit is 1 (#6836) 2025-08-11 17:36:30 -04:00
updateTodoListTool.ts feat: add optional todos parameter to new_task tool with experimental setting (#6329) (#6775) 2025-08-21 13:02:05 -07:00
useMcpToolTool.ts feat(mcp): improve mcp with McpExecution, make UX like terminal execute (#3485) 2025-06-12 00:46:07 -04:00
validateToolUse.ts Add a new @roo-code/types package and use it everywhere (#3912) 2025-05-26 12:06:45 -07:00
writeToFileTool.ts feat: Add experimental setting to prevent editor focus disruption (#6214) 2025-07-28 23:14:53 -04:00