fix(extension): diff_review 2-strategy deploy + 8s pending delay

- Deploy AcknowledgeCascadeCodeEdit RPC strategy (was in source but never compiled)
- Add 8s setTimeout delay for diff_review pending (AI response arrives on Discord first)
- Capture closure variables for delayed pending creation safety
- known-issues: diff_review pending ordering fix
This commit is contained in:
Variet Worker
2026-03-16 14:22:41 +09:00
parent 15f6a743a4
commit f302984721
6 changed files with 86 additions and 41 deletions

View File

@@ -2401,25 +2401,38 @@ function setupMonitor() {
// ── Diff review detection: if session just went IDLE and files were modified ──
if (wasRunning && !isRunning && pendingModifiedFiles.length > 0) {
const fileList = pendingModifiedFiles.slice(0, 5).join(', ');
logToFile(`[DIFF-REVIEW] IDLE with ${pendingModifiedFiles.length} modified files: ${fileList}`);
writeChatSnapshot(`📝 **코드 리뷰 대기**\n\n수정된 파일: ${fileList}\n\nAG에서 Accept all / Reject all로 확인해주세요.`);
writePendingApproval({
conversation_id: activeSessionId,
command: `코드 리뷰: ${fileList}`,
description: `${pendingModifiedFiles.length}개 파일이 수정되었습니다`,
step_type: 'diff_review',
step_index: currentCount,
source: 'diff_review_detect',
buttons: [
{ text: 'Accept all', index: 0 },
{ text: 'Reject all', index: 1 },
],
modified_files: pendingModifiedFilePaths.slice(0, 20),
edit_step_indices: pendingEditStepIndices.slice(0, 20),
} as any);
pendingModifiedFiles = []; // reset after notification
const fileCount = pendingModifiedFiles.length;
// Capture variables for delayed closure (poll loop may change them)
const capturedSessionId = activeSessionId;
const capturedStepCount = currentCount;
const capturedModFiles = pendingModifiedFilePaths.slice(0, 20);
const capturedEditSteps = pendingEditStepIndices.slice(0, 20);
logToFile(`[DIFF-REVIEW] IDLE with ${fileCount} modified files: ${fileList}`);
// Reset tracking arrays immediately (so next session starts fresh)
pendingModifiedFiles = [];
pendingModifiedFilePaths = [];
pendingEditStepIndices = [];
// Delay diff_review pending by 8s so AI response snapshot arrives
// on Discord before the approval buttons (snapshot scanner needs time
// to relay the response text to Discord ahead of the approval embed)
setTimeout(() => {
logToFile(`[DIFF-REVIEW] deferred pending creation (8s) for: ${fileList}`);
writeChatSnapshot(`📝 **코드 리뷰 대기**\n\n수정된 파일: ${fileList}\n\nAG에서 Accept all / Reject all로 확인해주세요.`);
writePendingApproval({
conversation_id: capturedSessionId,
command: `코드 리뷰: ${fileList}`,
description: `${fileCount}개 파일이 수정되었습니다`,
step_type: 'diff_review',
step_index: capturedStepCount,
source: 'diff_review_detect',
buttons: [
{ text: 'Accept all', index: 0 },
{ text: 'Reject all', index: 1 },
],
modified_files: capturedModFiles,
edit_step_indices: capturedEditSteps,
} as any);
}, 8000);
}
wasRunning = isRunning;
} catch (e: any) {