Ignore `max_retries` in OpenAI, Anthropic and Gemini batch requests instead of raising `UserError`

Merged
DO
1mo ago
+33-17

Part of #9334 (no closing keyword: this is a prerequisite, not the fix).

The OpenAI, Anthropic and Gemini batch encoders raised UserError whenever ModelSettings['max_retries'] was present. A batched request is run by the provider itself, so no SDK client retries it and the setting has nothing to apply to. It is now ignored silently, as we do for other settings that don't apply. timeout, extra_headers and the other per-request options that a batch genuinely can't honor still raise.

This matters for #9334: the RetryOnModelErrors capability sets max_retries=0 so that it is the only retry owner, and with the old behavior any agent combining it with BatchModelRequests failed. An agent-level or run-level max_retries set for the non-batched requests hit the same error.

  • docs/batch.md no longer says max_retries raises.
  • Each provider's batch tests now check that encoding with max_retries=0 gives the same request as encoding without it. Against the old code, all three raised the UserError.

Checklist

  • No breaking changes in accordance with the version policy.
  • Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
  • PR title is fit for the release changelog.

šŸ¤– Generated with Claude Code