@@ -132,10 +132,11 @@ export function useProviderAccountPools(deps: {
132132 const accountRequestGenerationRef = useRef < Record < string , number > > ( { } ) ;
133133 const rosterGenerationRef = useRef < Record < string , number > > ( { } ) ;
134134 const quotaGenerationRef = useRef < Record < string , number > > ( { } ) ;
135- // Newest generation whose data was actually applied, per provider key. A request
136- // superseded mid-flight by a newer one reports success when fresher data already
137- // landed, so a manual quota refresh racing the visibility poll does not surface
138- // a "refresh failed" state for data that is already on screen.
135+ // Newest generation whose QUOTA data was actually applied, per provider key. A
136+ // request superseded mid-flight by a newer one reports success only when fresher
137+ // quota already landed, so a manual refresh racing the visibility poll does not
138+ // surface a "refresh failed" state for data that is already on screen — and a
139+ // failed newer quota request still surfaces as failure.
139140 const freshLandedRef = useRef < Record < string , number > > ( { } ) ;
140141 const supersededByFresher = useCallback ( ( key : string , generation : number ) : boolean => {
141142 if ( ! aliveRef . current || ! mountedRef . current || serverRef . current !== apiBase ) return false ;
@@ -225,7 +226,9 @@ export function useProviderAccountPools(deps: {
225226 activeAccountId : data . activeAccountId ?? null ,
226227 accounts : mergeQuotaRows ( rows , current [ provider ] ?. accounts ?? [ ] , false ) ,
227228 } } : current ) ;
228- if ( currentRoster ( ) ) freshLandedRef . current [ key ] = generation ;
229+ // NB: the cheap roster read is NOT recorded as fresh quota. A superseded
230+ // manual refresh must report success only when a newer request actually
231+ // landed quota, otherwise a failed newer quota request would read as success.
229232 setAccountLoadStates ( current => currentRoster ( ) ? { ...current , [ provider ] : "ready" } : current ) ;
230233 if ( ! rows . some ( supportsQuotaRead ) ) return true ;
231234
0 commit comments