From d7c212ad0552c7a1b7c471c0d6853bf65b7b5af4 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Wed, 7 Jan 2026 00:16:05 +0000 Subject: [PATCH] feat: create visible checkpoint before context management events Add visible checkpoints (suppressMessage=false) before each context compression operation to allow users to revert if needed: 1. Before manual context condensation in condenseContext() 2. Before automatic context management in attemptApiRequest() 3. Before context window exceeded handling This addresses Issue #9334 by ensuring checkpoints are visible in the chat, unlike the previous implementation in PR #9335 which used suppressMessage=true and hid the checkpoints from users. --- src/core/task/Task.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index 3340ae5d6c..8c7996ed12 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -1441,6 +1441,10 @@ export class Task extends EventEmitter implements TaskLike { // to ensure tool_use/tool_result pairs are complete in history await this.flushPendingToolResultsToHistory() + // Create a visible checkpoint before context compression + // so users can revert if needed (see issue #9334) + await this.checkpointSave(true, false) + const systemPrompt = await this.getSystemPrompt() // Get condensing configuration @@ -3623,6 +3627,10 @@ export class Task extends EventEmitter implements TaskLike { // Send condenseTaskContextStarted to show in-progress indicator await this.providerRef.deref()?.postMessageToWebview({ type: "condenseTaskContextStarted", text: this.taskId }) + // Create a visible checkpoint before context compression (context window exceeded) + // so users can revert if needed (see issue #9334) + await this.checkpointSave(true, false) + // Force aggressive truncation by keeping only 75% of the conversation history const truncateResult = await manageContext({ messages: this.apiConversationHistory, @@ -3819,6 +3827,10 @@ export class Task extends EventEmitter implements TaskLike { await this.providerRef .deref() ?.postMessageToWebview({ type: "condenseTaskContextStarted", text: this.taskId }) + + // Create a visible checkpoint before automatic context compression + // so users can revert if needed (see issue #9334) + await this.checkpointSave(true, false) } const truncateResult = await manageContext({