Skip to content

Clean up the way we compute the current diff strategy#2049

Merged
mrubens merged 2 commits intomainfrom
cte/diff-strategy-refactor
Mar 30, 2025
Merged

Clean up the way we compute the current diff strategy#2049
mrubens merged 2 commits intomainfrom
cte/diff-strategy-refactor

Conversation

@cte
Copy link
Collaborator

@cte cte commented Mar 28, 2025

Context

While working with configuring Roo Code's diff strategy for evals runs I kept getting confused about how we determine the current diff strategy. I kind of expected a single settings key (like diffStrategy) typed as a string literal union (like "unified" | "multi_search_and_replace" | "search_and_replace" | ...).

In reality we have to check multiple flags that are not mutually exclusive and the order in which we check matters.

For now, I consolidated this logic to a single place, but in the future we might want to migrate this setting.

Implementation

Screenshots

before after

How to Test

Get in Touch


Important

Consolidates diff strategy logic into a single function, updates related tests and configurations, and renames experiment IDs for clarity.

  • Behavior:
    • Consolidates diff strategy logic into getDiffStrategy() in DiffStrategy.ts.
    • Updates updateDiffStrategy() in Cline.ts to use new logic.
    • Adjusts ClineProvider.ts to use consolidated diff strategy logic.
  • Experiments:
    • Renames experiment IDs in experiments.ts to DIFF_STRATEGY_UNIFIED, DIFF_STRATEGY_MULTI_SEARCH_AND_REPLACE, and DIFF_STRATEGY_SEARCH_AND_REPLACE.
    • Updates experiment handling in AdvancedSettings.tsx and system.test.ts.
  • Tests:
    • Updates Cline.test.ts to reflect new diff strategy logic.
    • Adjusts system.test.ts to use updated experiment IDs.
  • Misc:
    • Adds TODO comment in CustomModesManager.ts about async methods in constructor.

This description was created by Ellipsis for 81f80d1. It will automatically update as commits are pushed.

@changeset-bot
Copy link

changeset-bot bot commented Mar 28, 2025

🦋 Changeset detected

Latest commit: 81f80d1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
roo-cline Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 28, 2025
@dosubot dosubot bot added the Enhancement New feature or request label Mar 28, 2025
Copy link
Collaborator

@mrubens mrubens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think we should change this to be a single key and default to multidiff. Maybe now is the time?

@cte
Copy link
Collaborator Author

cte commented Mar 28, 2025

I do think we should change this to be a single key and default to multidiff. Maybe now is the time?

I can take a crack at it.

teddyOOXX pushed a commit to teddyOOXX/Roo-Code that referenced this pull request Mar 28, 2025
…CodeInc#2049)

* Fixed problem with “win+shift+a” shortcut not working in Windows

* fix package-lock.json

* Revert "fix package-lock.json"

This reverts commit 1ffdfef4f39e6ff7f47246aba7446fad0bc2d483.
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 30, 2025
@mrubens mrubens merged commit 2303f67 into main Mar 30, 2025
14 checks passed
@mrubens mrubens deleted the cte/diff-strategy-refactor branch March 30, 2025 06:08
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Mar 30, 2025
cte added a commit that referenced this pull request Mar 30, 2025
* Clean up the way we compute the current diff strategy

* Add changeset
cte added a commit that referenced this pull request Mar 30, 2025
* Parallel tasks

