fix(gateway): let /btw dispatch mid-turn instead of being rejected
/btw spawns a parallel ephemeral side-question task (self-guarded against
concurrent /btw on the same chat) — exactly like /background. But it was
missing from the running-agent bypass list in _handle_message(), so it
fell through to the catch-all and returned:
⏳ Agent is running — /btw can't run mid-turn. Wait for the current
response or /stop first.
That's the opposite of what /btw is for — asking a side question while
the main turn is still working. Add the bypass next to /background and a
regression test covering the mid-turn dispatch path.
Reported by @IuriiTiunov on Telegram.
This commit is contained in:
@@ -3501,6 +3501,14 @@ class GatewayRunner:
|
||||
if _cmd_def_inner and _cmd_def_inner.name == "background":
|
||||
return await self._handle_background_command(event)
|
||||
|
||||
# /btw must bypass the running-agent guard for the same reason
|
||||
# as /background: it spawns a parallel ephemeral side-question
|
||||
# task (see _handle_btw_command) that doesn't interrupt the
|
||||
# active conversation and self-guards against concurrent /btw
|
||||
# on the same chat.
|
||||
if _cmd_def_inner and _cmd_def_inner.name == "btw":
|
||||
return await self._handle_btw_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.
|
||||
|
||||
Reference in New Issue
Block a user