refactor(gateway): run_turn_runner resolves adapters through the intake/delivery seams

Mechanical migration of the `_adapter_for_source` call sites in this sibling. Intake policy sites take `_intake_adapter_for`; every send/edit/typing/pending-slot site takes `_delivery_adapter_for`. Part of #88715 (phase 4).
This commit is contained in:
teknium1
2026-09-19 00:09:02 -07:00
committed by Teknium
parent 9e971c9581
commit 417d0c0f6a

View File

@@ -264,7 +264,7 @@ class TurnRunner:
from agent.display import get_tool_emoji
emoji = get_tool_emoji(tool_name, default="⚙️")
try:
adapter = self._runner._adapter_for_source(ctx.source)
adapter = self._runner._delivery_adapter_for(ctx.source)
except Exception:
adapter = None
code_full, code_short = self._progress_terminal_blocks(adapter, tool_name, args, emoji)
@@ -704,7 +704,7 @@ class TurnRunner:
async def send_progress_messages(self):
ctx = self._ctx
adapter = self._runner._adapter_for_source(ctx.source) if ctx.progress_queue else None
adapter = self._runner._delivery_adapter_for(ctx.source) if ctx.progress_queue else None
if not adapter:
return
if ctx._native_slack_task_cards and hasattr(adapter, "send_native_task_card_progress"):
@@ -928,7 +928,7 @@ class TurnRunner:
if want_stream_deltas or want_interim_messages:
try:
from gateway.stream_consumer import GatewayStreamConsumer
adapter = self._runner._adapter_for_source(ctx.source)
adapter = self._runner._delivery_adapter_for(ctx.source)
if adapter:
consumer_cfg, pause_typing_before_finalize = self._runner._build_stream_consumer_config(
ctx.source, scfg, adapter, on_missing_cursor="raise",
@@ -1597,7 +1597,7 @@ class TurnRunner:
def _resume_note_interactive(self) -> bool:
"""Interactive platforms report the restore and ask what next; event platforms (webhook,
API server) continue the work — nobody is present to answer."""
return bool(getattr(self._runner._adapter_for_source(self._ctx.source), "interactive_resume", True))
return bool(getattr(self._runner._delivery_adapter_for(self._ctx.source), "interactive_resume", True))
def _prepare_turn_message(self, agent_history):
"""Prepend recovery/notice guidance to ``ctx.message``.