Skip to content

The agent that grows with you

fix(gateway): typed answers to a local choice prompt resolve it again

Teknium5652a20b31ff
diff --git a/gateway/session_local.py b/gateway/session_local.py
index 06f768d816b..ec28a959b84 100644
--- a/gateway/session_local.py
+++ b/gateway/session_local.py
@@ -77,7 +77,8 @@ class LocalSessionAdapter(BasePlatformAdapter):
error = 'Clarification is unavailable in hosted rooms'
return SendResult(success=False, error=error, error_kind='forbidden',
raw_response={'success': False, 'code': EGRESS_DECLINE_CODE, 'error': error})
- return SendResult(success=True, message_id=clarify_id)
+ # Local sessions keep the base prompt: a choice question also captures typed text.
+ return await super().send_clarify(chat_id, question, choices, clarify_id, session_key, metadata)
def authorize_local_source(runner, source):
diff --git a/tests/gateway/test_hosted_clarification_refusal.py b/tests/gateway/test_hosted_clarification_refusal.py
index 819f27ec4f5..8b7174239ce 100644
--- a/tests/gateway/test_hosted_clarification_refusal.py
+++ b/tests/gateway/test_hosted_clarification_refusal.py
@@ -1,4 +1,4 @@
-"""Persisted hosted policies decline a question without a reply channel."""
+"""Persisted hosted policies decline a question without a reply channel; local ones still ask."""
import asyncio
import threading
import time
@@ -51,3 +51,10 @@ def test_hosted_clarify_is_declined_without_waiting(ask):
assert (response, answered) == (UNDELIVERED_DECLINED, False)
assert elapsed < 5, 'the member waited for an answer nobody can submit'
+
+def test_local_choice_prompt_still_accepts_a_typed_answer(ask):
+ outcomes = []
+ (response, answered), _ = ask('cli', on_sent=lambda key: outcomes.append(
+ clarify_mod.attempt_text_response_for_session(key, 'something else entirely')))
+ assert outcomes == [clarify_mod.TEXT_RESOLVED]
+ assert (response, answered) == ('something else entirely', True)