Skip to content

feat: add Claude Opus 4.8 support#2423

Merged
naorpeled merged 1 commit into
The-PR-Agent:mainfrom
PeterDaveHelloKitchen:add-claude-opus-4-8-support
Jun 6, 2026
Merged

feat: add Claude Opus 4.8 support#2423
naorpeled merged 1 commit into
The-PR-Agent:mainfrom
PeterDaveHelloKitchen:add-claude-opus-4-8-support

Conversation

@PeterDaveHello

Copy link
Copy Markdown
Contributor

Register Claude Opus 4.8 model IDs with the 1M context window across Anthropic, Vertex AI, and supported Bedrock aliases.

Mirror the Opus 4.7 sampling and thinking constraints for the new aliases, with focused unit coverage for those request parameters.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Add Claude Opus 4.8 support across multiple providers

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Register Claude Opus 4.8 model IDs with 1M context window
• Support across Anthropic, Vertex AI, and Bedrock aliases
• Add comprehensive unit test coverage for new model variants
• Mirror Opus 4.7 sampling and thinking constraints
Diagram
flowchart LR
  A["Claude Opus 4.8<br/>Model Registration"] --> B["Anthropic<br/>Provider"]
  A --> C["Vertex AI<br/>Provider"]
  A --> D["Bedrock<br/>Provider"]
  B --> E["1M Context<br/>Window"]
  C --> E
  D --> E
  E --> F["Unit Tests<br/>Coverage"]

Loading

Grey Divider

File Changes

1. pr_agent/algo/__init__.py ✨ Enhancement +19/-1

Register Claude Opus 4.8 across providers

• Added claude-opus-4-8 model ID with 1M context window to Anthropic provider
• Added vertex_ai/claude-opus-4-8 model ID with 1M context window
• Added bedrock/anthropic.claude-opus-4-8 and regional variants with 1M context window
• Registered all Claude Opus 4.8 variants in SUPPORTED_MODELS list

pr_agent/algo/init.py


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

Add max tokens test for Opus 4.8

• Added parametrized test for Claude Opus 4.8 model variants
• Tests all provider aliases: Anthropic, Vertex AI, and Bedrock regional variants
• Verifies max tokens returns 1000000 for all Claude Opus 4.8 models

tests/unittest/test_get_max_tokens.py


3. tests/unittest/test_litellm_chat_completion_core.py 🧪 Tests +46/-0

Add sampling and thinking constraint tests

• Added test verifying temperature parameter omitted for Claude Opus 4.8 models
• Added test confirming extended thinking disabled for Claude Opus 4.8
• Tests all provider aliases to ensure consistent behavior across platforms
• Validates that thinking and max_tokens parameters are not passed

tests/unittest/test_litellm_chat_completion_core.py


Grey Divider

Qodo Logo

@github-actions github-actions Bot added the feature 💡 label Jun 3, 2026
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0)

Grey Divider


Action required

1. Seed validation false-positive 🐞 Bug ≡ Correctness
Description
LiteLLMAIHandler.chat_completion omits the temperature kwarg for models in
NO_SUPPORT_TEMPERATURE_MODELS (now including Claude Opus 4.8 aliases) but still validates seed
against the temperature *argument* and can raise ValueError even though temperature is not sent.
This can break Claude Opus 4.8 calls whenever config.seed is set and config.temperature (or the
default 0.2) is > 0.
Code

pr_agent/algo/init.py[R305-313]

Evidence
The PR adds Claude Opus 4.8 aliases to the no-temperature model list, which makes the handler omit
temperature from the request kwargs. However, the handler later checks `if temperature > 0 and
seed >= 0: using the original argument value, so calls can raise even though temperature` was not
included in kwargs; call sites commonly pass a non-zero configured temperature.

pr_agent/algo/init.py[287-314]
pr_agent/algo/ai_handlers/litellm_ai_handler.py[472-512]
pr_agent/tools/pr_reviewer.py[220-225]

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

## Issue description
`LiteLLMAIHandler.chat_completion()` conditionally omits `kwargs["temperature"]` for models in `NO_SUPPORT_TEMPERATURE_MODELS`, but later it validates seed usage using the original `temperature` parameter instead of the effective temperature actually being sent. With Claude Opus 4.8 now in `NO_SUPPORT_TEMPERATURE_MODELS`, a non-zero configured/default temperature combined with `config.seed >= 0` can raise `ValueError` even though the request contains no temperature.
## Issue Context
- Temperature is only added to `kwargs` when the model supports it.
- Seed validation currently uses the function argument `temperature`, not `kwargs.get("temperature")` (or equivalent effective value).
- Many call sites pass `temperature=get_settings().config.temperature`, so this can fail in common configs.
## Fix Focus Areas
- pr_agent/algo/ai_handlers/litellm_ai_handler.py[472-512]
- tests/unittest/test_litellm_chat_completion_core.py[44-101]
## Expected fix
- Compute an `effective_temperature` based on what will actually be sent (e.g., `effective_temperature = kwargs.get("temperature", 0)`), and use that in the seed validation.
- Add/adjust a unit test to cover: `seed >= 0`, `temperature > 0`, and model in `NO_SUPPORT_TEMPERATURE_MODELS` (e.g., `claude-opus-4-8`) should NOT raise, and should not include `temperature` in kwargs.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Previous review results

