fix(moa): preserve facade across client rebuilds - #78409
Closed
burak33bb wants to merge 1 commit into
Closed
Conversation
Contributor
|
Thanks! Your |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Preserves the virtual
MoAClientfacade when Hermes rebuilds the shared primary client during credential rotation, timeout updates, or dead-connection recovery.MoA uses an in-process facade to consume the private
_moa_prepared_requestargument. The generic_replace_primary_openai_client()path ignored the active provider and rebuilt a native OpenAI SDK client from stale_client_kwargs. The next MoA request then leaked_moa_prepared_requestinto the OpenAI SDK and crashed withTypeError.The replacement path is now provider-aware: it rebuilds the MoA facade with
build_moa_facade()for themoaprovider while preserving the existing OpenAI client behavior for every other provider. Existing safe retirement behavior for the replaced client remains unchanged.Related Issue
Fixes #78382
Type of Change
Changes Made
run_agent.py.MoAClientacross the generic primary-client replacement path.How to Test
AIAgentwithprovider="moa"._replace_primary_openai_client()as credential rotation or connection recovery would._moa_prepared_requestand verify the MoA facade consumes it instead of forwarding it to a native OpenAI client.Validation performed:
mainfailure:TypeError: unexpected _moa_prepared_request.git diff --checkpassed.Duplicate Check
Searched current open PRs for
#78382,_moa_prepared_request,moa client rebuild facade, andmoa fallback rotation; no matching open PR was found. Earlier #70280 / #53802 covered restore and recovery paths, but not this generic replacement path.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qsuite run (55 focused regression tests passed)Documentation & Housekeeping