-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fix file revert on abort #949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
| 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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}`) |
There was a problem hiding this comment.
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.
| console.log(`[Cline#abortStream] cancelReason = ${cancelReason}`) | |
| logger.info(`[Cline#abortStream] cancelReason = ${cancelReason}`) |
| } | ||
| } | ||
|
|
||
| async abortTask() { |
There was a problem hiding this comment.
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.
Description
https://www.loom.com/share/716d1895488a44d1b69a3bbc800e462d
Type of change
How Has This Been Tested?
Checklist:
Additional context
Related Issues
Reviewers
Important
Fix file revert behavior in
abortTask()inCline.tsto ensure changes are reverted correctly during task abortion, especially when streaming.abortTask()inCline.tsto ensure changes are reverted when a task is aborted.revertChanges()is called ifisStreamingandisEditingare true.abortStream()to track cancellation reasons inCline.ts.This description was created by
for 6119cb1. It will automatically update as commits are pushed.