Skip to content

[Fix] Accept Discord button clicks and keep their task threads anchored#441

Merged
daniel-lxs merged 1 commit into
developfrom
fix/discord-button-interactions
Jul 16, 2026
Merged

[Fix] Accept Discord button clicks and keep their task threads anchored#441
daniel-lxs merged 1 commit into
developfrom
fix/discord-button-interactions

Conversation

@daniel-lxs

Copy link
Copy Markdown
Member

Two defects found while dogfooding the routing-confirmation flow against a real Discord bot.

Every button click was silently discarded

The envelope schema typed data.id as a string, but Discord sends the pressed component's numeric layout id there — only slash commands send a snowflake string, which is exactly why /link worked while All repositories did nothing at all. Every component interaction failed validation with invalid_discord_event (400) and was quarantined to the dead-letter stream. Now both shapes are accepted.

Confirmed launches detached their task thread

When routing needs a confirmation card, the launch happens on the button interaction, which has no message of its own — so the anchor from the original mention was lost and the task thread fell back to detached (visible as "Roomotedev started a thread" instead of a thread on the requester's message). The API now stamps the anchor from the triggering message; it rides along in the pending route and survives the round trip to the confirmed launch.

Interactions genuinely have no anchor of their own, so /new and suggestion-card buttons keep their detached threads by design.

Validation

  • api discord suite 61/61, communication discord-event 8/8 (new: numeric data.id envelope parses; anchor survives the pending-route round trip)
  • check-types 26/26, oxlint, format, knip green
  • Verified live: mention → card → click → task launches, thread created, early-title rename, cancel button all working

Found by the same dogfooding session as #432 and #438 — three real Discord-contract bugs the mock harness structurally could not catch, because it encoded our assumptions about Discord rather than Discord's actual behavior.

🤖 Generated with Claude Code

@roomote-roomote

roomote-roomote Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

No new code issues found. See task

Reviewed 53c1ac8

Two defects found dogfooding the routing-confirmation flow against real
Discord:

- Every component interaction was rejected as invalid and quarantined.
  The envelope schema typed data.id as a string, but Discord sends the
  pressed component's numeric layout id there; only slash commands send
  a snowflake string, which is why /link worked while every button did
  nothing at all. Accept both shapes.
- A launch confirmed through the routing card detached its task thread.
  The launch happens on the button interaction, which has no message of
  its own, so the anchor from the original mention has to ride along in
  the pending route; the API now stamps it from the triggering message
  and it survives the round trip.

Interactions still have no anchor of their own, so /new and suggestion
buttons keep their detached threads.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@daniel-lxs
daniel-lxs force-pushed the fix/discord-button-interactions branch from ab15513 to 53c1ac8 Compare July 16, 2026 19:01
@daniel-lxs

Copy link
Copy Markdown
Member Author

Verified live against real Discord after rebasing onto #438.

Before the fix (task run 51) vs after (task run 52), comparing the launch payload's source message id against the created thread id:

task_run source message thread id anchored
51 (before) …690394857704 …848897863770
52 (after) …925093134387 …925093134387

The thread id now equals the triggering message id, and Discord renders the task thread nested under the requester's message rather than as a detached "Roomotedev started a thread" line. Full path exercised: mention → routing card → button click (previously a silent no-op, now accepted) → task launch → anchored thread → early-title rename.

🤖 Generated with Claude Code

@daniel-lxs
daniel-lxs merged commit 86ef098 into develop Jul 16, 2026
16 checks passed
@daniel-lxs
daniel-lxs deleted the fix/discord-button-interactions branch July 16, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant