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.
This commit is contained in:
Roo Code 2026-01-07 00:16:05 +00:00
parent 741b2680b5
commit d7c212ad05

View file

@ -1441,6 +1441,10 @@ export class Task extends EventEmitter<TaskEvents> 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<TaskEvents> 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<TaskEvents> 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({