Gateway chat: background subagent delivery (async delegate_task) silently disabled — caller conversation_history denies server-history consumer
Summary
Browser chat sessions running through the Gateway runs API (webui_chat_backend: gateway) cannot use background delegate_task subagents. Every delegation silently downgrades to synchronous execution: the parent blocks inside the tool call until all children finish — no parallel work, and Steers sent during the batch wait for it to return.
Observed on v0.21.4 hermes-core + current webui master, gateway mode enabled 2026-09-30. Log evidence (gateway.log / agent log):
delegate_task: session fda15938a1dd has no declared server-history consumer — running the batch synchronously instead.
async delivery unsupported on this session runtime; running the batch synchronously instead.Root cause chain
- The WebUI always sends
conversation_historywith every/v1/runsadmission (_run_gateway_runs_api_streaming, added for #4362 so runs-API chat keeps context between turns). api_server_runs.py:659:session_history_delivery = not previous_response_id and not conversation_history.api_server_runs.py:762-764(by design, #98619 fail-closed): "a caller-supplied conversation_history is authoritative for the turn and never reads the delivery row, so it is denied the same way."tools/delegate_tool_dispatch.py::_resolve_async_wake_sid: withoutorigin_session_history_delivery, delegation runs synchronously.
Gateway-native sessions (Telegram etc.) and /api/sessions/{id}/chat are unaffected — they never send caller history and get session_history_delivery="1".
Impact
- Parent agents in browser chats cannot work in parallel with their subagents (behavior regression vs. the legacy in-process WebUI runtime).
- Mid-run Steers are consumed only after the full delegation batch returns.
Proposed fix
PR #7930 — explicit opt-in (HERMES_WEBUI_GATEWAY_ASYNC_DELIVERY env / webui_gateway_async_delivery config): the WebUI omits conversation_history when an explicit session_id is present; the runs API then loads the authoritative history from SessionDB itself (existing behavior, api_server_runs.py:660-661) and declares the run a server-history consumer, re-enabling async delegation delivery. Default stays off (#4362 guard).
An alternative contract-level fix could live server-side (e.g. a declared flag that the caller's history is mirrored from server state), but the client-side opt-in requires no API contract change.
Source: nesquena/hermes-webui