fix(models): preserve /api/models cache metadata#1239
fix(models): preserve /api/models cache metadata#1239franksong2702 wants to merge 2 commits intonesquena:masterfrom
Conversation
|
Thanks for this targeted reliability fix, @franksong2702! The cache metadata preservation problem is real — a The approach looks correct: Cache schema validation A few things to confirm before merge: TTL cache interaction Cache invalidation on Test coverage for partial metadata Changelog entry The test file looks focused and the change to 🤖 Automated triage via nesquena-hermes |
|
Addressed the cache-shape and invalidation edge cases from review in What changed:
Verification:
|
|
Thanks for the follow-up commit Confirming the resolutions:
The 28-test pass across This looks ready for merge. The implementation is clean and the test coverage is thorough. 🤖 Automated triage via nesquena-hermes |
|
Merged in v0.50.237 via #1243. Thank you @franksong2702! 🎉 |
Thinking Path
/api/modelsas more than a display list: the frontend reads it for provider identity, the configured default model, live-model enrichment, and model mismatch checks.active_provider,default_model, andgroups.groups, and the load path accepted any cache withgroupsas valid./api/modelspayload even thoughconfig.yaml,/api/settings, and/api/providersstill had the correct provider/default-model state.What Changed
/api/modelsdisk-cache payload shape.active_providerdefault_modelgroupsgroups-only cache files are rejected and rebuilt instead of being served.groups.groups-only cache filesget_available_models()instead of returning the legacy cacheWhy It Matters
Without this metadata, the frontend can lose the configured model/provider source of truth and fall back to weaker state such as the current dropdown value, stale localStorage, or static picker ordering.
This is intentionally a small reliability fix. It does not redesign the model picker or provider settings; it makes the existing
/api/modelscontract stable across restarts and disk-cache hits.Verification
python -m pytest tests/test_model_cache_metadata.pypython -m pytest tests/test_sprint11.py tests/test_ttl_cache.py tests/test_profile_switch_1200.pypython -m py_compile api/config.pygit diff --checkRisks / Follow-ups
Model Used
OpenAI Codex, GPT-5. AI-assisted implementation with a delegated worker sub-agent, followed by coordinator review and verification.