Fix an issue where the agent stops prematurely (#16269)

This commit is contained in:
Christian Gunderman
2026-01-09 23:05:27 +00:00
committed by GitHub
parent 356f76e545
commit c87d1aed4c
6 changed files with 118 additions and 25 deletions
@@ -129,21 +129,27 @@ export function useQuotaAndFallback({
setProQuotaRequest(null);
isDialogPending.current = false; // Reset the flag here
if (choice === 'retry_always') {
// Set the model to the fallback model for the current session.
// This ensures the Footer updates and future turns use this model.
// The change is not persisted, so the original model is restored on restart.
config.activateFallbackMode(proQuotaRequest.fallbackModel);
historyManager.addItem(
{
type: MessageType.INFO,
text: `Switched to fallback model ${proQuotaRequest.fallbackModel}`,
},
Date.now(),
);
if (choice === 'retry_always' || choice === 'retry_once') {
// Reset quota error flags to allow the agent loop to continue.
setModelSwitchedFromQuotaError(false);
config.setQuotaErrorOccurred(false);
if (choice === 'retry_always') {
// Set the model to the fallback model for the current session.
// This ensures the Footer updates and future turns use this model.
// The change is not persisted, so the original model is restored on restart.
config.activateFallbackMode(proQuotaRequest.fallbackModel);
historyManager.addItem(
{
type: MessageType.INFO,
text: `Switched to fallback model ${proQuotaRequest.fallbackModel}`,
},
Date.now(),
);
}
}
},
[proQuotaRequest, historyManager, config],
[proQuotaRequest, historyManager, config, setModelSwitchedFromQuotaError],
);
return {