Repository navigation
fix(config): model policy refs padded around the provider/model separator fail config validation - #114116
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 27, 2026, 5:54 PM ET / 21:54 UTC. ClawSweeper reviewWhat this changesThe PR makes model-policy allowlists accept harmless whitespace around provider/model and wildcard separator boundaries while continuing to reject malformed model references. Merge readinessThis 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 Priority: P2 Review scores
Verification
How this fits togetherOpenClaw 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]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +3, Tests +81. Total +84 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the narrow shared-parser repair after updating it against current Do we have a high-confidence way to reproduce the issue? Unclear for the exact current 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. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
…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.
b6e0701 to
fbb6208
Compare
|
Maintainer landing proof for
|
|
Merged via squash.
|
…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]>
What Problem This Solves
agents.defaults.modelPolicy.allowrejected 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:
parseModelCatalogRef, so only the provider/remainder boundary normalization already owned by the dependency is accepted.*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
a04ba3a4683cad2a7d2fbc186add956575e3a27d: padded exact ref rejected atagents.defaults.modelPolicy.allow.0in Testbox run https://github.com/openclaw/openclaw/actions/runs/30306810430.model-catalog-coreparser contracts.pnpm check:changedpassed on Blacksmith Testboxtbx_01kyjr6n39memj3z6yfhpefh25, run https://github.com/openclaw/openclaw/actions/runs/30307659001.agents.list, andagents.entriespolicy paths; both-sided top-level and nested wildcard padding; malformed exact/wildcard inputs; and nested runtime scope.NO-ACTIONABLE-OBJECTION.