fix(agent): _should_stream keys ACP on the provider profile, not one vendor's name

An out-of-tree external-process provider whose base_url marker is not ``acp://`` still tried
to stream a completion object that is not iterable; the check named copilot-acp alone.
Gate on the profile's external_process auth_type as well.

Salvaged from #107754 (the agent_init half already landed via #116552 / #116958).
This commit is contained in:
satoshi
2026-09-20 12:22:50 +05:30
committed by kshitij
parent 9bb0c4a40f
commit 2f69687889

View File

@@ -46,12 +46,15 @@ class ApiCallVerdict:
def _should_stream(agent: Any) -> bool:
"""Streaming is preferred even without consumers (stale-stream / read-timeout health
checks); disabled on provider signal, ACP schemes, MoA without a display consumer, or
Mock clients in tests (SimpleNamespace, not stream iterators)."""
checks); disabled on provider signal, ACP providers (``acp://`` scheme or an
external-process provider profile), MoA without a display consumer, or Mock clients in
tests (SimpleNamespace, not stream iterators)."""
if getattr(agent, "_disable_streaming", False):
return False
_base = str(agent.base_url or "").lower()
if agent.provider in {"copilot-acp"} or _base.startswith(("acp://", "acp+tcp://")):
from hermes_cli.runtime_provider_backends import _is_external_process_provider
if _base.startswith(("acp://", "acp+tcp://")) or _is_external_process_provider(agent.provider):
return False
if not agent._has_stream_consumers():
if agent.provider == "moa":