Skip to content

feat: add GPT-5.4 support and auto-fallback for future GPT-5.x sub-versions#13293

Merged
EurFelux merged 16 commits intomainfrom
feat/gpt-5.4
Mar 8, 2026
Merged

feat: add GPT-5.4 support and auto-fallback for future GPT-5.x sub-versions#13293
EurFelux merged 16 commits intomainfrom
feat/gpt-5.4

Conversation

@EurFelux
Copy link
Copy Markdown
Collaborator

@EurFelux EurFelux commented Mar 7, 2026

What this PR does

Before this PR:

  • isGPT5SeriesModel used a manual exclusion list (!includes('gpt-5.1') && !includes('gpt-5.2')) that required updating for every new sub-version.
  • GPT-5.2 had a dedicated branch in _getThinkModelType identical to the fallback logic.
  • Future GPT-5.x models (e.g., gpt-5.4) would fall through to the default thinking type with no reasoning effort support.
  • GPT-5.2 codex models incorrectly inherited none reasoning effort from the gpt5_2 type.
  • Verbosity support excluded all chat/codex variants uniformly, without version-aware logic.
  • gpt-5-pro verbosity was restricted to high only, which no longer reflects the latest API behavior.

After this PR:

  • isGPT5SeriesModel uses a regex negative lookahead (gpt-5(?!\.\d)) to automatically exclude all sub-versions.
  • Added isGPT5FamilyModel to match the entire GPT-5 family (base + all sub-versions).
  • Refactored isSupportVerbosityModel, isSupportNoneReasoningEffortModel, and isSupportedReasoningEffortOpenAIModel to use isGPT5FamilyModel.
  • _getThinkModelType uses isGPT5FamilyModel as a parent guard with an automatic fallback for unknown sub-versions (routes to gpt5_2/gpt52pro).
  • Added gpt5_2_codex thinking model type with [low, medium, high, xhigh] (no none).
  • GPT-5.3+ codex models support none reasoning effort via isSupportNoneReasoningEffortModel.
  • Verbosity logic is now version-aware: chat/codex variants before 5.3 fall back to medium only, while 5.3+ codex supports all levels.
  • gpt-5-pro verbosity updated from high only to [low, medium, high], matching the latest API test results.
  • Added comprehensive test coverage for all changes.

Why we need it and why it was done in this way

The following tradeoffs were made:

  • Future GPT-5.x sub-versions (5.3+) fall back to GPT-5.2 reasoning configuration, which may not be perfectly accurate but provides reasonable defaults until explicit support is added.

The following alternatives were considered:

  • Adding explicit isGPT54SeriesModel checks (rejected: doesn't scale, same maintenance burden as before).
  • Using a version parsing approach (rejected: over-engineering for the current use case).

Breaking changes

None. All existing model detection behavior is preserved. Only new models (GPT-5.3+) gain automatic fallback support.

Behavior change: gpt-5-pro verbosity expanded from high only to [low, medium, high]. This reflects updated API capabilities confirmed by testing — previously the API only supported high, but now supports additional levels.

Special notes for your reviewer

  • The isGPT5FamilyModel function is intentionally simple (modelId.includes('gpt-5')) — it serves as a broad family guard, with specific sub-version checks handled inside.
  • GPT-5.2 codex gets its own explicit branch and type (gpt5_2_codex) because it supports xhigh but not none, which doesn't match any existing codex type.
  • isSupportVerbosityModel is now simply isGPT5FamilyModel — granular exclusions (chat/codex) are handled by MODEL_SUPPORTED_VERBOSITY validators with a fallback to medium.
  • gpt-5-pro verbosity change is intentional — latest API testing confirms it now supports low, medium, and high (previously only high).

Checklist

Release note

Add GPT-5.4 model support with automatic reasoning effort configuration. Future GPT-5.x sub-versions will also be automatically supported with sensible defaults.

EurFelux and others added 10 commits March 7, 2026 23:35
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]>
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]>
@EurFelux
Copy link
Copy Markdown
Collaborator Author

EurFelux commented Mar 7, 2026

NOTE: text verbosity and reasoning effort have been tested across all variants of the GPT 5 family models via OpenAI's official responses API.

EurFelux and others added 2 commits March 8, 2026 02:51
Replace `() => true` with `isGPT5FamilyModel` for clearer semantics.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: icarus <[email protected]>
Copy link
Copy Markdown
Collaborator Author

@EurFelux EurFelux left a comment

