fix(discord): show full clarify choice text, not just truncated buttons - #72608
fix(discord): show full clarify choice text, not just truncated buttons#72608shailensobhee wants to merge 1 commit into
Conversation
Discord hard-caps interactive button labels at 80 characters. The clarify tool renders one button per choice, so any option longer than ~76 chars (after the "N. " prefix) was truncated with an ellipsis on the button and the user could not read the full option. The question rendered fine (4096 char embed) but the choices did not. Fix: enumerate every choice in full as a numbered list in both the embed body and the plain-text content mirror, matching the "N." prefix on each button. The user reads the complete option and clicks the matching number. The buttons keep their short labels (Discord's cap is unavoidable there). When the enumerated list overflows the 1024-char embed field, it falls back to the 4096-char embed description so the tail is never silently dropped. Adds a regression test asserting two ~120-char choices appear verbatim in the rendered message.
teknium1
left a comment
There was a problem hiding this comment.
Thanks for addressing a real current-main Discord usability issue: ClarifyChoiceView still truncates long button labels at plugins/platforms/discord/adapter.py:8941-8985.
Problems
plugins/platforms/discord/adapter.py:6834slices the combined question and choice list to 4,088 characters. That can silently remove later choices, despite the fallback's full-text goal.plugins/platforms/discord/adapter.py:6854-6867puts the full list intail, but_self_contained_prompt_content()only budgets/truncatesbody(plugins/platforms/discord/adapter.py:6769-6773). The content can therefore exceedMAX_MESSAGE_LENGTH(2,000).
Suggested changes
- Bound both Discord surfaces before sending and make overflow explicit rather than silently cutting choice text.
- Extend
tests/gateway/test_discord_clarify_buttons.py:429-439with aggregate-overflow cases for the embed description and plain content limits.
Automated hermes-sweeper review.
| ) | ||
| desc = embed.description or "" | ||
| extra = "\n\n**Choices**\n" + choices_block | ||
| embed.description = (desc + extra)[:4088] |
There was a problem hiding this comment.
This slice can silently remove later choices whenever the question plus choices_block exceeds 4,088 characters. Please define and test an explicit overflow presentation instead of claiming the description fallback preserves the complete list.
| # choice list so the options are readable even when the embed and | ||
| # the truncated buttons are not. | ||
| if clean_choices: | ||
| clarify_tail = ( |
There was a problem hiding this comment.
_self_contained_prompt_content() budgets only its body, not this tail; four unbounded choice strings can make content exceed DiscordAdapter.MAX_MESSAGE_LENGTH (2,000). Bound this mirror and add a boundary test before sending.
Problem
Discord hard-caps interactive button labels at 80 characters. The
clarifytool renders one button per choice, so any option longer than ~76 chars (after theN.prefix) is truncated with an ellipsis on the button, and the user cannot read the full option. The question renders fine (4096-char embed) but the choices do not.Observed live: a
clarify(...)prompt with long, descriptive choices showed each option clipped mid-sentence with…, leaving the user unable to tell the options apart.Fix
Enumerate every choice in full as a numbered list in the embed body, matching the
N.prefix on each button. The user reads the complete option in the list and clicks the matching number. The buttons keep their short labels (Discord's 80-char cap is unavoidable there).When the enumerated list overflows the 1024-char embed field, it falls back to the 4096-char embed description so the tail is never silently dropped.
Test
Adds
test_long_choices_shown_in_full: asserts two ~120-char choices appear verbatim in the rendered message, the numbered prefixes are present, and the buttons still carryN.labels.Scope
Two files, no workflow or config changes:
plugins/platforms/discord/adapter.py(send_clarify)tests/gateway/test_discord_clarify_buttons.py