Review updated until commit 4a186f9

Results up to commit 87b87cd


🐞 Bugs (1) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0)


Action required
1. Seed validation false-positive 🐞 Bug ≡ Correctness
Description
LiteLLMAIHandler.chat_completion omits the temperature kwarg for models in
NO_SUPPORT_TEMPERATURE_MODELS (now including Claude Opus 4.8 aliases) but still validates seed
against the temperature *argument* and can raise ValueError even though temperature is not sent.
This can break Claude Opus 4.8 calls whenever config.seed is set and config.temperature (or the
default 0.2) is > 0.
Code

pr_agent/algo/init.py[R305-313]

Evidence
The PR adds Claude Opus 4.8 aliases to the no-temperature model list, which makes the handler omit
temperature from the request kwargs. However, the handler later checks `if temperature > 0 and
seed >= 0: using the original argument value, so calls can raise even though temperature` was not
included in kwargs; call sites commonly pass a non-zero configured temperature.

pr_agent/algo/init.py[287-314]
pr_agent/algo/ai_handlers/litellm_ai_handler.py[472-512]
pr_agent/tools/pr_reviewer.py[220-225]

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

## Issue description
`LiteLLMAIHandler.chat_completion()` conditionally omits `kwargs["temperature"]` for models in `NO_SUPPORT_TEMPERATURE_MODELS`, but later it validates seed usage using the original `temperature` parameter instead of the effective temperature actually being sent. With Claude Opus 4.8 now in `NO_SUPPORT_TEMPERATURE_MODELS`, a non-zero configured/default temperature combined with `config.seed >= 0` can raise `ValueError` even though the request contains no temperature.
## Issue Context
- Temperature is only added to `kwargs` when the model supports it.
- Seed validation currently uses the function argument `temperature`, not `kwargs.get("temperature")` (or equivalent effective value).
- Many call sites pass `temperature=get_settings().config.temperature`, so this can fail in common configs.
## Fix Focus Areas
- pr_agent/algo/ai_handlers/litellm_ai_handler.py[472-512]
- tests/unittest/test_litellm_chat_completion_core.py[44-101]
## Expected fix
- Compute an `effective_temperature` based on what will actually be sent (e.g., `effective_temperature = kwargs.get("temperature", 0)`), and use that in the seed validation.
- Add/adjust a unit test to cover: `seed >= 0`, `temperature > 0`, and model in `NO_SUPPORT_TEMPERATURE_MODELS` (e.g., `claude-opus-4-8`) should NOT raise, and should not include `temperature` in kwargs.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit 491dd07


🐞 Bugs (1) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0)


Action required
1. Seed validation false-positive 🐞 Bug ≡ Correctness
Description
LiteLLMAIHandler.chat_completion omits the temperature kwarg for models in
NO_SUPPORT_TEMPERATURE_MODELS (now including Claude Opus 4.8 aliases) but still validates seed
against the temperature *argument* and can raise ValueError even though temperature is not sent.
This can break Claude Opus 4.8 calls whenever config.seed is set and config.temperature (or the
default 0.2) is > 0.
Code

pr_agent/algo/init.py[R305-313]

Evidence
The PR adds Claude Opus 4.8 aliases to the no-temperature model list, which makes the handler omit
temperature from the request kwargs. However, the handler later checks `if temperature > 0 and
seed >= 0: using the original argument value, so calls can raise even though temperature` was not
included in kwargs; call sites commonly pass a non-zero configured temperature.

pr_agent/algo/init.py[287-314]
pr_agent/algo/ai_handlers/litellm_ai_handler.py[472-512]
pr_agent/tools/pr_reviewer.py[220-225]

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

