Explorar el Código

fix(foreground-fallback): let tryFallback manage abort to avoid killing task

Removed external abort+REPROMPT_DELAY_MS from session.status handler.
tryFallback already handles abort internally — tries promptAsync first,
aborts on failure — and crucially sets inProgress before attempting
anything. The external abort left inProgress unset during the idle
window, so the task-session-manager saw isFallbackInProgress()=false and
cancelled the pending task call.
Michael Henke hace 1 mes
padre
commit
151dfc5473
Se han modificado 1 ficheros con 5 adiciones y 4 borrados
  1. 5 4
      src/hooks/foreground-fallback/index.ts

+ 5 - 4
src/hooks/foreground-fallback/index.ts

@@ -224,11 +224,12 @@ export class ForegroundFallbackManager {
               msg.includes('reduce concurrency'))) ||
           isRateLimitError(props.error);
         if (isRateLimit) {
-          // Abort retry loop before falling back — promptAsync alone
-          // is ignored when the session is in retry mode.
           if (this.shouldIntervene(props.sessionID)) {
-            await abortSessionWithTimeout(this.client, props.sessionID);
-            await new Promise((r) => setTimeout(r, REPROMPT_DELAY_MS));
+            // Let tryFallback handle retry-loop breaking internally —
+            // it sets inProgress first, so the task-session-manager sees
+            // isFallbackInProgress()=true during the abort idle window.
+            // External abort+wait would leave inProgress unset and the
+            // task manager would cancel the pending call on idle.
             await this.tryFallback(props.sessionID);
             this.sessionRetries.set(props.sessionID, 1);
           }