Skip to content

fix(agent): skip OpenAI client rebuild for Anthropic-mode providers (#44006) - #44148

Closed
kyssta-exe wants to merge 1 commit into
NousResearch:mainfrom
kyssta-exe:auto-fix/issue-44006
Closed

fix(agent): skip OpenAI client rebuild for Anthropic-mode providers (#44006)#44148
kyssta-exe wants to merge 1 commit into
NousResearch:mainfrom
kyssta-exe:auto-fix/issue-44006

Conversation

@kyssta-exe

Copy link
Copy Markdown
Contributor

Fixes #44006. Skip the OpenAI client rebuild in _replace_primary_openai_client when the provider uses the Anthropic adapter (e.g. minimax). These providers have client=None and _client_kwargs={}; attempting to rebuild would always fail with 'api_key must be set', masking the real retry logic and causing stream timeouts to drop the entire response.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/minimax MiniMax (Anthropic transport) duplicate This issue or pull request already exists labels Jun 11, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #36719 (open) — same approach: short-circuit _replace_primary_openai_client in run_agent.py for anthropic_messages providers (client=None). #44076 takes a different mechanism (rebuild the Anthropic client) for the same #44006.

@liuhao1024

Copy link
Copy Markdown
Contributor

Code review: clean

The early-return guard in _replace_primary_openai_client is correctly scoped. Verified:

  1. The condition (not getattr(self, "client", None) and not self._client_kwargs.get("api_key")) matches exactly the providers that don'''t use an OpenAI client — both the client object and the API key must be absent.
  2. Returning False (instead of raising) preserves the retry logic flow — callers already handle the False return.
  3. The fix is minimal and targeted — no behavioral change for providers that DO use OpenAI clients.

No issues found.

@kyssta-exe

Copy link
Copy Markdown
Contributor Author

Duplicate of #36719 — same OpenAI client rebuild skip for Anthropic providers (#44006). Closing as superseded.

@kyssta-exe kyssta-exe closed this Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists provider/minimax MiniMax (Anthropic transport) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stream-retry rebuilds OpenAI client without api_key, drops the retry

3 participants