Skip to content

fix(discord): show full clarify choice text, not just truncated buttons - #72608

Open
shailensobhee wants to merge 1 commit into
NousResearch:mainfrom
shailensobhee:fix/discord-clarify-full-choice-text
Open

fix(discord): show full clarify choice text, not just truncated buttons#72608
shailensobhee wants to merge 1 commit into
NousResearch:mainfrom
shailensobhee:fix/discord-clarify-full-choice-text

Conversation

@shailensobhee

Copy link
Copy Markdown

Problem

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) 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 carry N. labels.

tests/gateway/test_discord_clarify_buttons.py .... 15 passed

Scope

Two files, no workflow or config changes:

  • plugins/platforms/discord/adapter.py (send_clarify)
  • tests/gateway/test_discord_clarify_buttons.py

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.
@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins platform/discord Discord bot adapter P3 Low — cosmetic, nice to have needs-decision Awaiting maintainer decision before any implementation sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 27, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related to #62291: both expose full Discord clarify choices, but this keeps shortened button labels with an embed list while #62291 uses numeric buttons for mobile readability. These are competing UI semantics, not duplicates.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:6834 slices 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-6867 puts the full list in tail, but _self_contained_prompt_content() only budgets/truncates body (plugins/platforms/discord/adapter.py:6769-6773). The content can therefore exceed MAX_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-439 with 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]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 = (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_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.

@teknium1 teknium1 added the sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform label Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have platform/discord Discord bot adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants