Skip to content

Reject unknown thinking_budget effort levels at parse time#2142

Merged
dgageot merged 1 commit intodocker:mainfrom
dgageot:reject-unknown-budgets
Mar 17, 2026
Merged

Reject unknown thinking_budget effort levels at parse time#2142
dgageot merged 1 commit intodocker:mainfrom
dgageot:reject-unknown-budgets

Conversation

@dgageot
Copy link
Copy Markdown
Member

@dgageot dgageot commented Mar 17, 2026

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

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
@dgageot dgageot requested a review from a team as a code owner March 17, 2026 08:30
Copy link
Copy Markdown

@docker-agent docker-agent bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@dgageot dgageot merged commit 9aed64e into docker:main Mar 17, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants