Repository navigation
fix(discord): preserve authored block order in presentation components - #119506
Conversation
buildDiscordPresentationComponents rendered presentations in two passes - all text/context/divider blocks first, then every buttons/select block - so any block authored after a control was moved above it and controls always sank below all prose. Discord Components V2 layouts interleave freely and the deprecated single-pass renderer pins interleaving as the contract, so merge the passes into one order-preserving loop (title still pinned first).
|
Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 2:04 AM ET / 06:04 UTC. ClawSweeper reviewWhat this changesThe PR merges Discord’s two presentation-rendering passes so text, context, dividers, buttons, and selects are emitted in their authored order. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open: this is a narrow, correct Discord renderer repair. Current main still separates prose blocks from controls, while the PR restores the portable presentation contract’s authored order without changing action encoding or limits. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw passes ordered portable presentation blocks to the Discord plugin, which converts them into Components V2 blocks for outbound delivery. The generated specification is then serialized into Discord’s ordered container layout. flowchart LR
A[Portable presentation blocks] --> B[Discord presentation renderer]
B --> C[Ordered component specification]
C --> D[Discord V2 container]
D --> E[Outbound Discord message]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -2, Tests +24. Total +22 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the one-pass renderer after the final merge candidate has current exact-head CI coverage. Do we have a high-confidence way to reproduce the issue? Yes. Current main’s two loops deterministically reorder an authored text-control-text presentation, and the PR’s focused regression case exercises that path. Is this the best way to solve the issue? Yes. Repairing the Discord presentation renderer is the narrow owner-boundary fix; changing producers or introducing explicit position metadata would contradict the existing ordered-block contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 20bd49db8950. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(discord): preserve authored block order in presentation components This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Merged via squash.
|
Punchcard-Session: frost-brook-timber-mx * origin/main: fix: cap local tsgo CPU usage (#119517) fix(tool-search): normalize dotted call arguments (#119418) (#119464) fix(qa): retain child output on CLI timeouts (#119524) fix(discord): preserve authored block order in presentation components (#119506) fix: make plugin verification restart guidance install-neutral (#119508) fix(qa): preserve profile execution contracts (#119519) test(qa): cover managed OTEL runtime paths (#118965) Punchcard-Session: frost-brook-timber-mx
openclaw#119506) buildDiscordPresentationComponents rendered presentations in two passes - all text/context/divider blocks first, then every buttons/select block - so any block authored after a control was moved above it and controls always sank below all prose. Discord Components V2 layouts interleave freely and the deprecated single-pass renderer pins interleaving as the contract, so merge the passes into one order-preserving loop (title still pinned first).
Punchcard-Session: frost-brook-timber-mx * origin/main: fix: cap local tsgo CPU usage (openclaw#119517) fix(tool-search): normalize dotted call arguments (openclaw#119418) (openclaw#119464) fix(qa): retain child output on CLI timeouts (openclaw#119524) fix(discord): preserve authored block order in presentation components (openclaw#119506) fix: make plugin verification restart guidance install-neutral (openclaw#119508) fix(qa): preserve profile execution contracts (openclaw#119519) test(qa): cover managed OTEL runtime paths (openclaw#118965) Punchcard-Session: frost-brook-timber-mx
Summary
fix(discord): preserve authored block order in presentation components instead of sinking buttons below all textWhat Problem This Solves
buildDiscordPresentationComponents(extensions/discord/src/shared-interactive.ts) turns an agent's authoredMessagePresentation— an ordered list of text, context, divider, button, and select blocks — into Discord Components V2 layout. The Discord V2 protocol allows text, separators, and action rows to interleave arbitrarily, so the authored order is the message layout.The builder however runs two passes: it first collects every text/context/divider block (in order), then appends every buttons/select block. A presentation authored as
[text "构建结果", buttons […], text "3 个测试被跳过"]renders as[text 构建结果, text 3 个测试被跳过, actions]— the trailing note jumps above the buttons and the buttons sink below all text. Selects written before buttons get moved after them too. Users see a scrambled message whose controls no longer sit where the author placed them.代码证据: in
extensions/discord/src/shared-interactive.ts(main),buildDiscordPresentationComponents(:207-241) iteratespresentation.blockstwice — the firstforloop (:217) emits only text/context/divider, the second (:235) appends buttons/select — so output order can never interleave. Meanwhile the@deprecatedsiblingbuildDiscordInteractiveComponents(:183-205) renders the same block kinds in a single order-preserving pass, and its testpreserves authored shared text blocks around controls(shared-interactive.test.ts:57) pins interleaving as the intended contract. The outbound path (outbound-components.ts:135) sends the spec verbatim as a V2 layout, so the reordering is user-visible.Root Cause
fd0970c077377a30847efb3d118bac7dd093891bon 2026-04-21, which introduced the order-breaking split between prose and controls. Commitb78c2ee8c850only made the second pass explicit while carrying the existing ordering bug forward.Why This Change Was Made
User Impact
Evidence
Setup: the real
buildDiscordPresentationComponentsexecuted vianode --import tsxwith an authored[text, buttons, text]presentation; the produced layout is printed and checked against the authored order. No mocks anywhere.Before (on main)
After (with fix)
Tests and Validation
node node_modules/vitest/vitest.mjs run extensions/discord/src/shared-interactive.test.ts— 21 passed (20 existing + 1 new:preserves authored block order around controlsfor the presentation builder)Punchcard-Session: clear-orchard-lantern-bc