← Back to PRs

#18988: feat(config): add support for config warnings and improve validation

by saurav470 open 2026-02-17 07:26 View on GitHub →
commands size: S
Fixes #18968 — Graceful handling of invalid models.providers.<key>.api When openclaw.json had an invalid value for models.providers.<provider>.api (e.g. "google-genai" instead of "google-generative-ai"), the Gateway exited on Zod validation and went into a crash loop. Validation: If the only validation errors are under models.providers.<key>, we now strip those providers and re-validate instead of failing the whole config. The snapshot is valid, so the Gateway starts and other providers keep working. Warnings: Disabled providers are recorded as config warnings (path + message, with supported API types when the error is about .api). Status: openclaw status shows a “Model providers” row when any provider was disabled due to invalid config. <!-- greptile_comment --> <h3>Greptile Summary</h3> Adds graceful handling for invalid model provider configurations by stripping problematic providers and displaying warnings rather than crashing the Gateway. - Introduced `tryValidateConfigRawWithLenientModelProviders` that validates configs and strips invalid providers if they're the only validation errors - Config warnings are now surfaced in `openclaw status` command under "Model providers" when providers are disabled - Updated `MODEL_API_VALUES` to derive from `ModelApiSchema` as previously suggested, ensuring error messages stay in sync - Added comprehensive test coverage for the new validation behavior <h3>Confidence Score: 5/5</h3> - Safe to merge with thorough implementation and good test coverage - The implementation is well-designed with proper error handling, fallback logic for `structuredClone`, comprehensive validation flow, and appropriate test coverage. The graceful degradation approach prevents crashes while maintaining system functionality. - No files require special attention <sub>Last reviewed commit: d923068</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs