Skip to content

Conversation

@bramburn
Copy link
Contributor

Context

A proof of concept of decoupling clineprovider file. It is a first in a series of additional changes in the code to decouple it to better manage the code. The next one would be dealing with the webview, and states.

Implementation

Screenshots

before after

How to Test

Get in Touch

🐛 fix(api): handle ClineStackManager errors during getCurrentTaskStack
  - Added a workaround for the interface mismatch between the API and ClineStackManager
  - Returns an empty array for getCurrentTaskStack to avoid errors, and clarifies the need for an async implementation.
```
@changeset-bot
Copy link

changeset-bot bot commented Mar 31, 2025

⚠️ No Changeset found

Latest commit: 124bcf5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

- interface mismatch workaround removed
- implemented async getCurrentTaskStack using provider
- updated interface to reflect async behavior
@bramburn bramburn changed the title Refactor/clineprovider/proof of concept Refactor clineprovider proof of concept Mar 31, 2025
const taskStack = await this.getCurrentTaskStack()
if (taskStack.length > 0) {
// We need to find the first task in the stack
// This is a simplification - in a real implementation, you might need to
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment confuses me. Is this not a "real implementation"?

* Adds a new Cline instance to the stack
* @param cline The Cline instance to add
*/
async addClineToStack(cline: Cline): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this method (and all the methods here) async?

Seems like it adds unecessary complexity for the code that uses this interface. Is there a good reason the interface needs to be async? It seems to just perform synchronous array operations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you have a point on there, I will re-review these. In the original clineProvider, the methods that were calling the addClineTostack and removeCline were already using async. I would have thought this is because the cline instances are still being processed because of the calls to the LLM still running the streams.

Thank you for the feedback, I'm trying to get better at contribution and get into SWE one day. I will rebuild it and run some test


async showTaskWithId(id: string) {
if (id !== this.getCurrentCline()?.taskId) {
const currentCline = await this.getCurrentCline()
Copy link
Contributor

Choose a reason for hiding this comment

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

There are loads of changes like this, which seem to be necessitated by the fact that getCurrentCline thas become async. But I don't understand what is driving that complexity.

@diarmidmackenzie
Copy link
Contributor

At a high level, I don't really understand the motivation here.

In the old code, you have the this.clineStack array. It's pushed to in exactly one place. And it's popped from in exactly one place.

You have replaced this array with a class ClineStackManager, with async access methods. The fact that the access methods are async (for no particular reason I can see) complicates life for the calling code, and I don't understand the benefits.

I'm all for removing complexity from ClineProvider.ts, but I don't see any significant pre-existing complexity here - an array, a single push and a single pop, so I don't see much to be gained by splitting that out into a separate class.

Overall ClineProvider seems to have got bigger, not smaller, as a result of these changes, which I think reflects that these changes add complexity, but without really delivering much in the way of simplification. elsewhere.

Perhaps I am missing something. Is there some future benefit to ClineStackManager access methods being async, rather than synchronous?

@hannesrudolph hannesrudolph moved this from New to PR [Pre Approval Review] in Roo Code Roadmap Apr 1, 2025
@hannesrudolph hannesrudolph moved this from PR [Pre Approval Review] to PR [Draft/WIP] in Roo Code Roadmap May 10, 2025
@hannesrudolph hannesrudolph moved this from New to PR [Draft/WIP] in Roo Code Roadmap May 20, 2025
@hannesrudolph hannesrudolph moved this from PR [Draft / In Progress] to TEMP in Roo Code Roadmap May 26, 2025
@daniel-lxs
Copy link
Member

Hey @bramburn,
Thank you for your contribution, We noticed this PR is stale and will be closed. If you plan to revisit this, please create an issue first as required by our issue-first approach before opening a new PR.

@daniel-lxs daniel-lxs closed this May 26, 2025
@github-project-automation github-project-automation bot moved this from PR [Draft/WIP] to Done in Roo Code Roadmap May 26, 2025
@github-project-automation github-project-automation bot moved this from TEMP to Done in Roo Code Roadmap May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants