fix(gateway): enable text-intercept for multi-choice clarify fallback (#25567)

This commit is contained in:
zccyman 2026-05-14 07:59:06 -07:00 committed by Teknium
parent 1247ff2dca
commit f26098e22f
2 changed files with 30 additions and 2 deletions

View file

@ -1774,8 +1774,12 @@ class BasePlatformAdapter(ABC):
The default implementation falls back to a numbered text list,
which works on every platform the user replies with a number
("2") or with the literal choice text, and the gateway intercepts
and resolves. Adapters with native button UIs (Telegram, Discord)
SHOULD override this for a richer UX.
and resolves. For the text fallback path, the default calls
``mark_awaiting_text()`` so that the gateway text-intercept
(:meth:`GatewayRunner._maybe_intercept_clarify_text`) catches the
user's reply instead of timing out.
Adapters with native button UIs (Telegram, Discord) SHOULD
override this for a richer UX.
"""
if choices:
lines = [f"{question}", ""]
@ -1784,6 +1788,10 @@ class BasePlatformAdapter(ABC):
lines.append("")
lines.append("Reply with the number, the option text, or your own answer.")
text = "\n".join(lines)
# Text fallback: enable text-capture so the gateway intercept
# picks up the user's typed reply (e.g. "2" or choice text).
from tools.clarify_gateway import mark_awaiting_text
mark_awaiting_text(clarify_id)
else:
text = f"{question}"
return await self.send(