fix(extension): guitar_score step-probe UTF-8 loop + approval stepIndex guard (v0.5.11)

This commit is contained in:
Variet Worker
2026-03-28 09:15:11 +09:00
parent d5fdc41f35
commit 7bbd8749d7
4 changed files with 93 additions and 3 deletions

View File

@@ -313,7 +313,8 @@ async function processResponseFile(filePath: string) {
*/
export async function tryApprovalStrategies(approved: boolean, sessionId: string, stepType: string = '', stepIndex: number = -1): Promise<string> {
const action = approved ? 'APPROVE' : 'REJECT';
const effectiveStepIndex = Math.max(0, stepIndex >= 0 ? stepIndex : ctx.lastPendingStepIndex);
const effectiveStepIndex = stepIndex >= 0 ? stepIndex
: (ctx.lastPendingStepIndex >= 0 ? ctx.lastPendingStepIndex : -1);
ctx.logToFile(`[APPROVAL] Starting ${action} strategies for session ${sessionId.substring(0, 8)} stepType=${stepType} stepIndex=${effectiveStepIndex}`);
// ── Dynamic Command Discovery (log what's available during WAITING state) ──
@@ -338,7 +339,7 @@ export async function tryApprovalStrategies(approved: boolean, sessionId: string
// ══════════════════════════════════════════════════════════
// STRATEGY 0-PROTO: Correct proto-based RPC (decoded from AG source)
// ══════════════════════════════════════════════════════════
if (ctx.sdk && approved) {
if (ctx.sdk && approved && effectiveStepIndex >= 0) {
// Build interaction sub-message based on step_type
const typeLower = stepType.toLowerCase().replace('cortex_step_type_', '');
let interactionPayload: Record<string, any> = {};