@kolisachint/hoocode-agent 0.4.23 → 0.4.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,6 +28,7 @@ import { createToolHtmlRenderer } from "./export-html/tool-renderer.js";
28
28
  import { ExtensionRunner, wrapRegisteredTools, } from "./extensions/index.js";
29
29
  import { emitSessionShutdownEvent } from "./extensions/runner.js";
30
30
  import { expandPromptTemplate } from "./prompt-templates.js";
31
+ import { clearProviderExhaustion, isProviderQuotaError, markProviderExhausted } from "./provider-health.js";
31
32
  import { CURRENT_SESSION_VERSION, getLatestCompactionEntry } from "./session-manager.js";
32
33
  import { createSyntheticSourceInfo } from "./source-info.js";
33
34
  import { updateSubagentSkillPaths } from "./subagent-pool-instance.js";
@@ -317,6 +318,11 @@ export class AgentSession {
317
318
  const assistantMsg = event.message;
318
319
  if (assistantMsg.stopReason !== "error") {
319
320
  this._overflowRecoveryAttempted = false;
321
+ // A successful response clears any prior provider-exhaustion flag so
322
+ // subagent dispatch is unblocked as soon as the provider recovers.
323
+ const provider = this.model?.provider;
324
+ if (provider)
325
+ clearProviderExhaustion(provider);
320
326
  }
321
327
  // Reset retry counter immediately on successful assistant response
322
328
  // This prevents accumulation across multiple LLM calls within a turn
@@ -339,6 +345,14 @@ export class AgentSession {
339
345
  const didRetry = await this._handleRetryableError(msg);
340
346
  if (didRetry)
341
347
  return; // Retry was initiated, don't proceed to compaction
348
+ // Retries are exhausted/disabled and a quota or rate-limit error
349
+ // persists: flag the provider so subagent dispatch can skip pointless
350
+ // spawns (subagents inherit this provider). Self-expires via TTL and is
351
+ // cleared on the next successful response.
352
+ const provider = this.model?.provider;
353
+ if (provider && isProviderQuotaError(msg.errorMessage)) {
354
+ markProviderExhausted(provider, msg.errorMessage ?? "provider error");
355
+ }
342
356
  }
343
357
  this._resolveRetry();
344
358
  await this._checkCompaction(msg);