* Handle null [x]ModelInfo types, recover from settings schema parse errors (#2064)

* Require exactly node v20.18.1 (#2065)

* Get rid of runner and all CJS stuff

* Add an activation command for other extensions (#2073)

Since VS Code provides no actionEvents that trigger when a specific
extension activates, extensions can't activate only once Roo is
activated and ready.

This commit introduces a new roo-cline.activationCompleted command
and fires it at the very end of extension activation. Other
extensions that use Roo's exported APIs can now activate when they
see this event.

Co-authored-by: Greg Taylor <gregtaylor@netflix.com>

* Update bug_report.yml (#1994)

* Update bug_report.yml

* Update bug_report.yml

---------

Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>

* Fix mention file name is not fully displayed (#2026)

Fixed path leading character handling to preserve language characters and remove specific punctuation marks

* In-Editor Browser Improvements (#1601)

* Browser Automation Improvements
* Added multi-tab remote Chrome support
* Added support for hover
* Properly caching remote browser host in global state
* Cleanup functions

* Updated for changes after merge

* Added www. exception for common tabs

* Update src/core/webview/ClineProvider.ts

* Revert README changes

---------

Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>

* Add missing awaits on refactored tools (#2078)

* More progress

* Added Gemini 2.5 Pro model to GCP Vertex AI Provider (#2079)

* More progress

* Display info about partial reads in chat row (#2080)

* More progress

* Update contributors list (#2023)

docs: update contributors list [skip ci]

Co-authored-by: mrubens <mrubens@users.noreply.github.com>

* More progress

* Handle multiple API pages worth of contributors (#2088)

* Update contributors list (#2089)

docs: update contributors list [skip ci]

Co-authored-by: mrubens <mrubens@users.noreply.github.com>

* Refactor/cline.ts/list files (#2067)

* "Refactor list_files tool to separate module (#2057)"

* Await

---------

Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>

* Remove switch from tools (#2091)

* HandleError returns a promise

* Remove unnecessary switch from tools

* Fix a type in the listFiles tool (#2092)

* Move write_to_file to a tool file (#2093)

* Move apply_diff to a tool file (#2094)

* Move insert_content to a tool file (#2095)

* Move search_and_replace to a tool file (#2096)

* Move list_code_definition_names to a tool file (#2097)

* Move search_files to a tool file (#2098)

* Move browser_action to a tool file (#2099)

* Move execute_command to a tool file (#2100)

* Move use_mcp_tool and access_mcp_resource to tool files (#2101)

* Move new_task, switch_mode, attempt_completion, and ask_followup_question to tool files (#2102)

* Do a little code cleanup now that tools are refactored out (#2103)

* Clean up the way we compute the current diff strategy (#2049)

* Clean up the way we compute the current diff strategy

* Add changeset

* i18n Add translations for task pinning and unpinning (#2109)

Signed-off-by: feifei <liuyansheng1121@gmail.com>

* Remove the ask promise error (#2107)

* Remove the ask promise error

* Send start_time along with checkpoints and use it to position in the messages

* Link to the settings page from the auto approve toolbar (#2111)

* Link to provider docs from the API options (#2112)

* Revert "Remove the ask promise error" (#2117)

Revert "Remove the ask promise error (#2107)"

This reverts commit 712ca71.

* Parse the retry out of the gemini 429 response (#2118)

* Fix Gemini command escaping (#2120)

* Fix switching profiles to ensure only the selected profile is switche… (#2119)

Fix switching profiles to ensure only the selected profile is switched for all modes, and optimize certain i18n keys.

Signed-off-by: feifei <liuyansheng1121@gmail.com>

* Tweaks to support prompt line number format (#2121)

* Remove the ask promise error (#2123)

* Stronger typing

* Added Gemini 2.5 Pro model to GCP Vertex AI Provider (#2079)

* Display info about partial reads in chat row (#2080)

* Update contributors list (#2023)

docs: update contributors list [skip ci]

Co-authored-by: mrubens <mrubens@users.noreply.github.com>

* Handle multiple API pages worth of contributors (#2088)

* Update contributors list (#2089)

docs: update contributors list [skip ci]

Co-authored-by: mrubens <mrubens@users.noreply.github.com>

* Refactor/cline.ts/list files (#2067)

* "Refactor list_files tool to separate module (#2057)"

* Await

---------

Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>

* Remove switch from tools (#2091)

* HandleError returns a promise

* Remove unnecessary switch from tools

* Fix a type in the listFiles tool (#2092)

* Move write_to_file to a tool file (#2093)

* Move apply_diff to a tool file (#2094)

* Move insert_content to a tool file (#2095)

* Move search_and_replace to a tool file (#2096)

* Move list_code_definition_names to a tool file (#2097)

* Move search_files to a tool file (#2098)

* Move browser_action to a tool file (#2099)

* Move execute_command to a tool file (#2100)

* Move use_mcp_tool and access_mcp_resource to tool files (#2101)

* Move new_task, switch_mode, attempt_completion, and ask_followup_question to tool files (#2102)

* Do a little code cleanup now that tools are refactored out (#2103)

* Clean up the way we compute the current diff strategy (#2049)

* Clean up the way we compute the current diff strategy

* Add changeset

* i18n Add translations for task pinning and unpinning (#2109)

Signed-off-by: feifei <liuyansheng1121@gmail.com>

* Remove the ask promise error (#2107)

* Remove the ask promise error

* Send start_time along with checkpoints and use it to position in the messages

* Link to the settings page from the auto approve toolbar (#2111)

* Link to provider docs from the API options (#2112)

* Revert "Remove the ask promise error" (#2117)

Revert "Remove the ask promise error (#2107)"

This reverts commit 712ca71.

* Parse the retry out of the gemini 429 response (#2118)

* Fix Gemini command escaping (#2120)

* Fix switching profiles to ensure only the selected profile is switche… (#2119)

Fix switching profiles to ensure only the selected profile is switched for all modes, and optimize certain i18n keys.

Signed-off-by: feifei <liuyansheng1121@gmail.com>

* Tweaks to support prompt line number format (#2121)

* Remove the ask promise error (#2123)

* Pass along pid and ppid

* Revert "Remove the ask promise error" (#2126)

Revert "Remove the ask promise error (#2123)"

This reverts commit b788aa1.

---------

Signed-off-by: feifei <liuyansheng1121@gmail.com>
Co-authored-by: Greg Taylor <gtaylor@users.noreply.github.com>
Co-authored-by: Greg Taylor <gregtaylor@netflix.com>
Co-authored-by: Hannes Rudolph <hrudolph@gmail.com>
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
Co-authored-by: aheizi <aheizi@outlook.com>
Co-authored-by: Afshawn Lotfi <6283745+afshawnlotfi@users.noreply.github.com>
Co-authored-by: Nico Bihan <nicolas.bihan@wellsky.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Bhavesh Ramburn <nitrogen@gmail.com>
Co-authored-by: feifei <46489071+feifei325@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants