Summary
calculate_max_tokens in rig's Anthropic provider doesn't recognize claude-haiku-4-5 (the latest Haiku model). When max_tokens is omitted from [agent.llm] config, the safety-net default returns None → the provider errors with `max_tokens` must be set for Anthropic. Same class of bug as #312, different model.
Reproduction
Use claude-haiku-4-5 in agent.llm with orchestration enabled, omitting max_tokens:
[agent]
name = "Aura Orchestrator"
system_prompt = "..."
turn_depth = 5
[agent.llm]
provider = "anthropic"
api_key = "{{ env.ANTHROPIC_API_KEY }}"
model = "claude-haiku-4-5"
[orchestration]
enabled = true
If max_tokens is set explicitly in config, the bug is not triggered (the value is propagated directly). The bug only fires when max_tokens is omitted and rig's calculate_max_tokens fallback is consulted.
Relevant log output
WARN aura::orchestration::orchestrator: Planning attempt 1 failed after 0.0s: CompletionError: RequestError: `max_tokens` must be set for Anthropic
ERROR aura_web_server::streaming::handlers: Stream error: Planning failed: CompletionError: RequestError: `max_tokens` must be set for Anthropic
Root cause
Anthropic changed their naming convention at the 4-series boundary:
- Old:
claude-3-5-haiku (generation before tier) — matched by rig's starts_with("claude-3-5-haiku") → 8192
- New:
claude-haiku-4-5 (tier before generation) — matches no existing prefix in calculate_max_tokens
Verified with a standalone test:
claude-haiku-4-5 => None
claude-haiku-4-5-20251001 => None
claude-3-5-haiku => Some(8192)
claude-sonnet-5 => Some(64000) # fixed in #312
Fix
Add a new branch to calculate_max_tokens and calculate_max_tokens_custom in rig-core/src/providers/anthropic/completion.rs:
} else if model.starts_with("claude-haiku-4") {
Some(64000)
}
Uses claude-haiku-4 as the prefix (covers claude-haiku-4-5 and future claude-haiku-4-x variants). Default of 64000 matches Haiku 4.5's 64k max output (per Anthropic's model docs). This is a new branch, not an || addition to an existing one — Haiku 4.5's 64k max output is 8x higher than the existing claude-3-5-haiku default of 8192, so it can't share that branch.
Same PR pattern as #312: rig fork PR to mezmo/rig targeting mezmo, then bump the rev pin in aura's Cargo.toml.
Additional Context
Searched Issues
Code of Conduct
Summary
calculate_max_tokensin rig's Anthropic provider doesn't recognizeclaude-haiku-4-5(the latest Haiku model). Whenmax_tokensis omitted from[agent.llm]config, the safety-net default returnsNone→ the provider errors with`max_tokens` must be set for Anthropic. Same class of bug as #312, different model.Reproduction
Use
claude-haiku-4-5inagent.llmwith orchestration enabled, omittingmax_tokens:If
max_tokensis set explicitly in config, the bug is not triggered (the value is propagated directly). The bug only fires whenmax_tokensis omitted and rig'scalculate_max_tokensfallback is consulted.Relevant log output
Root cause
Anthropic changed their naming convention at the 4-series boundary:
claude-3-5-haiku(generation before tier) — matched by rig'sstarts_with("claude-3-5-haiku")→ 8192claude-haiku-4-5(tier before generation) — matches no existing prefix incalculate_max_tokensVerified with a standalone test:
Fix
Add a new branch to
calculate_max_tokensandcalculate_max_tokens_custominrig-core/src/providers/anthropic/completion.rs:Uses
claude-haiku-4as the prefix (coversclaude-haiku-4-5and futureclaude-haiku-4-xvariants). Default of 64000 matches Haiku 4.5's 64k max output (per Anthropic's model docs). This is a new branch, not an||addition to an existing one — Haiku 4.5's 64k max output is 8x higher than the existingclaude-3-5-haikudefault of 8192, so it can't share that branch.Same PR pattern as #312: rig fork PR to
mezmo/rigtargetingmezmo, then bump the rev pin in aura'sCargo.toml.Additional Context
claude-haiku-4-5, so it hasn't been hit in production yet.max_tokenspropagation fix from [BUG]: max_tokens from config.toml is not passed to ochestration coordinator #312 is already merged (PR fix(orchestration): propagate max_tokens to coordinator agent #316), so users who setmax_tokensexplicitly in config are not affected. This only affects users who omit it.claude-opus-4-5throughclaude-opus-4-8are matched by the existingstarts_with("claude-opus-4")prefix but have an outdated default of 32000 (their actual max output is 128k). They don't error, just cap low. Separate concern.Searched Issues
Code of Conduct