Skip to content

feat(doctor): offer provider wildcards for copied model allowlists - #190031

Merged
obviyus merged 2 commits into
mainfrom
fix/doctor-offer-model-allowlist-wildcards
Nov 1, 2026
Merged

obviyus merged 2 commits into
mainfrom
fix/doctor-offer-model-allowlist-wildcards

Conversation

@obviyus

@obviyus obviyus commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

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:

◇  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

@clawsweeper

clawsweeper Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime commands Command implementations size: M labels Nov 1, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Doctor 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.

  • Before: Other OpenAI models remain excluded by the exact allowlist.
  • After: Accepting the offer changes the allowlist to openai/* while preserving per-model settings; declining preserves the restriction.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused implementation with shipped CLI evidence, stable-upgrade preservation, successful current-head checks, and no remaining findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Reported isolated CLI runs exercise the changed Doctor contribution through actual persistence: Yes saves prefix wildcards with a backup, No and unattended execution preserve restrictions, and the published-v2026.10.9 upgrade preserves model settings and validates successfully.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Operators with migrated exact allowlists cannot see newly added models from providers they already use.
Reason: The maintainer-authored direction provides a default-No recovery choice while preserving unattended behavior and existing settings.

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
Reviewed head: 538ac4a16f32c5850fd16baa2b12daca5e6c4feb

Before merge

None.

Findings

None.

Agent review details

How this fits together

Doctor 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]
Loading

Technical review

Best 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

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +163, Tests +123, Docs +22. Total +308 across 4 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 2 163 0 +163
Tests 1 123 0 +123
Docs 1 22 0 +22
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 308 0 +308

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded interactive improvement for operators whose migrated model restrictions hide newly available models.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-01T03:36:48.060Z sha e2675a4 :: blocked before merge. :: [P3] Announce accepted changes only after the config write commits | [P3] Limit the advertised recovery to existing provider prefixes
  • reviewed 2026-11-01T04:57:17.910Z sha 538ac4a :: blocked before merge. :: none

Reviewed November 1, 2026, 1:07 AM ET / 05:07 UTC (Revision 3).

@obviyus

obviyus commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 1, 2026
@obviyus

obviyus commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 1, 2026
@obviyus
obviyus merged commit 887cf72 into main Nov 1, 2026
162 checks passed
@obviyus
obviyus deleted the fix/doctor-offer-model-allowlist-wildcards branch November 1, 2026 06:04
@obviyus

obviyus commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in 887cf72. Interactive openclaw doctor now offers to replace a copied exact model allowlist with provider wildcards (default No; never under --yes, --non-interactive, no terminal, or update). Proof: real Doctor runs for yes, no and --fix --yes, plus an upgrade from published v2026.10.9 where only the allowlist changed.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 2, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant