-
Notifications
You must be signed in to change notification settings - Fork 53.3k
fix(moa): restore virtual runtime after fallback #53802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1018,7 +1018,15 @@ def restore_primary_runtime(agent) -> bool: | |
| ) | ||
|
|
||
| # ── Rebuild client for the primary provider ── | ||
| if agent.api_mode == "anthropic_messages": | ||
| if agent.provider == "moa": | ||
| # MoA is a virtual chat-completions provider. It never has real | ||
| # OpenAI client kwargs; restoring it after a fallback must recreate | ||
| # the facade, not call OpenAI() with an empty api_key. | ||
| from agent.moa_loop import MoAClient | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MoA initialization passes |
||
| agent.client = MoAClient(agent.model or "default") | ||
| agent._anthropic_client = None | ||
| elif agent.api_mode == "anthropic_messages": | ||
| from agent.anthropic_adapter import build_anthropic_client | ||
| agent._anthropic_api_key = rt["anthropic_api_key"] | ||
| agent._anthropic_base_url = rt["anthropic_base_url"] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please apply the same virtual-MoA reconstruction to
try_recover_primary_transport(agent/agent_runtime_helpers.py:1001-1026). It restores the same empty MoA snapshot and still calls_create_openai_client; the conversation loop invokes it before fallback for transient failures.