You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fall back to bounded multi-message text when the negotiated platform limit cannot fit the prompt, preserving typed-answer capture
Why
Slack and other clients can visually truncate descriptive button labels well below their API character caps. The relay path currently puts the full choice only in the button label, so users cannot reliably distinguish choices.
This supplements the native Slack fix in #77547 without touching the same files. Refs #78115.
AI code review — automated review for reference, author can ignore or act on any point.
Solid approach: moving the full choice text into the prompt body and keeping button labels positional ("Choose 1/2") fixes the truncation/readability problem without breaking the callback-safe c{i} id scheme, and the oversize fallback with _interim_send correctly avoids sealing open drafts (good test for that regression). A few points worth a look:
Multi-select hint lost in the oversize fallback — gateway/relay/adapter.py:2863 hardcodes "Reply with the number, the option text, or your own answer." The base-class text fallback (gateway/platforms/base.py, default send_clarify) looks up the pending entry's multi_select flag and, when set, tells the user to reply with comma/space-separated numbers. Since this new fallback also flips the entry into awaiting_text mode where _selection_attempt_tokens accepts token lists (tools/clarify_gateway.py:227-246), a multi-select clarify that happens to exceed the platform limit would now receive single-select instructions. Suggest mirroring the base-class lookup (_cg._entries.get(clarify_id).multi_select) or factoring the hint construction into a shared helper so the two paths can't drift further — they already disagree on wording.
mark_awaiting_text result ignored — gateway/relay/adapter.py:2865. If the registry entry is missing at send time (id mismatch, or registration raced), the call silently no-ops and the user's free-text reply falls through to native-button classification, where prose is rejected rather than captured (tools/clarify_gateway.py:342-367). The base class shares this pattern, but since this is a brand-new call site, a debug/warning log when it returns False would make this failure mode diagnosable.
Chunk-send loop duplication — gateway/relay/adapter.py:2871-2880: copy metadata, tag _interim_send, loop chunks, early-return on first failure. This mirrors existing interim-send patterns in this file; extracting a small _send_chunked_interim(chat_id, text, metadata) helper would keep the flag semantics in one place as more call sites appear.
Minor: gateway/relay/adapter.py:2846-2849 could use enumerate(choice_labels) instead of range(len(...)); purely stylistic.
Tests cover both the happy path with an oversized choice and the draft-sealing edge case — nice coverage of the tricky interaction.
Addressed the substantive multi-select concern in 9fd36daff: oversized text fallback now mirrors the base adapter's multi-select instructions, with a regression proving comma/space-separated selection guidance remains visible. Full relay suite: 245 passed.
I left the other suggestions unchanged intentionally:
mark_awaiting_text() return handling matches the existing base-adapter contract; adding logging only in this override would make equivalent paths inconsistent.
The interim chunk loop remains local because this is currently one narrow call site; extracting a helper now would add abstraction without reuse.
The range(len(...)) loop makes the positional callback index explicit and is stylistic only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
comp/gatewayGateway runner, session dispatch, deliveryP2Medium — degraded but workaround existssweeper:risk-message-deliverySweeper risk: may drop, duplicate, misroute, or suppress messagestype/bugSomething isn't working
4 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Choose 1,Choose 2, …) while preserving positional callback mappingWhy
Slack and other clients can visually truncate descriptive button labels well below their API character caps. The relay path currently puts the full choice only in the button label, so users cannot reliably distinguish choices.
This supplements the native Slack fix in #77547 without touching the same files. Refs #78115.
Verification
pytest -q tests/gateway/relay/test_relay_interactive.pypytest -q tests/gateway/relaypytest -q tests/gateway -k clarifyruff check gateway/relay/adapter.py tests/gateway/relay/test_relay_interactive.pygit diff --check