Skip to content

Add OpenAI's GPT-5.5 model support#2355

Open
PeterDaveHello wants to merge 1 commit intoThe-PR-Agent:mainfrom
PeterDaveHelloKitchen:add-gpt-5.5-support
Open

Add OpenAI's GPT-5.5 model support#2355
PeterDaveHello wants to merge 1 commit intoThe-PR-Agent:mainfrom
PeterDaveHelloKitchen:add-gpt-5.5-support

Conversation

@PeterDaveHello
Copy link
Copy Markdown
Contributor

@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Add OpenAI GPT-5.5 model support with token configuration

✨ Enhancement

Grey Divider

Walkthroughs

Description
• 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
Diagram
flowchart 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"]
Loading

Grey Divider

File Changes

1. pr_agent/algo/__init__.py ⚙️ Configuration changes +2/-0

Register GPT-5.5 models with token limits

• Added two GPT-5.5 model variants to the model token limits dictionary
• Configured both gpt-5.5 and gpt-5.5-2026-04-23 with 1050000 token context window
• Included comments noting the 1.05M token limit with potential config restrictions

pr_agent/algo/init.py


2. tests/unittest/test_get_max_tokens.py 🧪 Tests +13/-0

Add GPT-5.5 max token unit tests

• Added new test method test_gpt55_model_max_tokens with parametrized models
• Tests both gpt-5.5 and gpt-5.5-2026-04-23 model identifiers
• Validates that get_max_tokens() returns 1050000 for GPT-5.5 variants
• Uses mock settings with zero custom and max model token overrides

tests/unittest/test_get_max_tokens.py


3. tests/unittest/test_litellm_reasoning_effort.py 🧪 Tests +2/-0

Include GPT-5.5 in model detection tests

• Added gpt-5.5 and gpt-5.5-2026-04-23 to the GPT-5 model detection test list
• Ensures both model variants are recognized for reasoning effort logic
• Maintains comprehensive coverage of GPT-5 model version strings

tests/unittest/test_litellm_reasoning_effort.py


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

qodo-free-for-open-source-projects Bot commented Apr 28, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0)

Grey Divider


Action required

1. _thinking model token crash 🐞 Bug ☼ Reliability
Description
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.
Code

pr_agent/algo/init.py[R52-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
Evidence
This PR adds only the base GPT-5.5 keys to MAX_TOKENS. get_max_tokens() requires the model string to
match a MAX_TOKENS key exactly and raises otherwise; get_pr_diff() calls get_max_tokens(model)
early, so a “*_thinking” model string will crash before the AI handler runs. Separately,
LiteLLMAIHandler explicitly supports “_thinking” model names by stripping the suffix, and unit tests
assert that behavior—showing “_thinking” is an expected variant that should also work with token
budgeting.

pr_agent/algo/init.py[46-54]
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_litellm_reasoning_effort.py[365-384]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### 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


Grey Divider

Qodo Logo

Comment thread pr_agent/algo/__init__.py
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

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

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.

1 participant