Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/coding_agent_telegram/session_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ def _detect_reply_options(text: str) -> tuple[str, ...]:
for line in tail_lines:
match = _OPTION_LINE_RE.match(line)
if match:
options.append(match.group(1).strip())
label = match.group(1).strip()
if label.endswith("?"):
# Each line is its own question (e.g. "1. Should I use A or B?"),
# not a choice for one decision — bail out rather than offering
# buttons that would resend a question as if it were an answer.
return ()
options.append(label)

if len(options) < 2:
return ()
Expand Down
9 changes: 9 additions & 0 deletions tests/test_session_runtime_diff_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,12 @@ def test_detect_reply_options_caps_at_max_options():

def test_detect_reply_options_returns_empty_for_blank_text():
assert _detect_reply_options(" ") == ()


def test_detect_reply_options_ignores_multiple_independent_questions():
text = (
"I have a couple of questions before proceeding:\n"
"1. Should I use approach A or B for the caching layer?\n"
"2. Do you want unit tests included in this PR?"
)
assert _detect_reply_options(text) == ()
Loading