Repository navigation
feat(doctor): offer provider wildcards for copied model allowlists - #190031
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesDoctor offers to replace copied exact model allowlists with provider-prefix wildcards after interactive confirmation. Example: The model map and allowlist both contain openai/gpt-6-luna.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR provides a useful, explicitly confirmed Doctor improvement; the updated stable-upgrade evidence resolves the previous blocker, and no actionable correctness findings remain. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherDoctor reads the migrated model configuration, identifies matching exact allowlists, requests operator consent, and passes accepted changes to its existing guarded config writer. flowchart TD
A[Existing model configuration] --> B[Doctor migration]
B --> C[Copied allowlist detection]
C --> D[Interactive confirmation]
D --> E[Existing guarded config writer]
E --> F[Config backup and saved wildcards]
F --> G[Existing model policy matching]
Technical reviewBest possible solution: Keep the consent-based offer in Doctor’s existing model-policy and config-write owners. Do we have a high-confidence way to reproduce the issue? Current main deliberately preserves exact legacy restrictions, so later models remain excluded; the PR supplies real Doctor runs exercising the proposed recovery, which this read-only review did not rerun. Is this the best way to solve the issue? The change preserves the original migration contract, uses existing wildcard parsing and persistence, and adds no competing state owner or automatic broadening. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2952110b2a14. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +163, Tests +123, Docs +22. Total +308 across 4 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)Reviewed November 1, 2026, 1:07 AM ET / 05:07 UTC (Revision 3). |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 887cf72. Interactive |
…penclaw#190031) ## Summary - **Problem:** the legacy config migration copied `agents.defaults.models` keys into `agents.defaults.modelPolicy.allow` to keep old restrictions. That exact list hides every model added later. Operators only see that new models are missing from the picker. - **Fix:** an interactive `openclaw doctor` detects an allowlist (default or per-agent) that contains only exact refs matching the `agents.defaults.models` keys, shows the current list and a provider-wildcard replacement, and asks "Allow all models from these providers instead?" The default is No. Wildcards keep the provider family: `clawrouter/anthropic/claude-opus-5-5` becomes `clawrouter/anthropic/*`. Yes writes through the normal Doctor config write, which keeps the `.bak` backup and prints the change panel only after the write commits. - **Never without an answer:** `--yes`, `--non-interactive`, runs without a terminal, and `openclaw update` leave the list unchanged. A list that differs from the model map, or already has a wildcard, counts as handcrafted and is not offered. No schema change: a declined offer is asked again on the next interactive run. ## User impact Operators with a copied allowlist can allow all models from the providers already in that list with one answer. It does not add new providers; a new provider's models are allowed through its credential setup. Handcrafted lists and unattended runs stay unchanged. ## Evidence Real `pnpm openclaw doctor` in a pseudo-terminal, isolated `HOME`, `OPENCLAW_STATE_DIR` and `OPENCLAW_CONFIG_PATH`, config with a 3-model copied allowlist: ```text ◇ Model policy │ Your allowed-models list matches your per-model settings, so new │ models from these providers stay hidden. │ agents.defaults.modelPolicy.allow │ now: openai/gpt-6-luna, openai/gpt-6-astra, │ clawrouter/anthropic/claude-opus-5-5 │ new: openai/*, clawrouter/anthropic/* ◆ Allow all models from these providers instead? ○ Yes / ● No ... Doctor: Write config ◇ Doctor changes │ - agents.defaults.modelPolicy.allow: openai/*, clawrouter/anthropic/* Updated config: <state>/openclaw.json Backup: <state>/openclaw.json.bak ``` - Yes: `allow` became `["openai/*","clawrouter/anthropic/*"]`; the `agents.defaults.models` map kept its entries; `openclaw.json.bak` holds the old list. - No: `allow` unchanged. - `pnpm openclaw doctor --fix --yes` with no terminal: no prompt, `allow` unchanged. - Upgrade from a legacy config (no `meta.migrations` marker, no `modelPolicy`, a 3-entry `agents.defaults.models` map with aliases): Doctor's existing migration copied the map to `modelPolicy.allow`, the offer then appeared in the same run, and Yes produced `["openai/*","clawrouter/anthropic/*"]`. Aliases, the primary model and the model map were unchanged, and the marker was stamped. The `Doctor changes` panel printed after the `Write config` step. ### Upgrade from v2026.10.9 Published `[email protected]` (npm, Node 24.22.1) in an isolated `HOME`, state and config, starting from a legacy config: no `meta.migrations` marker, no `modelPolicy`, and an `agents.defaults.models` map of 3 entries with aliases. 1. v2026.10.9 `openclaw doctor --fix --yes --non-interactive`: copied the map to `modelPolicy.allow` (3 exact refs) and stamped `meta.migrations.modelPolicyAllowlist`, creating 3,459 state files. 2. Candidate `openclaw doctor` (interactive), answer **No**: config unchanged compared with step 1 (no differing keys). 3. Candidate `openclaw doctor` (interactive), answer **Yes**: the only config changes compared with step 2: - `agents.defaults.modelPolicy.allow`: 3 exact refs → `["openai/*","clawrouter/anthropic/*"]` - `wizard.lastRunAt` (write metadata) - `meta.migrations.skillWorkshopPlugin: true` (stamped by the existing config writer on any candidate write; not part of this change) Aliases, the primary model and the model map kept their v2026.10.9 values. 4. Candidate `openclaw config validate` on the result: valid. Stored data: no schema, state or database change. The only write is the existing config file through the Doctor writer. Tests: `src/commands/doctor/shared/legacy-runtime-model-policy.wildcards.test.ts` (yes, no, `--yes`, `--non-interactive`, no terminal, update in progress, handcrafted subset, existing wildcard, per-agent copy; the accepted case asserts that the offer prints no change panel itself). `pnpm test <file> --maxWorkers=1`: 9 passed, about 31 s wall (about 1 s of test time; the rest is suite setup). Doctor contribution suites (`doctor-health-contributions`, `update-scope`, `availability`): 98 passed. `pnpm check:changed` green. No overlap with Pash/Sarah changes. ## Merge danger A two-way door: a revert removes the offer. Accepted conversions are ordinary config edits with a `.bak` backup. Blast radius: interactive Doctor runs on configs whose allowlist equals the model map keys. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Summary
agents.defaults.modelskeys intoagents.defaults.modelPolicy.allowto keep old restrictions. That exact list hides every model added later. Operators only see that new models are missing from the picker.openclaw doctordetects an allowlist (default or per-agent) that contains only exact refs matching theagents.defaults.modelskeys, shows the current list and a provider-wildcard replacement, and asks "Allow all models from these providers instead?" The default is No. Wildcards keep the provider family:clawrouter/anthropic/claude-opus-5-5becomesclawrouter/anthropic/*. Yes writes through the normal Doctor config write, which keeps the.bakbackup and prints the change panel only after the write commits.--yes,--non-interactive, runs without a terminal, andopenclaw updateleave the list unchanged. A list that differs from the model map, or already has a wildcard, counts as handcrafted and is not offered. No schema change: a declined offer is asked again on the next interactive run.User impact
Operators with a copied allowlist can allow all models from the providers already in that list with one answer. It does not add new providers; a new provider's models are allowed through its credential setup. Handcrafted lists and unattended runs stay unchanged.
Evidence
Real
pnpm openclaw doctorin a pseudo-terminal, isolatedHOME,OPENCLAW_STATE_DIRandOPENCLAW_CONFIG_PATH, config with a 3-model copied allowlist:allowbecame["openai/*","clawrouter/anthropic/*"]; theagents.defaults.modelsmap kept its entries;openclaw.json.bakholds the old list.allowunchanged.pnpm openclaw doctor --fix --yeswith no terminal: no prompt,allowunchanged.meta.migrationsmarker, nomodelPolicy, a 3-entryagents.defaults.modelsmap with aliases): Doctor's existing migration copied the map tomodelPolicy.allow, the offer then appeared in the same run, and Yes produced["openai/*","clawrouter/anthropic/*"]. Aliases, the primary model and the model map were unchanged, and the marker was stamped. TheDoctor changespanel printed after theWrite configstep.Upgrade from v2026.10.9
Published
[email protected](npm, Node 24.22.1) in an isolatedHOME, state and config, starting from a legacy config: nometa.migrationsmarker, nomodelPolicy, and anagents.defaults.modelsmap of 3 entries with aliases.v2026.10.9
openclaw doctor --fix --yes --non-interactive: copied the map tomodelPolicy.allow(3 exact refs) and stampedmeta.migrations.modelPolicyAllowlist, creating 3,459 state files.Candidate
openclaw doctor(interactive), answer No: config unchanged compared with step 1 (no differing keys).Candidate
openclaw doctor(interactive), answer Yes: the only config changes compared with step 2:agents.defaults.modelPolicy.allow: 3 exact refs →["openai/*","clawrouter/anthropic/*"]wizard.lastRunAt(write metadata)meta.migrations.skillWorkshopPlugin: true(stamped by the existing config writer on any candidate write; not part of this change)Aliases, the primary model and the model map kept their v2026.10.9 values.
Candidate
openclaw config validateon the result: valid.Stored data: no schema, state or database change. The only write is the existing config file through the Doctor writer.
Tests:
src/commands/doctor/shared/legacy-runtime-model-policy.wildcards.test.ts(yes, no,--yes,--non-interactive, no terminal, update in progress, handcrafted subset, existing wildcard, per-agent copy; the accepted case asserts that the offer prints no change panel itself).pnpm test <file> --maxWorkers=1: 9 passed, about 31 s wall (about 1 s of test time; the rest is suite setup). Doctor contribution suites (doctor-health-contributions,update-scope,availability): 98 passed.pnpm check:changedgreen.No overlap with Pash/Sarah changes.
Merge danger
A two-way door: a revert removes the offer. Accepted conversions are ordinary config edits with a
.bakbackup. Blast radius: interactive Doctor runs on configs whose allowlist equals the model map keys.🤖 Generated with Claude Code