fix(ext,bot): Accept All WS regression + auto_approve dual-write — VSIX v0.4.5

This commit is contained in:
Variet Worker
2026-03-17 21:01:24 +09:00
parent 4e8ac8d6b7
commit 47cc838d9d
8 changed files with 158 additions and 11 deletions

View File

@@ -16,7 +16,7 @@ import * as path from 'path';
import * as os from 'os';
import * as cp from 'child_process';
import { WSBridgeClient, WSResponseData, WSCommandData } from './ws-client';
import { initStepProbe, BridgeContext, writePendingApproval, tryApprovalStrategies, writeRegistration, getApprovalContext, resetPendingState } from './step-probe';
import { initStepProbe, BridgeContext, writePendingApproval, tryApprovalStrategies, writeRegistration, getApprovalContext, resetPendingState, handleDiffReviewResponse } from './step-probe';
import { startHttpBridge, getDeterministicPort, HttpBridgeContext } from './http-bridge';
import { setupApprovalObserver } from './html-patcher';
import { watchCommandsDir, handleWSCommand, disposeCommandsWatcher, CommandHandlerContext } from './command-handler';
@@ -391,9 +391,29 @@ export async function activate(context: vscode.ExtensionContext) {
if (hubUrl) {
wsBridge = new WSBridgeClient(hubUrl, regCode, projectName, pcName, {
onResponse: (data: WSResponseData) => {
logToFile(`[WS-RESPONSE] ${data.request_id?.substring(0, 12)} approved=${data.approved} step_type=${data.step_type || '(none)'}`);
logToFile(`[WS-RESPONSE] ${data.request_id?.substring(0, 12)} approved=${data.approved} step_type=${data.step_type || '(none)'}`);
const approved = data.approved ?? true;
const stepType = data.step_type || '';
// ── diff_review: Accept all / Reject all (REGRESSION FIX) ──
// Previously only handled in processResponseFile (file-bridge path).
// WS path was missing this logic entirely, causing Accept All to fail.
if (stepType === 'diff_review') {
logToFile(`[WS-RESPONSE] diff_review detected — routing to handleDiffReviewResponse`);
handleDiffReviewResponse({
request_id: data.request_id,
approved,
button_index: data.button_index,
step_type: stepType,
})
.then(result => {
logToFile(`[WS-RESPONSE] diff_review result: ${result}`);
resetPendingState();
})
.catch(err => logToFile(`[WS-RESPONSE] diff_review error: ${err.message}`));
return;
}
// Normal approval — tryApprovalStrategies
const approvalCtx = getApprovalContext();
logToFile(`[WS-RESPONSE] Triggering approval: approved=${approved} session=${approvalCtx.sessionId.substring(0, 8)} stepType=${stepType} stepIndex=${approvalCtx.stepIndex}`);