Merge pull request #3950 from ismetanin/fix/surface-subagent-quota-error

fix(runtime-fallback): surface quota errors from stuck subagents
This commit is contained in:
YeonGyu-Kim
2026-05-15 19:05:34 +09:00
committed by GitHub
2 changed files with 153 additions and 0 deletions
@@ -8,6 +8,7 @@ import { getFallbackModelsForSession } from "./fallback-models"
import { resolveFallbackBootstrapModel } from "./fallback-bootstrap-model"
import { dispatchFallbackRetry } from "./fallback-retry-dispatcher"
import { hasVisibleAssistantResponse } from "./visible-assistant-response"
import { subagentSessions } from "../../features/claude-code-session-state"
import { resolveMessageEventSessionID } from "../../shared/event-session-id"
export { hasVisibleAssistantResponse } from "./visible-assistant-response"
@@ -113,6 +114,16 @@ export function createMessageUpdateHandler(deps: HookDeps, helpers: AutoRetryHel
const fallbackModels = getFallbackModelsForSession(sessionID, resolvedAgent, pluginConfig)
if (fallbackModels.length === 0) {
if (
subagentSessions.has(sessionID) &&
classifyErrorType(error) === "quota_exceeded"
) {
log(`[${HOOK_NAME}] Aborting subagent on unrecoverable quota error (no fallback configured)`, {
sessionID,
model,
})
await helpers.abortSessionRequest(sessionID, "message.updated.subagent-quota-no-fallback")
}
return
}