Skip to content

Preserve reusable Discord presentation buttons - #84187

Merged
steipete merged 3 commits into
openclaw:mainfrom
100menotu001:codex/discord-presentation-reusable-buttons
May 21, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
100menotu001:codex/discord-presentation-reusable-buttons

Conversation

@100menotu001

@100menotu001 100menotu001 commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds reusable to portable presentation buttons, preserves it through Discord presentation mapping, and documents the field for message presentation authors.

Motivation

Closes #84182.

Presentation buttons can represent repeatable actions such as refresh or more-detail, but the portable schema and Discord mapper dropped the reusable intent before registry entries were created.

Change Type

  • Bug fix
  • Documentation

Scope

  • Adds reusable?: boolean to the presentation button type and tool schema.
  • Carries reusable: true from presentation buttons into Discord button specs.
  • Preserves per-button reusable state when Discord component entries are built.
  • Documents reusable?: boolean in docs/plugins/message-presentation.md.

Linked Issue/PR

Closes #84182.

Real Behavior Proof

Behavior or issue addressed: A portable presentation button with reusable: true must keep that flag through Discord mapping and component registry dispatch so repeatable actions are not consumed after the first callback.

Real environment tested: Redacted OpenClaw development checkout on this PR branch, using the Discord extension runtime path that maps presentation payloads into component entries.

Exact steps or command run after this patch: Ran a runtime diagnostic against this branch that created a reusable presentation button, mapped it to a Discord button spec, built component entries, and performed two dispatch-style lookups against the same callback data.

Evidence after fix: Redacted runtime output:

{
  "componentSpecButton": {
    "label": "More detail",
    "style": "secondary",
    "callbackData": "detail",
    "reusable": true
  },
  "entryReusable": true,
  "handlerConsumePolicy": false,
  "firstDispatch": {
    "label": "More detail",
    "callbackData": "detail"
  },
  "secondDispatch": {
    "label": "More detail",
    "callbackData": "detail"
  }
}

Observed result after fix: The Discord button spec contains reusable: true, the registered entry retains entryReusable: true, handler consume policy is false, and both lookup attempts return the same button metadata.

Not tested: No live Discord provider send was needed for this field-propagation path; the exercised behavior is the runtime mapping and registry decision that controls whether the callback is consumed.

Root Cause

Discord component entries supported reusable behavior, but portable presentation buttons had no reusable schema field and the Discord presentation mapper only copied label, style, callback data, and URL.

Regression Test Plan

  • pnpm exec vitest run extensions/discord/src/shared-interactive.test.ts extensions/discord/src/components.test.ts

Result: 2 files passed, 15 tests passed.

User-visible / Behavior Changes

Message senders can now use presentation.blocks[].buttons[].reusable for Discord presentation buttons.

Diagram

N/A. This is a direct schema, adapter, component-entry, and docs propagation fix.

Security Impact

No new secrets or network calls. The change only preserves an explicit boolean in already-authored message payloads.

Repro + Verification

Before this change, a presentation button authored with reusable intent could not carry that intent through the message tool schema and Discord presentation mapper. The new test asserts that the generated Discord component spec retains it, and the redacted runtime diagnostic confirms the handler sees it as non-consuming.

Evidence

  • Focused regression command passed.
  • Redacted runtime diagnostic above confirms the mapped button remains reusable through component registration and dispatch-style resolution.

Human Verification

No live Discord service is required for this field-propagation fix; the proof exercises the runtime path that decides whether an interaction callback is consumed.

Compatibility / Migration

Backward compatible. Existing payloads are unchanged unless they opt into reusable: true.

Risks

Low. The flag is only emitted when explicitly set to true.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord agents Agent runtime and tooling size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 19, 2026
@clawsweeper

clawsweeper Bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Summary
Adds an optional reusable flag to portable message presentation buttons, propagates it through Discord component mapping and entry registration, and updates focused tests, docs, and the changelog.

Reproducibility: yes. by source inspection: current main has no reusable field in the portable presentation type or message tool schema, while Discord registry handlers already use entry-level reusable to avoid consuming callbacks.

PR rating
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🦞 diamond lobster
Summary: Good focused PR with sufficient runtime proof and clean implementation; the main remaining gate is maintainer acceptance of the public field.

Rank-up moves:

  • none
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Real behavior proof
Sufficient (live_output): The PR body includes redacted after-patch runtime output showing the mapped button spec, registered reusable entry, non-consuming handler policy, and two successful dispatch-style lookups.

Mantis proof suggestion
A real Discord click-twice proof would add useful transport confidence for the visible repeated-button behavior, although the supplied runtime diagnostic covers the field-propagation path. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

visual task: verify that a Discord presentation button with reusable=true can be clicked twice and dispatches both interactions.

Risk before merge

  • This PR makes presentation.blocks[].buttons[].reusable part of the public portable presentation/tool contract; existing payloads are unchanged, but maintainers need to own the API semantics once it lands.

Maintainer options:

  1. Accept reusable as portable API (recommended)
    Merge after maintainers accept presentation.blocks[].buttons[].reusable as an optional portable contract with Discord-backed semantics.
  2. Defer the contract expansion
    Pause or close if reusable should remain Discord-specific or top-level until a broader presentation capability design exists.

Next step before merge
No ClawSweeper repair lane is needed; maintainers need to decide the public reusable presentation field and then rely on normal PR checks.

