Skip to content

Commit c04adc6

Browse files
author
ShayBC
committed
added error message back to the parent task in cases user stops, cancel or delete the subtask, to allow the parent task to resume and think how to continue
1 parent 2c81366 commit c04adc6

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/core/Cline.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -574,10 +574,7 @@ export class Cline {
574574

575575
try {
576576
// This adds the completion message to conversation history
577-
await this.say(
578-
"text",
579-
`new_task finished successfully! ${lastMessage ?? "Please continue to the next task."}`,
580-
)
577+
await this.say("text", `${lastMessage ?? "Please continue to the next task."}`)
581578

582579
await this.addToApiConversationHistory({
583580
role: "user",

src/core/webview/ClineProvider.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
223223
// remove the last cline instance from the stack (this is the finished sub task)
224224
await this.removeClineFromStack()
225225
// resume the last cline instance in the stack (if it exists - this is the 'parnt' calling task)
226-
this.getCurrentCline()?.resumePausedTask(lastMessage)
226+
this.getCurrentCline()?.resumePausedTask(`new_task finished successfully! ${lastMessage}`)
227227
} catch (error) {
228228
this.log(`Error in finishSubTask: ${error.message}`)
229229
throw error
@@ -925,6 +925,11 @@ export class ClineProvider implements vscode.WebviewViewProvider {
925925
case "clearTask":
926926
// newTask will start a new task with a given task text, while clear task resets the current session and allows for a new task to be started
927927
await this.removeClineFromStack()
928+
// resume previouse task with subtask failed error
929+
this.getCurrentCline()?.resumePausedTask(
930+
`new_task finished with an error!, it was stopped and canceled by the user.`,
931+
)
932+
928933
await this.postStateToWebview()
929934
break
930935
case "didShowAnnouncement":
@@ -2083,6 +2088,10 @@ export class ClineProvider implements vscode.WebviewViewProvider {
20832088
// remove task from stack if it's the current task
20842089
if (id === this.getCurrentCline()?.taskId) {
20852090
await this.removeClineWithIdFromStack(id)
2091+
// resume previouse task with subtask failed error
2092+
this.getCurrentCline()?.resumePausedTask(
2093+
`new_task finished with an error!, it was stopped and delted by the user.`,
2094+
)
20862095
}
20872096

20882097
// delete task from the task history state

0 commit comments

Comments
 (0)