← Back to PRs

#23155: fix: add modelByChannel to allowed channel config keys

by tiagocampo open 2026-02-22 02:37 View on GitHub →
size: XS
## 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