fix(moa): route MoA provider through in-process facade in streaming path - #67420
fix(moa): route MoA provider through in-process facade in streaming path#67420wangzengzhi wants to merge 2 commits into
Conversation
lark-oapi 1.6.8 does not expose the `extra_ua_tags` kwarg on its websocket Client, so origin/main's Feishu adapter fails when it passes `extra_ua_tags=["channel"]`. 1.6.9 adds support for the parameter. This lets the Feishu WebSocket connection request the Channel protocol for group @mention delivery without needing a runtime compatibility shim.
The non-streaming code path (chat_completion_helpers.py line ~423) already handles provider='moa' correctly by calling agent.client.chat.completions.create() through the MoAClient facade. The streaming path in interruptible_streaming_api_call was missing this check, causing it to build an HTTP client targeting the virtual 'moa://local' URL, resulting in 404 errors on platforms with stream consumers (Feishu, WeChat). This fix adds the same provider=='moa' guard to the streaming path, making MoA work consistently across both streaming and non-streaming scenarios.
teknium1
left a comment
There was a problem hiding this comment.
Thanks for tracing the virtual-provider path.
Problems
- Current
mainalready provides the reported streaming behavior:agent/chat_completion_helpers.py:2334calls_create_request_openai_client(), andrun_agent.py:4201-4202returns the existing MoA facade forprovider == "moa". This was added by66aeda35501d4998fddbc87fde92b3c25d1b4486(fix(moa): keep virtual provider on MoA client). The new direct streaming branch therefore duplicates the current shared routing behavior. - The
lark-oapipin change is independent of this MoA fix. As noted in the existing review discussion, please split it into a focused Feishu dependency change or document its validation separately.
Suggested changes
- Drop the redundant MoA branch and retain the shared helper route.
- Split or independently justify the Feishu dependency update.
Automated hermes-sweeper review.
| # MoA provider special handling: route through the in-process facade | ||
| # to support custom reference models and aggregators without hitting | ||
| # the virtual "moa://local" HTTP endpoint. | ||
| if agent.provider == "moa": |
There was a problem hiding this comment.
Current main already reaches the MoA facade through the shared helper: _create_request_openai_client() returns the primary client for provider == "moa" (run_agent.py:4201-4202). This branch duplicates that behavior; keeping the common route preserves one request-client lifecycle path.
| ] | ||
| dingtalk = ["dingtalk-stream==0.24.3", "alibabacloud-dingtalk==2.2.42", "qrcode==7.4.2"] | ||
| feishu = ["lark-oapi==1.6.8", "qrcode==7.4.2"] | ||
| feishu = ["lark-oapi==1.6.9", "qrcode==7.4.2"] |
There was a problem hiding this comment.
This Feishu SDK update is unrelated to the MoA streaming change. Please split it into a focused dependency fix or add dedicated justification and validation in that scoped change.
|
Closing — the fix this PR proposes is already on current main: |
The non-streaming code path (chat_completion_helpers.py line ~423) already
handles provider='moa' correctly by calling agent.client.chat.completions.create()
through the MoAClient facade. The streaming path in interruptible_streaming_api_call
was missing this check, causing it to build an HTTP client targeting the
virtual 'moa://local' URL, resulting in 404 errors on platforms with stream
consumers (Feishu, WeChat).
This fix adds the same provider=='moa' guard to the streaming path, making
MoA work consistently across both streaming and non-streaming scenarios.