Skip to content

Commit ff7a784

Browse files
committed
Fix auto-open diff by moving code before early return
1 parent 8a185fd commit ff7a784

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/core/tools/attemptCompletionTool.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,29 @@ export async function attemptCompletionTool(
111111
// button and field.
112112
const { response, text, images } = await cline.ask("completion_result", "", false)
113113

114+
// Auto-open diff viewer regardless of response
115+
console.log("************************* TASK COMPLETE *************************")
116+
console.log("[TASK_COMPLETE_DEBUG] Entering auto-diff section")
117+
console.log("[TASK_COMPLETE_DEBUG] cline instance:", {
118+
hasCheckpointDiff: !!cline.checkpointDiff,
119+
taskId: cline.taskId,
120+
instance: cline.instanceId,
121+
})
122+
// Show a UI message to verify execution reaches this point
123+
const vscode = require("vscode")
124+
vscode.window.showInformationMessage("About to attempt opening diff viewer")
125+
try {
126+
console.log("[attemptCompletionTool] Attempting to auto-open diff viewer")
127+
await cline.checkpointDiff({
128+
ts: Date.now(),
129+
previousCommitHash: undefined, // Diff against working tree
130+
mode: "checkpoint",
131+
})
132+
console.log("[attemptCompletionTool] Successfully opened diff viewer")
133+
} catch (error) {
134+
console.warn("[attemptCompletionTool] Failed to auto-open diff viewer:", error)
135+
}
136+
114137
// Signals to recursive loop to stop (for now
115138
// cline never happens since yesButtonClicked
116139
// will trigger a new task).
@@ -144,29 +167,6 @@ export async function attemptCompletionTool(
144167

145168
cline.userMessageContent.push(...toolResults)
146169

147-
console.log("************************* TASK COMPLETE *************************")
148-
// Auto-open diff viewer (same behavior as chat button)
149-
console.log("[TASK_COMPLETE_DEBUG] Entering auto-diff section")
150-
console.log("[TASK_COMPLETE_DEBUG] cline instance:", {
151-
hasCheckpointDiff: !!cline.checkpointDiff,
152-
taskId: cline.taskId,
153-
instance: cline.instanceId,
154-
})
155-
// Show a UI message to verify execution reaches this point
156-
const vscode = require("vscode")
157-
vscode.window.showInformationMessage("About to attempt opening diff viewer")
158-
try {
159-
console.log("[attemptCompletionTool] Attempting to auto-open diff viewer")
160-
await cline.checkpointDiff({
161-
ts: Date.now(),
162-
previousCommitHash: undefined, // Diff against working tree
163-
mode: "checkpoint",
164-
})
165-
console.log("[attemptCompletionTool] Successfully opened diff viewer")
166-
} catch (error) {
167-
console.warn("[attemptCompletionTool] Failed to auto-open diff viewer:", error)
168-
}
169-
170170
return
171171
}
172172
} catch (error) {

0 commit comments

Comments
 (0)