Skip to content

Commit 3fd4fa2

Browse files
committed
fix(checkpoints): suppress implicit user-message checkpoint row; keep current checkpoint updated without a chat row
1 parent 1954d45 commit 3fd4fa2

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/core/checkpoints/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,16 @@ async function checkGitInstallation(
133133

134134
service.on("checkpoint", ({ fromHash: from, toHash: to }) => {
135135
try {
136+
// Always update the current checkpoint hash in the webview
136137
provider?.postMessageToWebview({ type: "currentCheckpointUpdated", text: to })
137138

139+
// Optionally suppress the chat row for the next checkpoint (used for the
140+
// implicit checkpoint created on user message submission).
141+
if (task.suppressNextCheckpointMessage) {
142+
task.suppressNextCheckpointMessage = false
143+
return
144+
}
145+
138146
task.say("checkpoint_saved", to, undefined, undefined, { from, to }, undefined, {
139147
isNonInteractive: true,
140148
}).catch((err) => {

src/core/task/Task.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
281281
isStreaming = false
282282
currentStreamingContentIndex = 0
283283
currentStreamingDidCheckpoint = false
284+
suppressNextCheckpointMessage = false
284285
assistantMessageContent: AssistantMessageContent[] = []
285286
presentAssistantMessageLocked = false
286287
presentAssistantMessageHasPendingUpdates = false
@@ -892,7 +893,9 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
892893

893894
// Create a checkpoint whenever the user sends a message.
894895
// Use allowEmpty=true to ensure a checkpoint is recorded even if there are no file changes.
896+
// Suppress the checkpoint_saved chat row for this particular checkpoint to keep the timeline clean.
895897
if (askResponse === "messageResponse") {
898+
this.suppressNextCheckpointMessage = true
896899
void this.checkpointSave(true)
897900
}
898901

0 commit comments

Comments
 (0)