fix: disable ResolveOutstandingSteps + add 775-limit stall fallback
This commit is contained in:
@@ -1560,6 +1560,23 @@ function setupMonitor() {
|
|||||||
logToFile(`[STEP-PROBE] returned=${steps.length} vs trajectory.stepCount=${currentCount}`);
|
logToFile(`[STEP-PROBE] returned=${steps.length} vs trajectory.stepCount=${currentCount}`);
|
||||||
if (steps.length < currentCount) {
|
if (steps.length < currentCount) {
|
||||||
logToFile(`[STEP-PROBE] ⚠️ 775-limit hit! steps=${steps.length} < stepCount=${currentCount}`);
|
logToFile(`[STEP-PROBE] ⚠️ 775-limit hit! steps=${steps.length} < stepCount=${currentCount}`);
|
||||||
|
// 775-LIMIT FALLBACK: API can't return latest steps.
|
||||||
|
// Use stall detection to create a generic pending.
|
||||||
|
if (consecutiveIdleCount >= 3 && lastPendingStepIndex !== currentCount) {
|
||||||
|
logToFile(`[STEP-PROBE] 775-LIMIT FALLBACK: creating generic pending for step ~${currentCount}`);
|
||||||
|
stallProbed = true;
|
||||||
|
lastPendingStepIndex = currentCount;
|
||||||
|
lastPendingTime = Date.now();
|
||||||
|
sawRunningAfterPending = false;
|
||||||
|
writePendingApproval({
|
||||||
|
conversation_id: activeSessionId,
|
||||||
|
command: `run_command: (step ${currentCount}, beyond API limit)`,
|
||||||
|
description: `Step ~${currentCount} (775-limit, type unknown)`,
|
||||||
|
step_type: 'run_command',
|
||||||
|
step_index: currentCount,
|
||||||
|
source: 'step_probe_775_fallback',
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Scan last 5 steps backwards to find WAITING (RUN_COMMAND may not be last)
|
// Scan last 5 steps backwards to find WAITING (RUN_COMMAND may not be last)
|
||||||
let foundWaiting = false;
|
let foundWaiting = false;
|
||||||
@@ -2291,19 +2308,11 @@ async function tryApprovalStrategies(approved, sessionId, stepType = '', stepInd
|
|||||||
catch (e) {
|
catch (e) {
|
||||||
logToFile(`[APPROVAL-2] ❌ FAIL: ${e.message}`);
|
logToFile(`[APPROVAL-2] ❌ FAIL: ${e.message}`);
|
||||||
}
|
}
|
||||||
// ── Strategy 3: ResolveOutstandingSteps (REJECT ONLY — this CANCELS!) ──
|
// ── Strategy 3: ResolveOutstandingSteps — DISABLED (too destructive!) ──
|
||||||
|
// This was cancelling AG work when bot sent approved=false.
|
||||||
|
// DO NOT enable without explicit user confirmation.
|
||||||
if (!approved && sdk) {
|
if (!approved && sdk) {
|
||||||
try {
|
logToFile(`[APPROVAL-3] ResolveOutstandingSteps DISABLED — reject only logs, no cancel`);
|
||||||
logToFile(`[APPROVAL-3] ResolveOutstandingSteps (REJECT/CANCEL only!)`);
|
|
||||||
const rpcResult = await sdk.ls.rawRPC('ResolveOutstandingSteps', {
|
|
||||||
cascadeId: sessionId,
|
|
||||||
});
|
|
||||||
logToFile(`[APPROVAL-3] ✅ SUCCESS: ${JSON.stringify(rpcResult).substring(0, 200)}`);
|
|
||||||
return `RPC-3:ResolveOutstandingSteps(cancel)`;
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
logToFile(`[APPROVAL-3] ❌ FAIL: ${e.message}`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
logToFile(`[APPROVAL] ⚠️ ALL strategies attempted — check logs for results`);
|
logToFile(`[APPROVAL] ⚠️ ALL strategies attempted — check logs for results`);
|
||||||
return `ALL_ATTEMPTED:${action}`;
|
return `ALL_ATTEMPTED:${action}`;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1540,6 +1540,23 @@ function setupMonitor() {
|
|||||||
logToFile(`[STEP-PROBE] returned=${steps.length} vs trajectory.stepCount=${currentCount}`);
|
logToFile(`[STEP-PROBE] returned=${steps.length} vs trajectory.stepCount=${currentCount}`);
|
||||||
if (steps.length < currentCount) {
|
if (steps.length < currentCount) {
|
||||||
logToFile(`[STEP-PROBE] ⚠️ 775-limit hit! steps=${steps.length} < stepCount=${currentCount}`);
|
logToFile(`[STEP-PROBE] ⚠️ 775-limit hit! steps=${steps.length} < stepCount=${currentCount}`);
|
||||||
|
// 775-LIMIT FALLBACK: API can't return latest steps.
|
||||||
|
// Use stall detection to create a generic pending.
|
||||||
|
if (consecutiveIdleCount >= 3 && lastPendingStepIndex !== currentCount) {
|
||||||
|
logToFile(`[STEP-PROBE] 775-LIMIT FALLBACK: creating generic pending for step ~${currentCount}`);
|
||||||
|
stallProbed = true;
|
||||||
|
lastPendingStepIndex = currentCount;
|
||||||
|
lastPendingTime = Date.now();
|
||||||
|
sawRunningAfterPending = false;
|
||||||
|
writePendingApproval({
|
||||||
|
conversation_id: activeSessionId,
|
||||||
|
command: `run_command: (step ${currentCount}, beyond API limit)`,
|
||||||
|
description: `Step ~${currentCount} (775-limit, type unknown)`,
|
||||||
|
step_type: 'run_command',
|
||||||
|
step_index: currentCount,
|
||||||
|
source: 'step_probe_775_fallback',
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scan last 5 steps backwards to find WAITING (RUN_COMMAND may not be last)
|
// Scan last 5 steps backwards to find WAITING (RUN_COMMAND may not be last)
|
||||||
@@ -2252,18 +2269,11 @@ async function tryApprovalStrategies(approved: boolean, sessionId: string, stepT
|
|||||||
logToFile(`[APPROVAL-2] ❌ FAIL: ${e.message}`);
|
logToFile(`[APPROVAL-2] ❌ FAIL: ${e.message}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Strategy 3: ResolveOutstandingSteps (REJECT ONLY — this CANCELS!) ──
|
// ── Strategy 3: ResolveOutstandingSteps — DISABLED (too destructive!) ──
|
||||||
|
// This was cancelling AG work when bot sent approved=false.
|
||||||
|
// DO NOT enable without explicit user confirmation.
|
||||||
if (!approved && sdk) {
|
if (!approved && sdk) {
|
||||||
try {
|
logToFile(`[APPROVAL-3] ResolveOutstandingSteps DISABLED — reject only logs, no cancel`);
|
||||||
logToFile(`[APPROVAL-3] ResolveOutstandingSteps (REJECT/CANCEL only!)`);
|
|
||||||
const rpcResult = await sdk.ls.rawRPC('ResolveOutstandingSteps', {
|
|
||||||
cascadeId: sessionId,
|
|
||||||
});
|
|
||||||
logToFile(`[APPROVAL-3] ✅ SUCCESS: ${JSON.stringify(rpcResult).substring(0, 200)}`);
|
|
||||||
return `RPC-3:ResolveOutstandingSteps(cancel)`;
|
|
||||||
} catch (e: any) {
|
|
||||||
logToFile(`[APPROVAL-3] ❌ FAIL: ${e.message}`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logToFile(`[APPROVAL] ⚠️ ALL strategies attempted — check logs for results`);
|
logToFile(`[APPROVAL] ⚠️ ALL strategies attempted — check logs for results`);
|
||||||
|
|||||||
Reference in New Issue
Block a user