fix: process ALL parallel WAITING steps instead of only first one

step_probe break statement caused only one WAITING step to get
a pending file when AG runs multiple parallel tool calls.
Now iterates all WAITING steps and creates pending for each.
This commit is contained in:
Variet Worker
2026-03-16 20:36:41 +09:00
parent fdc0084813
commit 7f079a56a0
3 changed files with 23 additions and 11 deletions

View File

@@ -2060,7 +2060,10 @@ function setupMonitor() {
logToFile(`[STEP-PROBE] ★ WAITING (via offset)! step=${actualIndex} type=${oStep.type} cmd='${command}'`); logToFile(`[STEP-PROBE] ★ WAITING (via offset)! step=${actualIndex} type=${oStep.type} cmd='${command}'`);
if (actualIndex !== lastPendingStepIndex) { if (actualIndex !== lastPendingStepIndex) {
stallProbed = true; stallProbed = true;
// Track highest step index for auto-resolve
if (actualIndex > lastPendingStepIndex) {
lastPendingStepIndex = actualIndex; lastPendingStepIndex = actualIndex;
}
lastPendingTime = Date.now(); lastPendingTime = Date.now();
sawRunningAfterPending = false; sawRunningAfterPending = false;
// Skip pending for workspace-less AG windows (project=default) // Skip pending for workspace-less AG windows (project=default)
@@ -2081,7 +2084,7 @@ function setupMonitor() {
}); });
} }
} }
break; // NOTE: no break — process ALL parallel WAITING steps
} }
} }
} }
@@ -2090,7 +2093,7 @@ function setupMonitor() {
logToFile(`[STEP-PROBE] offset retry failed: ${oe.message.substring(0, 100)}`); logToFile(`[STEP-PROBE] offset retry failed: ${oe.message.substring(0, 100)}`);
} }
} }
// Scan last 5 steps backwards to find WAITING (RUN_COMMAND may not be last) // Scan last 5 steps backwards to find ALL WAITING steps (parallel tool calls)
let foundWaiting = false; let foundWaiting = false;
for (let si = steps.length - 1; si >= Math.max(0, steps.length - 5); si--) { for (let si = steps.length - 1; si >= Math.max(0, steps.length - 5); si--) {
const step = steps[si]; const step = steps[si];
@@ -2125,7 +2128,10 @@ function setupMonitor() {
logToFile(`[STEP-PROBE] ★ WAITING! step=${si} type=${stepType} cmd='${command}'`); logToFile(`[STEP-PROBE] ★ WAITING! step=${si} type=${stepType} cmd='${command}'`);
if (si !== lastPendingStepIndex) { if (si !== lastPendingStepIndex) {
stallProbed = true; // found WAITING — stop retrying stallProbed = true; // found WAITING — stop retrying
// Track highest step index for auto-resolve
if (si > lastPendingStepIndex) {
lastPendingStepIndex = si; lastPendingStepIndex = si;
}
lastPendingTime = Date.now(); lastPendingTime = Date.now();
sawRunningAfterPending = false; sawRunningAfterPending = false;
// Skip pending for workspace-less AG windows (project=default) // Skip pending for workspace-less AG windows (project=default)
@@ -2146,7 +2152,7 @@ function setupMonitor() {
}); });
} }
} }
break; // NOTE: no break — process ALL parallel WAITING steps
} }
} }
if (!foundWaiting) { if (!foundWaiting) {

File diff suppressed because one or more lines are too long

View File

@@ -2048,7 +2048,10 @@ function setupMonitor() {
logToFile(`[STEP-PROBE] ★ WAITING (via offset)! step=${actualIndex} type=${oStep.type} cmd='${command}'`); logToFile(`[STEP-PROBE] ★ WAITING (via offset)! step=${actualIndex} type=${oStep.type} cmd='${command}'`);
if (actualIndex !== lastPendingStepIndex) { if (actualIndex !== lastPendingStepIndex) {
stallProbed = true; stallProbed = true;
// Track highest step index for auto-resolve
if (actualIndex > lastPendingStepIndex) {
lastPendingStepIndex = actualIndex; lastPendingStepIndex = actualIndex;
}
lastPendingTime = Date.now(); lastPendingTime = Date.now();
sawRunningAfterPending = false; sawRunningAfterPending = false;
// Skip pending for workspace-less AG windows (project=default) // Skip pending for workspace-less AG windows (project=default)
@@ -2068,7 +2071,7 @@ function setupMonitor() {
}); });
} }
} }
break; // NOTE: no break — process ALL parallel WAITING steps
} }
} }
} }
@@ -2077,7 +2080,7 @@ function setupMonitor() {
} }
} }
// Scan last 5 steps backwards to find WAITING (RUN_COMMAND may not be last) // Scan last 5 steps backwards to find ALL WAITING steps (parallel tool calls)
let foundWaiting = false; let foundWaiting = false;
for (let si = steps.length - 1; si >= Math.max(0, steps.length - 5); si--) { for (let si = steps.length - 1; si >= Math.max(0, steps.length - 5); si--) {
const step = steps[si]; const step = steps[si];
@@ -2111,7 +2114,10 @@ function setupMonitor() {
if (si !== lastPendingStepIndex) { if (si !== lastPendingStepIndex) {
stallProbed = true; // found WAITING — stop retrying stallProbed = true; // found WAITING — stop retrying
// Track highest step index for auto-resolve
if (si > lastPendingStepIndex) {
lastPendingStepIndex = si; lastPendingStepIndex = si;
}
lastPendingTime = Date.now(); lastPendingTime = Date.now();
sawRunningAfterPending = false; sawRunningAfterPending = false;
// Skip pending for workspace-less AG windows (project=default) // Skip pending for workspace-less AG windows (project=default)
@@ -2131,7 +2137,7 @@ function setupMonitor() {
}); });
} }
} }
break; // NOTE: no break — process ALL parallel WAITING steps
} }
} }
if (!foundWaiting) { if (!foundWaiting) {