Skip to content

fix(config): model policy refs padded around the provider/model separator fail config validation - #114116

Merged
steipete merged 3 commits into
openclaw:mainfrom
masatohoshino:model-policy-ref-segment-trim
Jul 27, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
masatohoshino:model-policy-ref-segment-trim

Conversation

@masatohoshino

@masatohoshino masatohoshino commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

agents.defaults.modelPolicy.allow rejected exact refs padded around the provider/model separator, such as " openai / gpt-5.5 ", even though the shared model-catalog parser and runtime normalize that boundary. The invalid-policy result rejects the whole config at load time.

The same bug class affected prefix wildcards: separator padding such as " openai / * " or " clawrouter / anthropic / * " was rejected before the wildcard key could be canonicalized.

Why This Change Was Made

The fix stays in the shared model-policy reference parser used by both default and per-agent policies:

  • Exact refs validate the provider and model-id segments returned by parseModelCatalogRef, so only the provider/remainder boundary normalization already owned by the dependency is accepted.
  • Wildcard refs split and trim segment boundaries before requiring a terminal * and applying the existing segment validation. Canonical nested prefixes remain namespace-scoped.

This is acceptance-only normalization. The config shape remains string[], so exported types, Zod shape, help, labels, generated baselines, and docs do not change; no doctor migration is needed.

User Impact

Hand-written model allowlists with harmless separator padding now load and resolve to the same canonical exact or prefix policy as their unpadded form. Internal identifier whitespace, control characters, empty segments, malformed stars, and nonterminal wildcards remain rejected.

Evidence

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Jul 26, 2026
@masatohoshino
masatohoshino marked this pull request as ready for review July 26, 2026 14:09
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Jul 26, 2026
@clawsweeper

clawsweeper Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 27, 2026, 5:54 PM ET / 21:54 UTC.

ClawSweeper review

What this changes

The PR makes model-policy allowlists accept harmless whitespace around provider/model and wildcard separator boundaries while continuing to reject malformed model references.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This remains an active, focused bug-fix PR. Its latest branch normalizes separator padding for exact and wildcard model-policy references while preserving malformed-reference rejection; the provided real-behavior proof and focused coverage support ordinary maintainer review, but the branch is behind current main and should receive a current-head merge refresh before landing.

Priority: P2
Reviewed head: fbb620892e7850addf18460ed0e46cd412603437

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-covered repair with credible real behavior evidence; final integration confidence depends on refreshing the behind branch against current main.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR provides an observed pre-fix config-load rejection plus exact-head focused Testbox results and hosted changed-check evidence; no private data is exposed in the supplied proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR provides an observed pre-fix config-load rejection plus exact-head focused Testbox results and hosted changed-check evidence; no private data is exposed in the supplied proof.
Evidence reviewed 4 items Focused validation change: The branch changes the shared model-policy parser so wildcard segments are trimmed before validation and exact references are validated from the parsed provider and model-id components.
Regression coverage: The branch adds config-validation cases for default and per-agent policies plus malformed inputs, and runtime visibility coverage for a padded nested wildcard remaining namespace-scoped.
Real behavior proof: The PR body reports an observed rejection on then-current main, a focused exact-head Testbox run with 45/45 passing tests, and a hosted changed-check run; this is stronger than mock-only evidence for this config-loader behavior.
Findings None None.
Security None None.

How this fits together

OpenClaw validates configured model-policy allowlists during config loading, then turns accepted references into policy rules that filter the models visible to agents. This change sits between hand-written config input and runtime model-catalog matching.

flowchart LR
  A[OpenClaw config] --> B[Model-policy allowlist]
  B --> C[Reference validation]
  C --> D[Canonical exact or wildcard rule]
  D --> E[Model catalog matching]
  E --> F[Agent-visible models]
Loading

Before merge

  • Resolve merge risk (P1) - GitHub reports the branch as behind current main; refresh the merge result and required checks at the final head before landing so the proof covers the actual integration state.
  • Complete next step (P2) - No discrete automated repair is identified; this PR needs ordinary maintainer review and a final current-main integration refresh.
Agent review details

Security

None.

PR surface

Source +3, Tests +81. Total +84 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 10 7 +3
Tests 2 81 0 +81
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 91 7 +84

Review metrics

Metric Value Why it matters
Validation normalization 2 acceptance paths changed: exact refs and prefix wildcards Both paths feed config-load acceptance, while the schema remains the existing string[] allowlist contract.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the narrow shared-parser repair after updating it against current main and confirming the final merge head retains the exact-reference and nested-wildcard regression coverage.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the narrow shared-parser repair after updating it against current main and confirming the final merge head retains the exact-reference and nested-wildcard regression coverage.

