fix: gate per-platform streaming behind global streaming.enabled (#53697)

The effective streaming resolver in gateway/run.py had two sites where
per-platform display.platforms.<plat>.streaming values were used directly
without checking the global streaming.enabled master switch.

When  was set globally, the Telegram platform
still had streaming enabled because its per-platform default
bypassed the global gate.

Fix: introduce an intermediate  variable that
combines  and , then AND it with
the per-platform override (or default-true when no override exists).

This ensures streaming.enabled: false acts as a hard global kill switch
regardless of per-platform defaults or overrides.

Affects two resolver sites:
- Line ~14854: session streaming setup
- Line ~16034: stream consumer initialization

(cherry picked from commit 2b210eb2a0e0b9421dae9e3c1984ceb59760e3a3)
This commit is contained in:
Sahil-SS9
2026-06-27 17:17:42 +01:00
committed by kshitij
parent 8aaee1e1e2
commit ad5271b217
2 changed files with 6 additions and 4 deletions

View File

@@ -2725,8 +2725,9 @@ class GatewayTurnMixin:
_scfg = StreamingConfig()
from gateway.display_config import resolve_display_setting
_plat_streaming = resolve_display_setting(_load_gateway_config(), _platform_config_key(source.platform), "streaming")
_streaming_enabled = (
_scfg.enabled and _scfg.transport != "off" if _plat_streaming is None else bool(_plat_streaming)
_global_streaming_enabled = bool(_scfg.enabled) and _scfg.transport != "off"
_streaming_enabled = _global_streaming_enabled and (
True if _plat_streaming is None else bool(_plat_streaming)
)
if not _streaming_enabled:
return None

View File

@@ -921,8 +921,9 @@ class TurnRunner:
scfg = StreamingConfig()
# display.platforms.<plat>.streaming may disable streaming per platform; None = follow global.
plat_streaming = ctx.resolve_display_setting(ctx.user_config, platform_key, "streaming")
want_stream_deltas = not ctx.scheduled_heartbeat and (
scfg.enabled and scfg.transport != "off" if plat_streaming is None else bool(plat_streaming)
global_streaming_enabled = bool(scfg.enabled) and scfg.transport != "off"
want_stream_deltas = not ctx.scheduled_heartbeat and global_streaming_enabled and (
True if plat_streaming is None else bool(plat_streaming)
)
want_interim_messages = bool(ctx.interim_assistant_messages_enabled) and not ctx.scheduled_heartbeat
if want_stream_deltas or want_interim_messages: