From afd08b76c5571c8dcd16a1b86af743a87f13688a Mon Sep 17 00:00:00 2001 From: elkimek <36666630+elkimek@users.noreply.github.com> Date: Mon, 20 Apr 2026 02:44:41 -0700 Subject: [PATCH] fix(gateway): run /yolo and /verbose mid-agent instead of rejecting them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /yolo and /verbose are safe to dispatch while an agent is running: /yolo can unblock a pending approval prompt, /verbose cycles the tool-progress display for the ongoing stream. Both modify session state without needing agent interaction. Previously they fell through to the running-agent catch-all (PR #12334) and returned the generic busy message. /fast and /reasoning stay on the catch-all — their handlers explicitly say 'takes effect on next message', so nothing is gained by dispatching them mid-turn. Salvaged from #10116 (elkimek), scoped down. --- gateway/run.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gateway/run.py b/gateway/run.py index 560bb93d1..8f35d157a 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -3304,6 +3304,20 @@ class GatewayRunner: if _cmd_def_inner and _cmd_def_inner.name == "background": return await self._handle_background_command(event) + # Session-level toggles that are safe to run mid-agent — + # /yolo can unblock a pending approval prompt, /verbose cycles + # the tool-progress display mode for the ongoing stream. + # Both modify session state without needing agent interaction + # and must not be queued (the safety net would discard them). + # /fast and /reasoning are config-only and take effect next + # message, so they fall through to the catch-all busy response + # below — users should wait and set them between turns. + if _cmd_def_inner and _cmd_def_inner.name in ("yolo", "verbose"): + if _cmd_def_inner.name == "yolo": + return await self._handle_yolo_command(event) + if _cmd_def_inner.name == "verbose": + return await self._handle_verbose_command(event) + # Gateway-handled info/control commands with dedicated # running-agent handlers. if _cmd_def_inner and _cmd_def_inner.name in _DEDICATED_HANDLERS: