Skip to content

fix(discord): mirror Components v2 outbound messages to session transcript#1323

Open
BingqingLyu wants to merge 3 commits into
mainfrom
fork-pr-53607-fix-discord-components-v2-transcript-mirror-21649-21649
Open

fix(discord): mirror Components v2 outbound messages to session transcript#1323
BingqingLyu wants to merge 3 commits into
mainfrom
fork-pr-53607-fix-discord-components-v2-transcript-mirror-21649-21649

Conversation

@BingqingLyu

@BingqingLyu BingqingLyu commented Apr 27, 2026

Copy link
Copy Markdown
Owner

sendDiscordComponentMessage sends components via Discord REST API and registers component entries but never appends the outbound message to the session transcript, so the agent loses context when a user clicks a button.

Closes openclaw#21649

Changes:

  • Export appendAssistantMessageToSessionTranscript through src/plugin-sdk/outbound-runtime.ts
  • In extensions/discord/src/send.components.ts, import and call appendAssistantMessageToSessionTranscript after registerBuiltDiscordComponentMessage when sessionKey is present
  • Build transcript text from spec.text + component labels (buttons, selects, section accessory buttons, modal trigger buttons) for full agent context
  • Discord outbound adapter attaches meta.transcriptText to component delivery results so the core deliver pipeline mirrors richer component context
  • Core deliver pipeline checks delivery results for meta.transcriptText and prefers it over plain text for transcript mirroring
  • Add unit tests verifying transcript mirroring is called with correct params
  • Add e2e mirror test through deliverOutboundPayloads for component payloads
  • Add regression test for no double-write in outbound-send-service

Testing:

  • pnpm build && pnpm check && pnpm test (all passed)
  • Unit tests mock appendAssistantMessageToSessionTranscript verifying it is called with correct params
  • Integration test for no double-write in outbound-send-service
  • E2e test validates full pipeline integration of meta.transcriptText

AI-assisted (Claude + Codex committee consensus, fully tested).

AI-Assisted PR Checklist

  • Marked as AI-assisted
  • Testing degree: fully tested (pnpm build + check + test gates passed)
  • Code reviewed by LLM committee (Claude Opus + Codex dual-model review with consensus gate)
  • I understand what the code does
  • Bot review conversations addressed and resolved

…cript

Add buildComponentTranscriptText() to produce a plain-text summary of
Discord component messages (buttons, selects, sections, modals) for the
session transcript. The adapter attaches it as meta.transcriptText so the
existing mirror infrastructure in deliver.ts writes a single enriched
transcript entry instead of the plain fallback text.

Key design decisions:
- No parallel transcript write path: component text flows through
  meta.transcriptText on the adapter result, picked up by the existing
  deliverOutboundPayloadsCore mirror block. This avoids the duplicate
  transcript write that would occur if sendDiscordComponentMessage wrote
  independently of executeSendAction's onHandled callback.
- appendAssistantMessageToSessionTranscript is not exported to the plugin
  SDK to keep the transcript API as an internal surface.
- Mixed batch support: when some delivery results carry enriched adapter
  text and others do not, both the mirror text and adapter text are
  concatenated so neither portion is lost.

Closes openclaw#21649
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.

[Bug]: Discord Components v2: outbound component messages not mirrored to target session transcript

2 participants