Reject unknown thinking_budget effort levels at parse time#2142
Reject unknown thinking_budget effort levels at parse time#2142dgageot merged 1 commit intodocker:mainfrom
Conversation
Previously, a typo like 'thinking_budget: adaptative' was silently accepted but no provider recognized it, so thinking was never enabled. Now the YAML and JSON unmarshalers validate the effort string against the set of accepted values (none, minimal, low, medium, high, max, adaptive) and return a clear error on unrecognized input. Assisted-By: docker-agent
There was a problem hiding this comment.
Review Summary
Assessment: 🟢 APPROVE
Summary
This PR adds validation for thinking_budget effort levels to reject unknown values at parse time. The implementation is clean and correct:
✅ Validation logic: The isValidThinkingEffort function properly validates against all accepted values (none, minimal, low, medium, high, max, adaptive) with case-insensitive, trimmed matching
✅ Error handling: Clear error messages that list valid options when invalid input is detected
✅ Consistency: Validation applied to both YAML and JSON unmarshalers
✅ Test coverage: Comprehensive tests for both YAML and JSON invalid effort scenarios
✅ Error messages: User-friendly format showing the invalid value and listing all valid options
The change successfully prevents silent failures from typos like 'adaptative' and provides immediate feedback to users.
Findings
No issues detected. The code is ready to merge.
Previously, a typo like 'thinking_budget: adaptative' was silently accepted but no provider recognized it, so thinking was never enabled. Now the YAML and JSON unmarshalers validate the effort string against the set of accepted values (none, minimal, low, medium, high, max, adaptive) and return a clear error on unrecognized input.
Assisted-By: docker-agent