Skip to content

Commit 7870b02

Browse files
KJ7LNWEric Wheelerdaniel-lxs
authored andcommitted
fix: Remove misleading task resumption message (RooCodeInc#5851)
Co-authored-by: Eric Wheeler <[email protected]> Co-authored-by: Daniel Riccio <[email protected]>
1 parent 2e2a8bd commit 7870b02

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

src/core/task/Task.ts

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,32 +1170,26 @@ export class Task extends EventEmitter<TaskEvents> {
11701170
return "just now"
11711171
})()
11721172

1173-
const lastTaskResumptionIndex = newUserContent.findIndex(
1174-
(x) => x.type === "text" && x.text.startsWith("[TASK RESUMPTION]"),
1175-
)
1176-
if (lastTaskResumptionIndex !== -1) {
1177-
newUserContent.splice(lastTaskResumptionIndex, newUserContent.length - lastTaskResumptionIndex)
1173+
if (responseText) {
1174+
newUserContent.push({
1175+
type: "text",
1176+
text: `\n\nNew instructions for task continuation:\n<user_message>\n${responseText}\n</user_message>`,
1177+
})
11781178
}
11791179

1180-
const wasRecent = lastClineMessage?.ts && Date.now() - lastClineMessage.ts < 30_000
1181-
1182-
newUserContent.push({
1183-
type: "text",
1184-
text:
1185-
`[TASK RESUMPTION] This task was interrupted ${agoText}. It may or may not be complete, so please reassess the task context. Be aware that the project state may have changed since then. If the task has not been completed, retry the last step before interruption and proceed with completing the task.\n\nNote: If you previously attempted a tool use that the user did not provide a result for, you should assume the tool use was not successful and assess whether you should retry. If the last tool was a browser_action, the browser has been closed and you must launch a new browser if needed.${
1186-
wasRecent
1187-
? "\n\nIMPORTANT: If the last tool use was a write_to_file that was interrupted, the file was reverted back to its original state before the interrupted edit, and you do NOT need to re-read the file as you already have its up-to-date contents."
1188-
: ""
1189-
}` +
1190-
(responseText
1191-
? `\n\nNew instructions for task continuation:\n<user_message>\n${responseText}\n</user_message>`
1192-
: ""),
1193-
})
1194-
11951180
if (responseImages && responseImages.length > 0) {
11961181
newUserContent.push(...formatResponse.imageBlocks(responseImages))
11971182
}
11981183

1184+
// Ensure we have at least some content to send to the API
1185+
// If newUserContent is empty, add a minimal resumption message
1186+
if (newUserContent.length === 0) {
1187+
newUserContent.push({
1188+
type: "text",
1189+
text: "[TASK RESUMPTION] Resuming task...",
1190+
})
1191+
}
1192+
11991193
await this.overwriteApiConversationHistory(modifiedApiConversationHistory)
12001194

12011195
console.log(`[subtasks] task ${this.taskId}.${this.instanceId} resuming from history item`)

0 commit comments

Comments
 (0)