fix(llm): omit temperature for Anthropic models that reject it (unblocks verifier eval of Opus 4.8 / Claude 5) - #2822
Conversation
The verifier client passed temperature=0.1 unconditionally to Anthropic, but the newer "thinking" generation returns HTTP 400 invalid_request_error on a custom temperature. The maint-78 verifier pilot (run 30112277194, 2026-07-24) failed preflight because claude-opus-4-8 and claude-sonnet-5 400'd on temperature, which (preflight being all-or-nothing) aborted the whole run. Mirror the existing OpenAI reasoning-model handling for Anthropic: add _anthropic_rejects_temperature() and omit the param for Opus 4.8 + the Claude 5 family, while preserving temperature=0.1 for the incumbent claude-opus-4-6 (which still accepts it) so production verifier behavior is unchanged. Interim, evidence-based guard; durable capability-aware handling (retry-on-400) is tracked in #2819. ruff/black/mypy (CI-pinned) clean; tests/tools/test_langchain_client.py 63 pass incl. 4 new cases. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAnthropic client construction now omits ChangesAnthropic temperature handling
Runtime metadata
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Workflow source neededPR #2822 needs either a linked GitHub issue or one valid non-issue Workflow Source before PR metadata automation can manage it safely. Please do one of:
Once a valid source is present, this warning will not be reposted. |
Automated Status SummaryHead SHA: 6c2e9e3
Coverage Overview
Coverage Trend
Top Coverage Hotspots (lowest coverage)
Low Coverage Files (<50.0%)
Updated automatically; will refresh on subsequent CI/Docker completions. Keepalive checklistScopeNo scope information available Tasks
Acceptance criteria
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5972dad4f8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not _anthropic_rejects_temperature(model): | ||
| kwargs["temperature"] = 0.1 |
There was a problem hiding this comment.
Apply the temperature guard to the consumer template
When maint-68-sync-consumer-repos.yml distributes the manifest-declared tools/langchain_client.py, the sync compiler prefers templates/consumer-repo/tools/langchain_client.py; that copy remains unchanged and still passes temperature=0.1 unconditionally. Consequently, consumer verifier evaluations using claude-opus-4-8 or Claude 5 will continue receiving the same HTTP 400 that this change fixes locally. Mirror the guard and its tests into the consumer template.
AGENTS.md reference: AGENTS.md:L39-L41
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/tools/test_langchain_client.py`:
- Around line 815-820: Extend
test_anthropic_rejects_temperature_matches_newer_generation to assert that
_anthropic_rejects_temperature returns true for the Claude 5 haiku model, using
the same pattern as the existing opus, sonnet, and fable assertions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: a5b21003-a5cb-4d22-a9db-06498f421b71
📒 Files selected for processing (2)
tests/tools/test_langchain_client.pytools/langchain_client.py
| def test_anthropic_rejects_temperature_matches_newer_generation(): | ||
| # Confirmed-rejecting (maint-78 pilot 2026-07-24) + Claude 5 family. | ||
| assert langchain_client._anthropic_rejects_temperature("claude-opus-4-8") | ||
| assert langchain_client._anthropic_rejects_temperature("claude-sonnet-5") | ||
| assert langchain_client._anthropic_rejects_temperature("claude-fable-5") | ||
| assert langchain_client._anthropic_rejects_temperature("claude-opus-5") |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Cover the haiku Claude 5 family.
Production code includes haiku, but this table does not assert claude-haiku-5; removing that family would pass the suite.
Proposed test
assert langchain_client._anthropic_rejects_temperature("claude-sonnet-5")
+ assert langchain_client._anthropic_rejects_temperature("claude-haiku-5")
assert langchain_client._anthropic_rejects_temperature("claude-fable-5")📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| def test_anthropic_rejects_temperature_matches_newer_generation(): | |
| # Confirmed-rejecting (maint-78 pilot 2026-07-24) + Claude 5 family. | |
| assert langchain_client._anthropic_rejects_temperature("claude-opus-4-8") | |
| assert langchain_client._anthropic_rejects_temperature("claude-sonnet-5") | |
| assert langchain_client._anthropic_rejects_temperature("claude-fable-5") | |
| assert langchain_client._anthropic_rejects_temperature("claude-opus-5") | |
| def test_anthropic_rejects_temperature_matches_newer_generation(): | |
| # Confirmed-rejecting (maint-78 pilot 2026-07-24) + Claude 5 family. | |
| assert langchain_client._anthropic_rejects_temperature("claude-opus-4-8") | |
| assert langchain_client._anthropic_rejects_temperature("claude-sonnet-5") | |
| assert langchain_client._anthropic_rejects_temperature("claude-haiku-5") | |
| assert langchain_client._anthropic_rejects_temperature("claude-fable-5") | |
| assert langchain_client._anthropic_rejects_temperature("claude-opus-5") |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/tools/test_langchain_client.py` around lines 815 - 820, Extend
test_anthropic_rejects_temperature_matches_newer_generation to assert that
_anthropic_rejects_temperature returns true for the Claude 5 haiku model, using
the same pattern as the existing opus, sonnet, and fable assertions.
Source: Path instructions
…guard) # Conflicts: # tests/tools/test_langchain_client.py
What
The frozen verifier client passed
temperature=0.1unconditionally to Anthropic (_build_anthropic_client), but the newer "thinking" generation returns HTTP 400invalid_request_erroron a custom temperature. This broke the maint-78 verifier pilot: run30112277194(2026-07-24) failed preflight becauseclaude-opus-4-8andclaude-sonnet-5400'd ontemperature— and preflight is all-or-nothing, so the whole pilot aborted (even though the OpenAI candidates passed).Fix
Mirror the existing OpenAI reasoning-model handling (
_is_reasoning_model→ omit temperature) for Anthropic:_anthropic_rejects_temperature(model)— matchesclaude-opus-4-8+ the Claude 5 family (claude-<name>-5…); minor-version-5suffixes likeclaude-haiku-4-5are not matched._build_anthropic_clientomitstemperaturefor those, and preservestemperature=0.1for the incumbentclaude-opus-4-6(which still accepts it) — so the production verifier's behavior is unchanged.Scope / honesty
github-models/codex-mini-latestreturned404(endpoint/path issue) — separate from temperature. With all-or-nothing preflight, a re-run still needs that handled (or the github incumbent excluded).Verification
ruff==0.15.20✅ ·black==26.5.1 -l100✅ ·mypy==2.1.0✅ (CI-pinned).pytest tests/tools/test_langchain_client.py→ 63 passed, incl. 4 new: helper matches opus-4-8/sonnet-5/fable-5/opus-5; incumbent opus-4-6 + minor-5still accept; builder omits temperature for new models, keeps it for opus-4-6.🤖 Generated with Claude Code
Summary by CodeRabbit
temperaturesetting for models that reject it.temperaturebehavior for Claude models that still support it.