Choose a reason for hiding this comment

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

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 isGPT5SeriesModel is elegant and future-proof — no more manual exclusion lists
  • Two-tier architecture (isGPT5FamilyModel as broad guard + sub-version checks) makes fallback behavior natural
  • Decoupling isSupportVerbosityModel from 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)

  1. Dead first validator in MODEL_SUPPORTED_VERBOSITY — the !isSupportVerbosityModel check is already handled by the early return before the loop
  2. Outdated JSDoc on getModelSupportedVerbosity — still references old behavior (gpt-5-pro = high only)
  3. 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.

Copy link
Copy Markdown
Collaborator

@DeJeune DeJeune 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

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

  1. isSupportNoneReasoningEffortModel vs MODEL_SUPPORTED_REASONING_EFFORT inconsistency — After this PR, isSupportNoneReasoningEffortModel returns false for gpt-5.1-codex and gpt-5.1-codex-max, but their reasoning effort options in reasoning.ts still include none. Users can select none in the UI, but the parameter won't be sent to the API (falls through to a warning log in aiCore/utils/reasoning.ts:157). Either remove none from the options or adjust the isOldCodex guard to only exclude GPT-5.2 codex.

  2. isSupportVerbosityModel behavioral change impacts multiple consumers — Now returns true for chat/codex models (previously false). This affects OpenAIResponseAPIClient.ts (now sends text.verbosity for chat models), and UI components (shows a verbosity dropdown with only medium for chat models). Please verify the API tolerates the text.verbosity field for chat endpoints.

Minor / Nits

  1. isGPT5FamilyModel could false-match hypothetical model names like gpt-50.
  2. Missing test for base gpt-5.2 verbosity (non-codex, non-pro, non-chat).

Positives

  • Regex negative lookahead for isGPT5SeriesModel is a clean, scalable solution.
  • isGPT5FamilyModel + specific sub-version checks inside _getThinkModelType is a good architectural pattern.
  • Automatic fallback for GPT-5.3+ to gpt5_2/gpt52pro types is well thought out.
  • Thorough test coverage for all new edge cases and future model variants.
  • Excellent PR description with clear rationale and tradeoffs.

EurFelux and others added 2 commits March 8, 2026 03:10
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]>
@EurFelux EurFelux requested a review from DeJeune March 7, 2026 19:14
Copy link
Copy Markdown
Collaborator

@GeorgeDong32 GeorgeDong32 left a comment

Choose a reason for hiding this comment

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

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)

  1. Dead code in MODEL_SUPPORTED_VERBOSITY (utils.ts:225-229)

    • The first validator !isSupportVerbosityModel is never reached since there's already an early return in getModelSupportedVerbosity
    • Consider removing it for cleaner code
  2. Potential false match in isGPT5FamilyModel (openai.ts:70-73)

    • Current: modelId.includes('gpt-5') could match hypothetical models like gpt-50, gpt-500
    • Suggestion: Consider using a more precise regex like /^gpt-5(\.\d+)?(-[\w-]+)?$/i
  3. Missing test case

    • Base gpt-5.2 verbosity test (non-codex, non-pro, non-chat) is covered in the diff but could be explicitly added

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. 🚀

@EurFelux
Copy link
Copy Markdown
Collaborator Author

EurFelux commented Mar 8, 2026

Thanks for the review @GeorgeDong32! 🙏

Regarding your suggestions:

  1. Dead code in MODEL_SUPPORTED_VERBOSITY — Keeping it as a defensive guard. The UI is gated by isSupportVerbosityModel anyway, so even if triggered, it wouldn't surface to users.

  2. isGPT5FamilyModel false match — Given current OpenAI naming conventions, gpt-50 is extremely unlikely. Keeping the simple includes for readability — we can tighten it if needed in the future.

  3. Missing test case — Added! Reorganized verbosity tests by model version (5.0 → 5.4) with full variant coverage (base, pro, chat, codex), plus a future fallback test for GPT-5.5+. See 7e61caf.

@EurFelux EurFelux requested a review from GeorgeDong32 March 8, 2026 06:42
@EurFelux EurFelux linked an issue Mar 8, 2026 that may be closed by this pull request
@EurFelux EurFelux merged commit 699682e into main Mar 8, 2026
9 checks passed
@EurFelux EurFelux deleted the feat/gpt-5.4 branch March 8, 2026 08:33
@kangfenmao kangfenmao mentioned this pull request Mar 13, 2026
6 tasks
kangfenmao added a commit that referenced this pull request Mar 13, 2026
### 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]>
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.

Cherry does not support GPT-5.4 (xhigh) in version 5.4

3 participants