Add OpenAI's GPT-5.5 model support#2355
Open
PeterDaveHello wants to merge 1 commit intoThe-PR-Agent:mainfrom
Open
Add OpenAI's GPT-5.5 model support#2355PeterDaveHello wants to merge 1 commit intoThe-PR-Agent:mainfrom
PeterDaveHello wants to merge 1 commit intoThe-PR-Agent:mainfrom
Conversation
Contributor
Review Summary by QodoAdd OpenAI GPT-5.5 model support with token configuration
WalkthroughsDescription• Add GPT-5.5 model variants with 1.05M token context window • Register model identifiers in token limit configuration • Add unit tests for GPT-5.5 max token retrieval • Include GPT-5.5 in reasoning effort detection logic Diagramflowchart LR
A["GPT-5.5 Models<br/>gpt-5.5<br/>gpt-5.5-2026-04-23"] -->|"1.05M tokens"| B["Token Config<br/>pr_agent/algo/__init__.py"]
A -->|"Model Detection"| C["Reasoning Effort<br/>test_litellm_reasoning_effort.py"]
B -->|"Validation"| D["Unit Tests<br/>test_get_max_tokens.py"]
File Changes1. pr_agent/algo/__init__.py
|
Contributor
Code Review by Qodo
1. _thinking model token crash
|
Comment on lines
+52
to
+53
| 'gpt-5.5': 1050000, # 1.05M, but may be limited by config.max_model_tokens | ||
| 'gpt-5.5-2026-04-23': 1050000, # 1.05M, but may be limited by config.max_model_tokens |
Contributor
There was a problem hiding this comment.
1. _thinking model token crash 🐞 Bug ☼ Reliability
If the configured model is set to a GPT-5.5 “_thinking” variant (e.g., "gpt-5.5_thinking"), get_max_tokens() will raise because MAX_TOKENS only contains the base names added in this PR and lookup is exact-match. This blocks get_pr_diff() (and thus all tools) before LiteLLMAIHandler can strip the “_thinking” suffix.
Agent Prompt
### Issue description
`get_max_tokens(model)` performs an exact key lookup in `MAX_TOKENS`. The codebase supports GPT-5 “_thinking” model names in `LiteLLMAIHandler` (it strips `_thinking` before calling the provider), but `get_pr_diff()` calls `get_max_tokens(model)` before the AI handler runs. As a result, configuring `config.model = "gpt-5.5_thinking"` (or any `gpt-5.*_thinking`) will raise an exception and prevent PR processing.
### Issue Context
- This PR adds `gpt-5.5` entries to `MAX_TOKENS`, but does not address `_thinking` variants.
- There are existing tests asserting `_thinking` suffix handling for GPT-5 models.
### Fix Focus Areas
- pr_agent/algo/utils.py[991-1012]
- pr_agent/algo/pr_processing.py[68-80]
- pr_agent/algo/ai_handlers/litellm_ai_handler.py[296-317]
- tests/unittest/test_get_max_tokens.py[64-76]
### Implementation direction
- Normalize `model` inside `get_max_tokens()` before lookup by stripping a trailing `_thinking` suffix (and optionally any internal provider prefixes if applicable in your config patterns).
- Add a unit test ensuring `get_max_tokens("gpt-5.5_thinking")` returns the same value as `get_max_tokens("gpt-5.5")` (and similarly for the dated variant, if you want full coverage).
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference: