Skip to content

Conversation

@cte
Copy link
Collaborator

@cte cte commented Feb 11, 2025

Description

https://www.loom.com/share/716d1895488a44d1b69a3bbc800e462d

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Checklist:

  • My code follows the patterns of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

Additional context

Related Issues

Reviewers


Important

Fix file revert behavior in abortTask() in Cline.ts to ensure changes are reverted correctly during task abortion, especially when streaming.

  • Behavior:
    • Fix file revert behavior in abortTask() in Cline.ts to ensure changes are reverted when a task is aborted.
    • Ensure revertChanges() is called if isStreaming and isEditing are true.
  • Logging:
    • Add logging in abortStream() to track cancellation reasons in Cline.ts.

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

@changeset-bot
Copy link

changeset-bot bot commented Feb 11, 2025

⚠️ No Changeset found

Latest commit: 6119cb1

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

const stream = this.attemptApiRequest(previousApiReqIndex) // yields only if the first chunk is successful, otherwise will allow the user to retry the request (most likely due to rate limit error, which gets thrown on the first chunk)
let assistantMessage = ""
let reasoningMessage = ""
this.isStreaming = true
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Taken from Cline's current main.

}
}
} finally {
this.isStreaming = false
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Taken from Cline's current main.

}

const abortStream = async (cancelReason: ClineApiReqCancelReason, streamingFailedMessage?: string) => {
console.log(`[Cline#abortStream] cancelReason = ${cancelReason}`)
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid using raw console.log for logging. Consider using a structured logging mechanism or an existing logger to ensure consistent and production-ready logs.

Suggested change
console.log(`[Cline#abortStream] cancelReason = ${cancelReason}`)
logger.info(`[Cline#abortStream] cancelReason = ${cancelReason}`)

}
}

async abortTask() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Given the fix for file revert on abort, please add (or update) unit/integration tests covering this abort behavior to ensure regressions are caught.

@cte cte merged commit d264bef into main Feb 11, 2025
6 checks passed
@cte cte deleted the cte/fix-diff-editor-revert-on-abort branch February 11, 2025 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants