fix(models): cache catalog for offline startup

Persist the last valid Command Code model catalog and use it when live model discovery fails. Keep first-time offline startup non-fatal, surface clear warnings, and cover cached model selection with unit and pi integration regression tests.
This commit is contained in:
Patrick Wozniak
2026-08-02 01:16:39 +02:00
parent 811f908918
commit 070ef3c07a
6 changed files with 381 additions and 76 deletions
+3 -1
View File
@@ -134,7 +134,9 @@ On startup, the provider fetches:
https://api.commandcode.ai/provider/v1/models
```
For tests or local mocks, override it with `COMMANDCODE_MODELS_URL`.
The last successfully fetched catalog is cached at `~/.commandcode/pi-models.json`. If model discovery is temporarily unavailable, the provider uses this cached catalog so previously discovered Command Code models remain selectable. On a first offline start without a cache, pi still loads, but Command Code models remain unavailable until the connection is restored and `/reload` succeeds.
For tests or local mocks, override the endpoint with `COMMANDCODE_MODELS_URL` and the cache location with `COMMANDCODE_MODELS_CACHE`.
## Pricing