feat: add GPT-5.4 support and auto-fallback for future GPT-5.x sub-versions#13293
feat: add GPT-5.4 support and auto-fallback for future GPT-5.x sub-versions#13293
Conversation
Replace manual exclusion list with regex `gpt-5(?!\.\d)` to automatically exclude all sub-versions (gpt-5.1, gpt-5.2, etc.). Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: icarus <[email protected]>
Add isGPT5FamilyModel to match all GPT-5 family models (gpt-5, gpt-5.1, gpt-5.2, etc.). Expand test coverage for both isGPT5FamilyModel and isGPT5SeriesModel with future sub-version cases. Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: icarus <[email protected]>
Signed-off-by: icarus <[email protected]>
Cover codex exclusion and future GPT-5.x sub-version scenarios for isSupportVerbosityModel, isSupportNoneReasoningEffortModel, and isSupportedReasoningEffortOpenAIModel. Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: icarus <[email protected]>
Simplify isSupportVerbosityModel, isSupportNoneReasoningEffortModel, and isSupportedReasoningEffortOpenAIModel by replacing manual isGPT5Series || isGPT51 || isGPT52 checks with isGPT5FamilyModel. Add codex exclusion for verbosity and none-reasoning-effort models. Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: icarus <[email protected]>
Allow codex variants from GPT-5.3 onwards to use reasoning_effort "none". GPT-5.1/5.2 codex models remain excluded. Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: icarus <[email protected]>
GPT-5.2 codex does not support none reasoning effort. Add a dedicated gpt5_2_codex type with [low, medium, high, xhigh] options, while GPT-5.3+ codex falls back to gpt5_2 which includes none. Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: icarus <[email protected]>
Update tests to match isSupportVerbosityModel now being isGPT5FamilyModel. Chat/codex exclusion is handled by MODEL_SUPPORTED_VERBOSITY validators: - Chat models get medium only - Old codex (5.1/5.2) gets medium only - New codex (5.3+) gets all levels - Pro models get all levels Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: icarus <[email protected]>
|
NOTE: text verbosity and reasoning effort have been tested across all variants of the GPT 5 family models via OpenAI's official responses API. |
Replace `() => true` with `isGPT5FamilyModel` for clearer semantics. Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: icarus <[email protected]>
EurFelux
left a comment
There was a problem hiding this comment.
Self-Review Summary 🐱
Overall: Looks good! The architecture is clean and the approach is well-thought-out. CI passes (basic-checks ✅, render-test ✅, skills-check-windows ✅).
What I like
- Regex negative lookahead for
isGPT5SeriesModelis elegant and future-proof — no more manual exclusion lists - Two-tier architecture (
isGPT5FamilyModelas broad guard + sub-version checks) makes fallback behavior natural - Decoupling
isSupportVerbosityModelfrom granular level control is a good separation of concerns - Comprehensive test coverage for all the new code paths, including future model scenarios
Minor items (all nits)
- Dead first validator in
MODEL_SUPPORTED_VERBOSITY— the!isSupportVerbosityModelcheck is already handled by the early return before the loop - Outdated JSDoc on
getModelSupportedVerbosity— still references old behavior (gpt-5-pro = high only) - Ambiguous comments — "5.2 and after 5.x" and "Fallback for GPT-5.x sub-versions (5.2+)" could be clearer about what they cover
No blocking issues found. Ready for external review.
DeJeune
left a comment
There was a problem hiding this comment.
Review Summary
Well-structured PR that improves GPT-5.x model detection scalability. The regex negative lookahead for isGPT5SeriesModel and the isGPT5FamilyModel umbrella guard are good design choices. Test coverage is comprehensive and the PR description is excellent.
Critical / Significant
-
isSupportNoneReasoningEffortModelvsMODEL_SUPPORTED_REASONING_EFFORTinconsistency — After this PR,isSupportNoneReasoningEffortModelreturnsfalseforgpt-5.1-codexandgpt-5.1-codex-max, but their reasoning effort options inreasoning.tsstill includenone. Users can selectnonein the UI, but the parameter won't be sent to the API (falls through to a warning log inaiCore/utils/reasoning.ts:157). Either removenonefrom the options or adjust theisOldCodexguard to only exclude GPT-5.2 codex. -
isSupportVerbosityModelbehavioral change impacts multiple consumers — Now returnstruefor chat/codex models (previouslyfalse). This affectsOpenAIResponseAPIClient.ts(now sendstext.verbosityfor chat models), and UI components (shows a verbosity dropdown with onlymediumfor chat models). Please verify the API tolerates thetext.verbosityfield for chat endpoints.
Minor / Nits
isGPT5FamilyModelcould false-match hypothetical model names likegpt-50.- Missing test for base
gpt-5.2verbosity (non-codex, non-pro, non-chat).
Positives
- Regex negative lookahead for
isGPT5SeriesModelis a clean, scalable solution. isGPT5FamilyModel+ specific sub-version checks inside_getThinkModelTypeis a good architectural pattern.- Automatic fallback for GPT-5.3+ to
gpt5_2/gpt52protypes is well thought out. - Thorough test coverage for all new edge cases and future model variants.
- Excellent PR description with clear rationale and tradeoffs.
Improve comment clarity for fallback logic and update outdated JSDoc for getModelSupportedVerbosity to reflect version-aware behavior. Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: icarus <[email protected]>
GPT-5.1 codex and codex-max do not support reasoning_effort: none. Remove none from their option lists and update tests accordingly. Also add missing gpt-5.2 base verbosity test case. Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: icarus <[email protected]>
GeorgeDong32
left a comment
There was a problem hiding this comment.
Code Review Summary
Overall: APPROVED ✅
Excellent PR with a clean architecture and comprehensive test coverage. The regex negative lookahead for isGPT5SeriesModel is elegant and future-proof.
Verified
- ✅ Lint checks pass
- ✅ All 2521 tests pass
- ✅ TypeScript compilation successful
- ✅ Issue #2 (verbosity API compatibility) - Confirmed by EurFelux that OpenAI API was tested
Minor Suggestions (Optional)
-
Dead code in MODEL_SUPPORTED_VERBOSITY (
utils.ts:225-229)- The first validator
!isSupportVerbosityModelis never reached since there's already an early return ingetModelSupportedVerbosity - Consider removing it for cleaner code
- The first validator
-
Potential false match in isGPT5FamilyModel (
openai.ts:70-73)- Current:
modelId.includes('gpt-5')could match hypothetical models likegpt-50,gpt-500 - Suggestion: Consider using a more precise regex like
/^gpt-5(\.\d+)?(-[\w-]+)?$/i
- Current:
-
Missing test case
- Base
gpt-5.2verbosity test (non-codex, non-pro, non-chat) is covered in the diff but could be explicitly added
- Base
Positives
- Regex negative lookahead is clean and scalable
- Two-tier architecture (isGPT5FamilyModel + sub-version checks) is well-designed
- Automatic fallback for GPT-5.3+ is a smart approach
- Excellent PR description with clear rationale
Great work! Ready to merge. 🚀
…overage Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: icarus <[email protected]>
|
Thanks for the review @GeorgeDong32! 🙏 Regarding your suggestions:
|
### What this PR does Before this PR: - Version is 1.7.24 After this PR: - Version is 1.7.25 - Release notes updated in `electron-builder.yml` ### Why we need it and why it was done in this way Standard release workflow: collect commits since v1.7.24, generate bilingual release notes, bump version. The following tradeoffs were made: N/A The following alternatives were considered: N/A ### Breaking changes **Action Required**: The built-in filesystem MCP server now requires manual approval for write/edit/delete operations by default. ### Special notes for your reviewer **Included commits since v1.7.24:** ✨ New Features: - feat(websearch): add Querit search provider (#13050) - feat(minapp,provider): add MiniMax Agent, IMA mini apps and MiniMax Global, Z.ai providers (#13099) - feat(provider): add agent support filter for provider list (#11932) - feat(agent): add custom environment variables to agent configuration (#13357) - feat: add GPT-5.4 support (#13293) - feat(gemini): add thought signature persistence (#13100) 🐛 Bug Fixes: - fix: secure built-in filesystem MCP root handling (#13294) - fix: check underlying tool permissions for hub invoke/exec (#13282) - fix: remove approval countdown timers and add system notifications (#13281) - fix: agent tool status not stopping on abort (#13111) - fix: resolve spawn ENOENT on Windows for Code Tools (#13405) - fix: Use default assistant for topic auto-renaming (#13387) - fix(backup): defer auto backup during streaming response (#13307) - fix(ui): fix Move To submenu overflow (#13399) - fix: render xml fenced svg blocks as svg previews (#13431) - fix: correct Gemini reasoning params (#13388) - fix: improve Qwen 3.5 reasoning model detection (#13235) - fix: upgrade xAI web search to Responses API (#12812) - fix(api-server): relax chat completion validation (#13279) - fix: install or uninstall button state issues (#13114) - fix: improve update dialog behavior (#13363) - fix: auto-convert reasoning_effort to reasoningEffort (#12831) ### Checklist - [x] PR: The PR description is expressive enough and will help future contributors - [x] Code: Write code that humans can understand and Keep it simple - [x] Refactor: You have left the code cleaner than you found it (Boy Scout Rule) - [x] Upgrade: Impact of this change on upgrade flows was considered and addressed if required - [x] Documentation: A user-guide update was considered and is present (link) or not required. - [x] Self-review: I have reviewed my own code before requesting review from others ### Release note ```release-note See release notes in electron-builder.yml ``` --------- Signed-off-by: kangfenmao <[email protected]>
What this PR does
Before this PR:
isGPT5SeriesModelused a manual exclusion list (!includes('gpt-5.1') && !includes('gpt-5.2')) that required updating for every new sub-version._getThinkModelTypeidentical to the fallback logic.gpt-5.4) would fall through to thedefaultthinking type with no reasoning effort support.nonereasoning effort from thegpt5_2type.gpt-5-proverbosity was restricted tohighonly, which no longer reflects the latest API behavior.After this PR:
isGPT5SeriesModeluses a regex negative lookahead (gpt-5(?!\.\d)) to automatically exclude all sub-versions.isGPT5FamilyModelto match the entire GPT-5 family (base + all sub-versions).isSupportVerbosityModel,isSupportNoneReasoningEffortModel, andisSupportedReasoningEffortOpenAIModelto useisGPT5FamilyModel._getThinkModelTypeusesisGPT5FamilyModelas a parent guard with an automatic fallback for unknown sub-versions (routes togpt5_2/gpt52pro).gpt5_2_codexthinking model type with[low, medium, high, xhigh](nonone).nonereasoning effort viaisSupportNoneReasoningEffortModel.mediumonly, while 5.3+ codex supports all levels.gpt-5-proverbosity updated fromhighonly to[low, medium, high], matching the latest API test results.Why we need it and why it was done in this way
The following tradeoffs were made:
The following alternatives were considered:
isGPT54SeriesModelchecks (rejected: doesn't scale, same maintenance burden as before).Breaking changes
None. All existing model detection behavior is preserved. Only new models (GPT-5.3+) gain automatic fallback support.
Behavior change:
gpt-5-proverbosity expanded fromhighonly to[low, medium, high]. This reflects updated API capabilities confirmed by testing — previously the API only supportedhigh, but now supports additional levels.Special notes for your reviewer
isGPT5FamilyModelfunction is intentionally simple (modelId.includes('gpt-5')) — it serves as a broad family guard, with specific sub-version checks handled inside.gpt5_2_codex) because it supportsxhighbut notnone, which doesn't match any existing codex type.isSupportVerbosityModelis now simplyisGPT5FamilyModel— granular exclusions (chat/codex) are handled byMODEL_SUPPORTED_VERBOSITYvalidators with a fallback tomedium.gpt-5-proverbosity change is intentional — latest API testing confirms it now supportslow,medium, andhigh(previously onlyhigh).Checklist
/gh-pr-review,gh pr diff, or GitHub UI) before requesting review from othersRelease note