Do we have a high-confidence way to reproduce the issue?

Unclear for the exact current main SHA because this read-only review could not independently execute the reproduction, but the PR documents a concrete config-loader failure on then-current main and the changed parser path directly explains it.

Is this the best way to solve the issue?

Yes, provisionally: placing boundary-only normalization in the shared policy-reference parser avoids adding a new config shape or duplicating behavior across default and per-agent policy validation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 428b5cc7df17.

Labels

Label justifications:

  • P2: This fixes a bounded configuration-validation regression that prevents otherwise valid model-policy allowlists from loading.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR provides an observed pre-fix config-load rejection plus exact-head focused Testbox results and hosted changed-check evidence; no private data is exposed in the supplied proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR provides an observed pre-fix config-load rejection plus exact-head focused Testbox results and hosted changed-check evidence; no private data is exposed in the supplied proof.

Evidence

What I checked:

  • Focused validation change: The branch changes the shared model-policy parser so wildcard segments are trimmed before validation and exact references are validated from the parsed provider and model-id components. (src/config/model-policy-ref.ts:39, fbb620892e78)
  • Regression coverage: The branch adds config-validation cases for default and per-agent policies plus malformed inputs, and runtime visibility coverage for a padded nested wildcard remaining namespace-scoped. (src/config/config.model-ref-validation.test.ts:177, fbb620892e78)
  • Real behavior proof: The PR body reports an observed rejection on then-current main, a focused exact-head Testbox run with 45/45 passing tests, and a hosted changed-check run; this is stronger than mock-only evidence for this config-loader behavior. (fbb620892e78)
  • Review continuity: The prior completed ClawSweeper cycle reported no findings. The latest branch adds maintainer-authored follow-up commits that specifically simplify normalization and cover padded policy wildcards. (src/config/model-policy-ref.ts:39, fbb620892e78)

Likely related people:

  • steipete: The PR’s two latest commits refine the normalization design and add the padded-wildcard repair; the PR is also assigned to this contributor, making them the clearest routing candidate from the available history. (role: recent area contributor; confidence: medium; commits: 66e10ce702fc, fbb620892e78; files: src/config/model-policy-ref.ts, src/config/model-policy-ref.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Update the branch against current main and let required checks complete on the final merge head.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-07-26T14:13:30.424Z sha b6e0701cb361694e7572dbc653ec7370cdae5e06 :: needs maintainer review before merge. :: none

@steipete steipete self-assigned this Jul 27, 2026
masatohoshino and others added 3 commits July 27, 2026 14:46
…l separator

Model policy ref validation split refs on / and rejected any component
containing whitespace, so " openai / gpt-5.5 " failed config validation even
though parseProviderModelRef in @openclaw/model-catalog-core trims the
provider and the model remainder and the runtime resolves the ref fine.
Allow-list validation is newer than that resolution path, so configs that
loaded before started failing at load.

Validate the values parseModelCatalogRef returns — the resolved provider and
the whole model remainder — keeping empty-path-segment rejection, so padding
around the separator is accepted while whitespace inside the resolved model id
stays rejected. Wildcard prefixes trim per segment, since their canonical key
is matched on segment boundaries; a padded nested prefix now keeps its
namespace instead of failing validation.
@steipete
steipete force-pushed the model-policy-ref-segment-trim branch from b6e0701 to fbb6208 Compare July 27, 2026 21:49
@steipete

Copy link
Copy Markdown
Contributor

Maintainer landing proof for fbb620892e7850addf18460ed0e46cd412603437:

@steipete
steipete merged commit 0d32f85 into openclaw:main Jul 27, 2026
124 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 28, 2026
…ator fail config validation (openclaw#114116)

* fix(config): accept model policy refs padded around the provider/model separator

Model policy ref validation split refs on / and rejected any component
containing whitespace, so " openai / gpt-5.5 " failed config validation even
though parseProviderModelRef in @openclaw/model-catalog-core trims the
provider and the model remainder and the runtime resolves the ref fine.
Allow-list validation is newer than that resolution path, so configs that
loaded before started failing at load.

Validate the values parseModelCatalogRef returns — the resolved provider and
the whole model remainder — keeping empty-path-segment rejection, so padding
around the separator is accepted while whitespace inside the resolved model id
stays rejected. Wildcard prefixes trim per segment, since their canonical key
is matched on segment boundaries; a padded nested prefix now keeps its
namespace instead of failing validation.

* refactor(config): simplify model policy normalization

* fix(config): normalize padded policy wildcards

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

2 participants