#23155: fix: add modelByChannel to allowed channel config keys
size: XS
Cluster:
Wizard Enhancements and Config Fixes
## Summary
Fixes #23146
The validator was incorrectly rejecting `modelByChannel` as an "unknown channel id" because it only allowed actual channel IDs (telegram, whatsapp, etc.) and 'defaults' in the channels object.
## Problem
`modelByChannel` is a config property introduced in PR #22315 that maps channel IDs to model overrides. It's not a channel itself, but the validation logic was treating ALL keys in `channels` object as potential channel IDs.
## Solution
Add `"modelByChannel"` to the `allowedChannels` set in the validation logic, alongside `"defaults"`.
## Changes
- Modified `src/config/validation.ts` line 240
- Changed: `new Set<string>(["defaults", ...CHANNEL_IDS])`
- To: `new Set<string>(["defaults", "modelByChannel", ...CHANNEL_IDS])`
## Testing
The fix is a one-line change that allows the existing `modelByChannel` feature to work as intended. CI tests should pass.
## Example config that now works
```json
{
"channels": {
"modelByChannel": {
"telegram": {
"-1001234567890:topic:1466": "google-antigravity/gemini-3-flash"
}
}
}
}
```
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixed validation error that incorrectly rejected `modelByChannel` as an unknown channel ID by adding it to the allowed channel config keys.
- The fix correctly addresses the validation logic that was treating `modelByChannel` as a channel ID when it's actually a configuration property
- The one-line change aligns the validation with the schema definition in `src/config/zod-schema.providers.ts:34`
- Log file `openclaw-2026-02-21.log` should be removed as it was accidentally committed
<h3>Confidence Score: 4/5</h3>
- Safe to merge after removing the log file
- The fix is straightforward and correct - it adds a single missing entry to the validation allowlist that matches the schema definition. The log file accidentally committed prevents a score of 5.
- Remove `openclaw-2026-02-21.log` before merging
<sub>Last reviewed commit: ee7a5d6</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#23211: fix: include modelByChannel in allowed channels validator
by westerbamos · 2026-02-22
92.3%
#22998: fix(config): add modelByChannel to allowed channels keys
by bbekdemir · 2026-02-21
91.7%
#22870: fix(config): allow modelByChannel in channels validation allowlist
by darcuri · 2026-02-21
90.5%
#19020: bugfix(gateway): Handle invalid model provider API config gracefully\…
by funkyjonx · 2026-02-17
75.6%
#20136: Telegram: fix cross-provider model checkmark in /models keyboard
by powerdot · 2026-02-18
75.3%
#16290: fix: add field-level validation for custom LLM provider config
by superlowburn · 2026-02-14
74.9%
#6603: fix: use allowAny flag instead of size check for model override val...
by gavinbmoore · 2026-02-01
74.6%
#21998: fix(models): prioritize exact model-id match over fuzzy scoring (#2...
by lailoo · 2026-02-20
74.5%
#9064: fix: validate model references against catalog in config.set/patch/...
by joetomasone · 2026-02-04
74.5%
#20878: fix: Widen models.input to accept "video" and "audio" modalities
by marcodelpin · 2026-02-19
74.0%