Skip to content

fix(providers): clamp unsupported temperatures in Claude Code provider#3961

Merged
theonlyhennygod merged 1 commit intozeroclaw-labs:masterfrom
bjorn:fix/claude-code-temperature-clamping
Mar 20, 2026
Merged

fix(providers): clamp unsupported temperatures in Claude Code provider#3961
theonlyhennygod merged 1 commit intozeroclaw-labs:masterfrom
bjorn:fix/claude-code-temperature-clamping

Conversation

@bjorn
Copy link
Copy Markdown
Contributor

@bjorn bjorn commented Mar 19, 2026

Summary

  • The Claude Code CLI only supports temperatures 0.7 and 1.0, but internal subsystems (memory consolidation at 0.1, context summarizer at 0.2) request lower values
  • Previously the provider rejected these with a hard error, triggering retries and WARN-level log noise via ReliableProvider
  • Now clamps to the nearest supported value with a debug-level log, since the CLI ignores temperature anyway

Test plan

  • Existing unit tests updated and passing (cargo test --lib providers::claude_code — 14/14 pass)
  • Manual: run zeroclaw daemon with claude-code provider and verify no temperature warnings on incoming messages
  • Manual: trigger memory consolidation and verify it completes without retry warnings

🤖 Generated with Claude Code

@bjorn
Copy link
Copy Markdown
Contributor Author

bjorn commented Mar 19, 2026

I tried to fix these errors which I am seeing repeatedly when using the claude-code provider:

2026-03-19T09:53:09.382416Z  WARN zeroclaw::providers::reliable: Provider call failed, retrying provider="claude-code" model="default" attempt=1 backoff_ms=500 reason="retryable" error=temperature unsupported by Claude Code CLI: 0.1. Supported values: 0.7 or 1.0
2026-03-19T09:53:09.883611Z  WARN zeroclaw::providers::reliable: Provider call failed, retrying provider="claude-code" model="default" attempt=2 backoff_ms=1000 reason="retryable" error=temperature unsupported by Claude Code CLI: 0.1. Supported values: 0.7 or 1.0
2026-03-19T09:53:10.884933Z  WARN zeroclaw::providers::reliable: Exhausted retries, trying next provider/model provider="claude-code" model="default"

I've let Claude Code try to figure out a solution, but I realize this might not be the desired direction.

The Claude Code CLI only supports temperatures 0.7 and 1.0, but
internal subsystems (memory consolidation, context summarizer) use
lower values like 0.1 and 0.2. Previously the provider rejected these
with a hard error, triggering retries and WARN-level log noise.

Clamp to the nearest supported value instead, since the CLI ignores
temperature anyway.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bjorn bjorn force-pushed the fix/claude-code-temperature-clamping branch from 706526a to 34698db Compare March 19, 2026 10:39
Copy link
Copy Markdown
Collaborator

@theonlyhennygod theonlyhennygod left a comment

Choose a reason for hiding this comment

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

LGTM. Clean approach to clamp unsupported temperatures to nearest supported value instead of hard-erroring, which unblocks callers like memory consolidation. Good test coverage.

@theonlyhennygod theonlyhennygod merged commit f96a047 into zeroclaw-labs:master Mar 20, 2026
17 checks passed
webhive pushed a commit to webhive/zeroclaw that referenced this pull request Mar 24, 2026
zeroclaw-labs#3961)

The Claude Code CLI only supports temperatures 0.7 and 1.0, but
internal subsystems (memory consolidation, context summarizer) use
lower values like 0.1 and 0.2. Previously the provider rejected these
with a hard error, triggering retries and WARN-level log noise.

Clamp to the nearest supported value instead, since the CLI ignores
temperature anyway.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants