Repository navigation
Description
Summary
In 2026.6.1, two new SQLite tables (agent_model_catalogs, model_capability_cache) are created by the state-db migration but no producer code in the shipped dist/ build ever writes to them. As a result openclaw models list falls back to live per-provider fetches on every call.
Measured on Linux, 2026.6.1 (2e08f0f), warm gateway:
| command | time |
|---|---|
openclaw models status |
2.9 s (baseline: CLI + config load) |
openclaw models list (configured providers only) |
25.7 s |
openclaw models list --all |
53.0 s |
Repeated calls don't speed up — there's no persisted catalog cache.
Evidence
Schema is present:
$ grep -nE "agent_model_catalogs|model_capability_cache" dist/openclaw-state-db-*.js
536:CREATE TABLE IF NOT EXISTS model_capability_cache (
554:CREATE INDEX IF NOT EXISTS idx_model_capability_cache_provider_updated ON model_capability_cache(...)
557:CREATE TABLE IF NOT EXISTS agent_model_catalogs (
564:CREATE INDEX IF NOT EXISTS idx_agent_model_catalogs_agent_dir ON agent_model_catalogs(...)
No producer anywhere in dist/:
$ grep -rnE 'INSERT INTO (agent_model_catalogs|model_capability_cache)' dist/
(no matches)
$ grep -rnE '"agent_model_catalogs"|'\''agent_model_catalogs'\''|`agent_model_catalogs`' dist/
(no matches)
$ grep -rnE '"model_capability_cache"|'\''model_capability_cache'\''|`model_capability_cache`' dist/
(no matches)
Both tables stay at 0 rows across restarts, after openclaw plugins registry --refresh, and after invoking models list --all.
(The OpenRouter capability cache under plugin_state_entries / core:openrouter-model-capabilities namespace models.v3 is wired correctly via createCorePluginStateSyncKeyedStore in provider-stream-*.js. That's a different, working path. The two new tables look like a separate planned cache whose writer didn't ship.)
Repro
- Fresh-start gateway on 2026.6.1.
sqlite3 ~/.openclaw/state/openclaw.sqlite "SELECT COUNT(*) FROM agent_model_catalogs; SELECT COUNT(*) FROM model_capability_cache;"→ both 0.time openclaw models list --all→ ~50 s on first call.- Re-run step 2 → still both 0.
- Re-run step 3 → still ~50 s; no caching benefit.
Expected
After the first models list --all, subsequent calls should hit the new SQLite tables and complete in well under 1 s.
Environment
- OpenClaw 2026.6.1 (
2e08f0f) - Linux (kernel 5.15)
- Node 24.15.0
- Providers configured: minimax, anthropic, mistral (no OpenRouter)
Notes
Also noticed (likely separate, happy to file separately if useful):
[state-migrations] Legacy state migration warnings: Left plugin install index in place because shared SQLite state has conflicting plugin install metadata for: acpx, brave, diffs, memory-lancedb
Triggered by version drift between~/.openclaw/plugins/installs.json(legacy) andinstalled_plugin_indexin~/.openclaw/state/openclaw.sqlite.openclaw plugins registry --refreshonly rebuilds SQLite, leaving the legacy file out of sync — so the warning fires on every restart until the legacy file is removed.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 4, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 4, 2026, 10:44 AM ET / 14:44 UTC.
Summary
Keep open: current main still has the two SQLite tables only in schema/types/docs, while the models list path still reads generated models.json/static metadata and can call provider catalog loaders instead of a persisted SQL catalog cache.
Reproducibility: no. high-confidence live reproduction was run in this read-only review. The source path is reproducible enough for triage because current main defines the tables but has no runtime table references outside schema/docs/types, and
models liststill reaches provider catalog loaders.Ways to help us reproduce this
Next step
The report is valid and source-backed, but the fix spans model catalog generation, SQL state helpers, and list-path tests, so it is a medium-confidence repair lane rather than an automatic strict bug lane.
Review details
Best possible solution:
Wire model catalog generation and provider capability data through the existing shared SQLite tables, with a clear invalidation/fingerprint path and regression coverage for warm
models list,models list --all, and provider-filtered catalog reads.Do we have a high-confidence way to reproduce the issue?
No high-confidence live reproduction was run in this read-only review. The source path is reproducible enough for triage because current main defines the tables but has no runtime table references outside schema/docs/types, and
models liststill reaches provider catalog loaders.Is this the best way to solve the issue?
Yes, the reported direction matches the existing schema and database-first policy. The implementation should reuse the existing SQLite tables rather than adding new config, sidecar files, or another cache layer.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 15f3903b6f84.
Label changes
Label changes:
P2: The report describes a current user-facing CLI performance bug with a clear source-level cause, but it does not make the runtime unusable.impact:auth-provider: The affected path is provider model catalog/model-choice discovery across configured providers.issue-rating: 🐚 platinum hermit: Current issue advisory state selects this label.clawsweeper:needs-live-repro: Current issue advisory state selects this label.Label justifications:
P2: The report describes a current user-facing CLI performance bug with a clear source-level cause, but it does not make the runtime unusable.impact:auth-provider: The affected path is provider model catalog/model-choice discovery across configured providers.Evidence reviewed
Acceptance criteria:
What I checked:
model_capability_cacheandagent_model_catalogsin the shared state schema. (src/state/openclaw-state-schema.sql:257, 15f3903b6f84)appendProviderCatalogRowscallsloadProviderCatalogModelsForList, which runs static provider catalogs when available and otherwise invokes live provider catalog hooks. (src/commands/models/list.provider-catalog.ts:275, 15f3903b6f84)ensureOpenClawModelsJsonbuilds and writesmodels.jsonand plugin catalog sidecars; it does not persist intoagent_model_catalogs. (src/agents/models-config.ts:292, 15f3903b6f84)agent_model_catalogs, notmodels.json, and also namemodel_capability_cacheas the typed capability table. Public docs:docs/refactor/database-first.md. (docs/refactor/database-first.md:216, 15f3903b6f84)Likely related people:
steipete. (role: recent area contributor; confidence: medium; commits: 087fcf40858b, 15f3903b6f84; files:src/state/openclaw-state-schema.sql,src/commands/models/list.list-command.ts,src/commands/models/list.provider-catalog.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.steipete commentedon Jun 13, 2026
Fixed by the combined landed changes in #90457 and #92247.
agent_model_catalogsand routed model/provider catalog loads through it./modelsandmodels listnow use bounded configured/read-only discovery, while explicitallretains full discovery.check:changed(run_ac95d2f9c585), remote Docker OpenAI tools E2E (run_c417429409c0), and green PR CI.The generic
model_capability_cachetable is not required to make this listing path fast; the durable catalog owner for this report is nowagent_model_catalogs, plus bounded default discovery. Closing the reported 25-53s listing regression. Please reopen with timings from currentmainor a release containing44f45d8729f5if the same provider set still reproduces it.