Security
Cleared: The diff only changes typed payload/schema fields, Discord adapter propagation, docs, changelog, and focused tests; it adds no dependencies, scripts, permissions, network calls, or secret handling.

Review details

Best possible solution:

If maintainers accept the public field, land the narrow opt-in propagation while keeping Discord's actual consume policy in the existing component registry.

Do we have a high-confidence way to reproduce the issue?

Yes, by source inspection: current main has no reusable field in the portable presentation type or message tool schema, while Discord registry handlers already use entry-level reusable to avoid consuming callbacks.

Is this the best way to solve the issue?

Yes, assuming maintainers accept the public contract addition. The PR follows the existing disabled propagation pattern and reuses Discord's established registry consumption path instead of adding a parallel mechanism.

Label changes:

  • add merge-risk: 🚨 compatibility: The diff expands the public message presentation/tool schema with a new optional field, so API compatibility and permanence need maintainer acceptance.

Label justifications:

  • P2: This is a normal-priority Discord/message-presentation improvement with focused scope and no evidence of broad breakage.
  • merge-risk: 🚨 compatibility: The diff expands the public message presentation/tool schema with a new optional field, so API compatibility and permanence need maintainer acceptance.
  • rating: 🐚 platinum hermit: Current PR rating is 🐚 platinum hermit because proof is 🐚 platinum hermit, patch quality is 🦞 diamond lobster, and Good focused PR with sufficient runtime proof and clean implementation; the main remaining gate is maintainer acceptance of the public field.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes redacted after-patch runtime output showing the mapped button spec, registered reusable entry, non-consuming handler policy, and two successful dispatch-style lookups.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes redacted after-patch runtime output showing the mapped button spec, registered reusable entry, non-consuming handler policy, and two successful dispatch-style lookups.

What I checked:

  • Current main lacks portable reusable propagation: Current main defines MessagePresentationButton with disabled and style but no reusable, and normalizeButton/presentationToInteractiveReply only preserve known fields such as disabled. (src/interactive/payload.ts:15, 7f4462e5c06d)
  • Message tool schema currently omits reusable: The current message tool presentation button schema accepts disabled and style but has no reusable boolean, so a model-authored presentation payload cannot express per-button reuse on main. (src/agents/tools/message-tool.ts:163, 7f4462e5c06d)
  • Discord registry already honors reusable entries: Discord component entries already carry reusable?: boolean, builders merge entry-level and top-level reusable state, and interaction handlers resolve entries with consume: !entry.reusable. (extensions/discord/src/monitor/agent-components.handlers.ts:102, 7f4462e5c06d)
  • PR diff addresses the propagation path: The provided PR diff adds reusable?: boolean to the portable presentation type and tool schema, maps reusable: true in Discord shared-interactive conversion, passes params.spec.reusable into button entries, and adds focused adapter/payload tests plus docs. (extensions/discord/src/shared-interactive.ts:63, 52f25221b3e0)
  • Contributor supplied after-fix runtime proof: The PR body includes redacted runtime output showing a reusable presentation button becomes a Discord button spec with reusable: true, registers an entry with entryReusable: true, uses a non-consuming handler policy, and resolves twice. (52f25221b3e0)
  • Feature-history provenance: Current-main blame and log in this shallow checkout point the relevant presentation, Discord component, and registry paths to commit b248b4816b0d26c09847b52ea0a3e195fe5ec7a3; the limited grafted history makes older authorship unavailable locally. (extensions/discord/src/shared-interactive.ts:91, b248b4816b0d)

Likely related people:

  • Shakker: Current-main blame in this checkout attributes the central portable presentation, Discord mapping, component builder, and registry handler lines to b248b4816b0d26c09847b52ea0a3e195fe5ec7a3. (role: current-main area contributor; confidence: medium; commits: b248b4816b0d; files: src/interactive/payload.ts, src/agents/tools/message-tool.ts, extensions/discord/src/shared-interactive.ts)
  • steipete: The PR timeline shows assignment by steipete and the latest PR branch commit 52f25221b3e01f3255d8df37df73d0357ab7410b adjusting the Discord presentation conversion, making him a useful routing contact for the API decision. (role: recent reviewer/branch contributor; confidence: medium; commits: 52f25221b3e0; files: extensions/discord/src/shared-interactive.ts, src/interactive/payload.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 7f4462e5c06d.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels May 19, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 19, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 19, 2026
@100menotu001
100menotu001 force-pushed the codex/discord-presentation-reusable-buttons branch from 1b3e153 to 8b8b583 Compare May 20, 2026 01:30
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 20, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 20, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🌱 uncommon Gilded Test Hopper

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🌱 uncommon.
Trait: keeps receipts.
Image traits: location flaky test forest; accessory green check lantern; palette rose quartz and slate; mood curious; pose guarding a tiny green check; shell matte ceramic shell; lighting calm overcast light; background little resolved-comment flags.
Share on X: post this hatch
Copy: My PR egg hatched a 🌱 uncommon Gilded Test Hopper in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@steipete steipete self-assigned this May 21, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label May 21, 2026
@steipete
steipete merged commit 0212188 into openclaw:main May 21, 2026
116 of 119 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: discord Channel integration: discord docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discord presentation buttons should preserve reusable callback intent

2 participants