fix: focus dirty files before executing agentAcceptAllInFile command

This commit is contained in:
2026-03-10 15:34:37 +09:00
parent 0470c03ab3
commit 4dcb78c1ce
4 changed files with 44 additions and 7 deletions

View File

@@ -2148,10 +2148,29 @@ async function processResponseFile(filePath) {
const cmd = isAccept const cmd = isAccept
? 'antigravity.prioritized.agentAcceptAllInFile' ? 'antigravity.prioritized.agentAcceptAllInFile'
: 'antigravity.prioritized.agentRejectAllInFile'; : 'antigravity.prioritized.agentRejectAllInFile';
logToFile(`[RESPONSE] diff_review → executing VS Code command: ${cmd} (btnIdx=${btnIdx})`); logToFile(`[RESPONSE] diff_review → ${cmd} (btnIdx=${btnIdx})`);
try { try {
await vscode.commands.executeCommand(cmd); // Find dirty documents and focus each before executing
logToFile(`[RESPONSE] diff_review command executed OK`); const dirtyDocs = vscode.workspace.textDocuments.filter(d => d.isDirty);
logToFile(`[RESPONSE] diff_review: ${dirtyDocs.length} dirty docs found`);
if (dirtyDocs.length > 0) {
for (const doc of dirtyDocs) {
try {
await vscode.window.showTextDocument(doc, { preview: false });
await new Promise(r => setTimeout(r, 200)); // brief wait for focus
await vscode.commands.executeCommand(cmd);
logToFile(`[RESPONSE] diff_review: ${cmd} on ${doc.fileName.split(/[\\/]/).pop()} OK`);
}
catch (perFileErr) {
logToFile(`[RESPONSE] diff_review per-file error: ${perFileErr.message?.substring(0, 80)}`);
}
}
}
else {
// No dirty docs — try command anyway
await vscode.commands.executeCommand(cmd);
logToFile(`[RESPONSE] diff_review: no dirty docs, command executed anyway`);
}
} }
catch (cmdErr) { catch (cmdErr) {
logToFile(`[RESPONSE] diff_review command error: ${cmdErr.message}`); logToFile(`[RESPONSE] diff_review command error: ${cmdErr.message}`);

File diff suppressed because one or more lines are too long

View File

@@ -2104,10 +2104,27 @@ async function processResponseFile(filePath: string) {
const cmd = isAccept const cmd = isAccept
? 'antigravity.prioritized.agentAcceptAllInFile' ? 'antigravity.prioritized.agentAcceptAllInFile'
: 'antigravity.prioritized.agentRejectAllInFile'; : 'antigravity.prioritized.agentRejectAllInFile';
logToFile(`[RESPONSE] diff_review → executing VS Code command: ${cmd} (btnIdx=${btnIdx})`); logToFile(`[RESPONSE] diff_review → ${cmd} (btnIdx=${btnIdx})`);
try { try {
await vscode.commands.executeCommand(cmd); // Find dirty documents and focus each before executing
logToFile(`[RESPONSE] diff_review command executed OK`); const dirtyDocs = vscode.workspace.textDocuments.filter(d => d.isDirty);
logToFile(`[RESPONSE] diff_review: ${dirtyDocs.length} dirty docs found`);
if (dirtyDocs.length > 0) {
for (const doc of dirtyDocs) {
try {
await vscode.window.showTextDocument(doc, { preview: false });
await new Promise(r => setTimeout(r, 200)); // brief wait for focus
await vscode.commands.executeCommand(cmd);
logToFile(`[RESPONSE] diff_review: ${cmd} on ${doc.fileName.split(/[\\/]/).pop()} OK`);
} catch (perFileErr: any) {
logToFile(`[RESPONSE] diff_review per-file error: ${perFileErr.message?.substring(0, 80)}`);
}
}
} else {
// No dirty docs — try command anyway
await vscode.commands.executeCommand(cmd);
logToFile(`[RESPONSE] diff_review: no dirty docs, command executed anyway`);
}
} catch (cmdErr: any) { } catch (cmdErr: any) {
logToFile(`[RESPONSE] diff_review command error: ${cmdErr.message}`); logToFile(`[RESPONSE] diff_review command error: ${cmdErr.message}`);
} }

View File

@@ -8,3 +8,4 @@
- 3차 수정: step_type 패스스루 검증 테스트 (15:18) - 3차 수정: step_type 패스스루 검증 테스트 (15:18)
- 4차 수정: ApprovalRequest + 단일 봇 인스턴스 테스트 (15:21) - 4차 수정: ApprovalRequest + 단일 봇 인스턴스 테스트 (15:21)
- 5차 수정: 진단 로그 추가 — step_type 확인 (15:25) - 5차 수정: 진단 로그 추가 — step_type 확인 (15:25)
- 6차 수정: 기본 콜백 step_type 최종 테스트 (15:31)