Commit 367dc64
fix(ai): fall back to the cached roster unless data.models is a real array (PR #43 review)
The retry returned `data || cached()`, so any truthy JSON that lacked a valid
`models` array — a 200 with an error object, a partial response, a schema drift —
was returned as-is. pickCloudModel then sees "no models" and collapses to the
2-model fallback even though cloudRoster still holds a good list, defeating the
whole point of the cache.
Now a payload only counts as a roster when data.models is an array; otherwise it
returns cached(). Also fixes the mirror case where a 200 arrives but json() failed
(data null) — same fall-through to the cache.
Full gate: 24 suites, 0 failures.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent ef99a8f commit 367dc64
1 file changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
258 | 261 | | |
259 | 262 | | |
260 | 263 | | |
261 | 264 | | |
262 | 265 | | |
| 266 | + | |
263 | 267 | | |
264 | | - | |
| 268 | + | |
265 | 269 | | |
266 | 270 | | |
267 | 271 | | |
| |||
0 commit comments