Commit ef99a8f
fix(ai): correct the cache comment; guard the refreshed token (PR #43 review)
1. The comment claimed "credits/turns aren't cached", but cloudRoster = data.models
caches the per-model fields including turns_left, so the cached-roster fallback
CAN show a slightly stale "≈ turns left". Only the account-level credit BALANCE
is genuinely not carried (the "$X credits left" header is omitted until the next
good fetch). Comment now says exactly that.
2. After refreshCloudToken() succeeds, the refreshed secret was used unchecked —
if it came back falsy the retry would send `Authorization: Bearer null`, noise
that masks the real 401. Now the retry only fires when the refreshed token is
truthy; otherwise it falls through to the cached-roster path.
Comment-and-guard only, no behaviour change on the happy path. Full gate: 24
suites, 0 failures.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent f4278bb commit ef99a8f
1 file changed
Lines changed: 8 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
239 | 241 | | |
240 | 242 | | |
241 | 243 | | |
| |||
245 | 247 | | |
246 | 248 | | |
247 | 249 | | |
248 | | - | |
249 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
250 | 255 | | |
251 | 256 | | |
252 | 257 | | |
| |||
0 commit comments