## Issue description
`LiteLLMAIHandler.chat_completion()` conditionally omits `kwargs["temperature"]` for models in `NO_SUPPORT_TEMPERATURE_MODELS`, but later it validates seed usage using the original `temperature` parameter instead of the effective temperature actually being sent. With Claude Opus 4.8 now in `NO_SUPPORT_TEMPERATURE_MODELS`, a non-zero configured/default temperature combined with `config.seed >= 0` can raise `ValueError` even though the request contains no temperature.
## Issue Context
- Temperature is only added to `kwargs` when the model supports it.
- Seed validation currently uses the function argument `temperature`, not `kwargs.get("temperature")` (or equivalent effective value).
- Many call sites pass `temperature=get_settings().config.temperature`, so this can fail in common configs.
## Fix Focus Areas
- pr_agent/algo/ai_handlers/litellm_ai_handler.py[472-512]
- tests/unittest/test_litellm_chat_completion_core.py[44-101]
## Expected fix
- Compute an `effective_temperature` based on what will actually be sent (e.g., `effective_temperature = kwargs.get("temperature", 0)`), and use that in the seed validation.
- Add/adjust a unit test to cover: `seed >= 0`, `temperature > 0`, and model in `NO_SUPPORT_TEMPERATURE_MODELS` (e.g., `claude-opus-4-8`) should NOT raise, and should not include `temperature` in kwargs.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit 463ea64


🐞 Bugs (1) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0)


Action required
1. Seed validation false-positive 🐞 Bug ≡ Correctness
Description
LiteLLMAIHandler.chat_completion omits the temperature kwarg for models in
NO_SUPPORT_TEMPERATURE_MODELS (now including Claude Opus 4.8 aliases) but still validates seed
against the temperature *argument* and can raise ValueError even though temperature is not sent.
This can break Claude Opus 4.8 calls whenever config.seed is set and config.temperature (or the
default 0.2) is > 0.
Code

pr_agent/algo/init.py[R305-313]

Evidence
The PR adds Claude Opus 4.8 aliases to the no-temperature model list, which makes the handler omit
temperature from the request kwargs. However, the handler later checks `if temperature > 0 and
seed >= 0: using the original argument value, so calls can raise even though temperature` was not
included in kwargs; call sites commonly pass a non-zero configured temperature.

pr_agent/algo/init.py[287-314]
pr_agent/algo/ai_handlers/litellm_ai_handler.py[472-512]
pr_agent/tools/pr_reviewer.py[220-225]

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

## Issue description
`LiteLLMAIHandler.chat_completion()` conditionally omits `kwargs["temperature"]` for models in `NO_SUPPORT_TEMPERATURE_MODELS`, but later it validates seed usage using the original `temperature` parameter instead of the effective temperature actually being sent. With Claude Opus 4.8 now in `NO_SUPPORT_TEMPERATURE_MODELS`, a non-zero configured/default temperature combined with `config.seed >= 0` can raise `ValueError` even though the request contains no temperature.

## Issue Context
- Temperature is only added to `kwargs` when the model supports it.
- Seed validation currently uses the function argument `temperature`, not `kwargs.get("temperature")` (or equivalent effective value).
- Many call sites pass `temperature=get_settings().config.temperature`, so this can fail in common configs.

## Fix Focus Areas
- pr_agent/algo/ai_handlers/litellm_ai_handler.py[472-512]
- tests/unittest/test_litellm_chat_completion_core.py[44-101]

## Expected fix
- Compute an `effective_temperature` based on what will actually be sent (e.g., `effective_temperature = kwargs.get("temperature", 0)`), and use that in the seed validation.
- Add/adjust a unit test to cover: `seed >= 0`, `temperature > 0`, and model in `NO_SUPPORT_TEMPERATURE_MODELS` (e.g., `claude-opus-4-8`) should NOT raise, and should not include `temperature` in kwargs.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Qodo Logo

Comment thread pr_agent/algo/__init__.py Outdated
@PeterDaveHello PeterDaveHello force-pushed the add-claude-opus-4-8-support branch from 463ea64 to 491dd07 Compare June 3, 2026 17:01
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 491dd07

Comment thread pr_agent/algo/ai_handlers/litellm_ai_handler.py Outdated
@PeterDaveHello PeterDaveHello force-pushed the add-claude-opus-4-8-support branch from 491dd07 to 87b87cd Compare June 3, 2026 18:47
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 87b87cd

Register Claude Opus 4.8 model IDs with the 1M context window across
Anthropic, Vertex AI, and supported Bedrock aliases.

Preserve temperature forwarding for the new aliases while keeping Opus
4.8 outside Claude extended thinking handling. Add focused coverage for
max-token lookup, request parameters, and existing seed validation.
@PeterDaveHello PeterDaveHello force-pushed the add-claude-opus-4-8-support branch from 87b87cd to 4a186f9 Compare June 4, 2026 15:18
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 4a186f9

@naorpeled

Copy link
Copy Markdown
Member

Thanks Peter!

@naorpeled naorpeled merged commit 00157e4 into The-PR-Agent:main Jun 6, 2026
5 checks passed
@PeterDaveHello PeterDaveHello deleted the add-claude-opus-4-8-support branch June 6, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants