Repository navigation
fix(models): migrate catalog credentials into SQLite - #87166
Conversation
|
Codex review: found issues before merge. Reviewed August 10, 2026, 4:06 AM ET / 08:06 UTC. ClawSweeper reviewWhat this changesMigrates plaintext root and plugin model-catalog credentials into per-agent SQLite profiles, rewrites catalogs to profile references, and removes catalog keys from model request configuration. Merge readiness⛔ Blocked by patch quality or review findings - 10 items remain Keep open. Current main still permits catalog credentials, and this maintainer-owned rewrite addresses the earlier writer and outbound-auth gaps, but three concrete migration regressions block merge. Priority: P1 Review scores
Verification
How this fits togetherModel catalog generation combines configured and discovered provider metadata into root and plugin catalogs. Doctor migrates persisted catalog state, while model execution should obtain credentials only from the canonical auth-profile store. flowchart LR
A[Provider config and catalogs] --> B[Doctor migration]
B --> C[Agent SQLite auth profiles]
B --> D[Sanitized model catalogs]
D --> E[Model registry]
C --> F[Provider discovery and requests]
E --> F
Before merge
Findings
Agent review detailsSecurityNeeds attention: A supported commented root catalog can bypass migration and retain plaintext credentials. PR surfaceSource +493, Tests +277. Total +770 across 10 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep Doctor as the sole migration owner, but resolve profile references during discovery, preserve inherited worker references, and parse root catalogs with the runtime’s established JSON-comment contract. Do we have a high-confidence way to reproduce the issue? Yes. Source establishes focused reproductions for migrated config discovery, inherited worker profile references, and comment-tolerant root catalogs. Is this the best way to solve the issue? No. The Doctor-owned migration boundary is appropriate, but it must retain the established profile-resolution and catalog-parsing contracts. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bcf342903fe7. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
|
We should pick this back up once the PI-removal work has merged. That will let us land the secret-preserving behavior against the new model registry path instead of carrying another PI compatibility shim here. |
|
ClawSweeper PR egg ✨ Hatched: 🥚 common Moonlit Review Wisp Hatch commandComment Hatchability rules:
Rarity: 🥚 common. What is this egg doing here?
|
a088aa6 to
5b56f9c
Compare
c1eb078 to
031aae4
Compare
|
@clawsweeper re-review The PR has been split to the copy-only SQLite migration stage. It no longer rewrites config/catalog bytes or changes runtime authentication. The inherited-profile and comment-tolerant root-catalog findings now have focused regressions; the runtime serialization/auth boundary will land as the ordered follow-up. |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
Merged via squash.
|
* fix(models): migrate catalog credentials into SQLite * refactor(models): share catalog JSON parser
What Problem This Solves
Generated root and plugin model catalogs can contain working plaintext provider credentials. Removing that catalog authentication path safely requires every existing key to exist in the canonical auth-profile SQLite store first; otherwise an upgrade can silently lose a working custom-provider key.
This PR is the first half of the maintainer-decided split. It prepares the database migration only. The ordered follow-up will change catalog serialization and ModelRegistry request authentication after this migration is available.
Why This Change Was Made
A combined migration-plus-runtime rewrite was too large to review and could not be staged naively. Current ModelRegistry treats an unknown catalog apiKey string as literal outbound authentication. If Doctor rewrote a key to a profile ID before the runtime change, that profile ID could be sent as the bearer token, or an occupied default profile could silently select the wrong key.
The safe first stage therefore does exactly this:
No SQLite schema or protocol version changes are required. This writes existing auth-profile rows only.
The original combined rewrite was production +566/-73 and tests +290/-13. The first migration extraction was production +422/-0. After the split and cleanup pass, this PR is production +341/-8 and tests +249/-0. The remaining production growth is the Doctor-owned storage migration boundary; catalog serialization and runtime auth are no longer mixed into it.
User Impact
Running openclaw doctor --fix copies and verifies existing model credentials in SQLite without changing which credential current runtime uses. Existing config and catalogs remain byte-identical, so this stage cannot strand an operator between the old and new credential paths.
This PR alone does not stop future plaintext catalog writes and does not claim the exposure is fixed. The runtime-security follow-up must land after this migration; it will stop serialization, consume verified profile references, and delete catalog request-auth fallback with no runtime dual-read.
Evidence
Pre-fix direction: current main has no Doctor migration, so the regression suite fails because the migration module and SQLite copies do not exist.
Post-fix focused proof on current main base:
ClawSweeper's prior findings are addressed by the split: config is not rewritten before discovery understands references, inherited main references are covered, and commented root catalogs use the runtime parser. The old runtime-auth and serialization rank-up moves belong to the ordered follow-up and are intentionally not hidden in this migration PR.