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

@@ -2048,7 +2048,10 @@ function setupMonitor() {
logToFile(`[STEP-PROBE] ★ WAITING (via offset)! step=${actualIndex} type=${oStep.type} cmd='${command}'`);
if (actualIndex !== lastPendingStepIndex) {
stallProbed = true;
lastPendingStepIndex = actualIndex;
// Track highest step index for auto-resolve
if (actualIndex > lastPendingStepIndex) {
lastPendingStepIndex = actualIndex;
}
lastPendingTime = Date.now();
sawRunningAfterPending = false;
// 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;
for (let si = steps.length - 1; si >= Math.max(0, steps.length - 5); si--) {
const step = steps[si];
@@ -2111,7 +2114,10 @@ function setupMonitor() {
if (si !== lastPendingStepIndex) {
stallProbed = true; // found WAITING — stop retrying
lastPendingStepIndex = si;
// Track highest step index for auto-resolve
if (si > lastPendingStepIndex) {
lastPendingStepIndex = si;
}
lastPendingTime = Date.now();
sawRunningAfterPending = false;
// 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) {