Skip to content

refactor(discord): consolidate interactive response handling - #119448

Merged
steipete merged 1 commit into
mainfrom
codex/loc-0804-discord-luem8u
Aug 5, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/loc-0804-discord-luem8u

Conversation

@steipete

@steipete steipete commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Discord interactive replies duplicated private invalid/expired-component failure handling across buttons, selects, modal triggers, modal submissions, and system controls. The legacy interactive and current presentation renderers also maintained duplicate select construction and action-value logic, increasing maintenance risk for interaction behavior.

Why This Change Was Made

Consolidate private interaction failure replies in one Discord-owned helper and reuse the canonical presentation action-value resolver plus shared Discord select/button builders. Preserve authorization and per-user allowlist checks before consuming persisted interactions, existing ephemeral failure text and expired-interaction handling, exact command-versus-callback isolation, mixed-action rejection, modal behavior, authored component ordering, and five-button action rows. No public plugin SDK or configuration contracts change.

User Impact

No intended user-visible behavior change: Discord buttons, selects, modal forms, authorization denials, and private invalid/expired interaction responses continue behaving exactly as before. The Discord plugin loses 92 production lines (+90/-182 across six files) while retaining the same component rendering and delivery semantics.

Evidence

  • Trusted Blacksmith Testbox proof: https://github.com/openclaw/openclaw/actions/runs/30970879382
  • 16 existing focused Discord interaction, component, action, and monitor suites: 261/261 tests passed.
  • Full, unchanged pnpm check:changed: passed, including extension production/test typechecks, formatting, plugin/API boundaries, dead-export scan, dependency guards, changed-file lint (0 warnings/errors), database/media/runtime sidecar guards, and runtime import-cycle checks.
  • Independent structured autoreview of the frozen change: engine codex, model gpt-5.6-sol, thinking xhigh; no accepted/actionable findings, patch correctness confidence 0.99.
  • Direct dependency-contract inspection confirmed private Discord responses use the ephemeral message flag, command/callback select actions remain distinct, and existing component/action-row behavior is preserved.

Exact-head Discord interaction production proof

Twelve actual committed production modules were checked against their exact Git object bytes, source-transpiled, and executed through the real Discord DM authorization owner, allowed-user enforcement, component/modal handlers, registry consumption, and canonical presentation normalization. Interaction objects and Discord transport were synthetic in-memory fixtures; no live account, credentials, network, or gateway were touched.

{
  "head":"c0dbcc586f9ff0ce9e5d4bb883fa1b350291237b",
  "committedProductionModulesVerified":12,
  "authorizedCommand":{"dmAuth":"allow","allowedUsers":["111"],"consume":[false,true],"reply":{"content":"✓","ephemeral":true},"dispatched":"/status","pluginCallbackAuthorized":true},
  "expiredComponent":{"reply":{"content":"This component has expired.","ephemeral":true},"dispatched":false},
  "unauthorizedDm":{"reply":{"content":"You are not authorized to use this button.","ephemeral":true},"consumed":false},
  "deniedAllowedUsers":{"reply":{"content":"You are not authorized to use this button.","ephemeral":true},"consumed":false},
  "modalTrigger":{"shown":"Deploy configuration","componentConsumed":true},
  "modalSubmission":{"callback":"deploy:confirm","event":"Form \"Deploy configuration\" submitted.\n- Environment: production","consumed":true},
  "expiredModal":{"reply":{"content":"This form has expired.","ephemeral":true}},
  "expiredReplyRejection":"swallowed",
  "mixedCommandCallbackSelect":"rejected",
  "buttonRows":[5,2],
  "assertions":"PASS"
}

All actual production handler assertions passed: successful authorized component dispatch, private expiration and unauthorized replies, modal submission, authorization-before-consumption, mixed action rejection, and safe button-row splitting. This directly fulfills the requested redacted after-fix Discord interaction proof at the unchanged reviewed commit.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: M maintainer Maintainer-authored PR labels Aug 5, 2026
@steipete
steipete marked this pull request as ready for review August 5, 2026 03:13
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 5, 2026
@clawsweeper

clawsweeper Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 4, 2026, 11:20 PM ET / August 5, 2026, 03:20 UTC.

ClawSweeper review

What this changes

This PR consolidates Discord component failure replies and shares select/button rendering logic while preserving existing interactive behavior.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 3 items remain

Keep open for human review: the refactor appears behavior-preserving and correctly owned by the Discord plugin, but the PR has a protected maintainer label and only test/CI evidence rather than after-fix real interaction proof.

Priority: P3
Reviewed head: c0dbcc586f9ff0ce9e5d4bb883fa1b350291237b

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is focused and source-consistent, but real behavior proof remains a merge gate.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body reports focused suites and Testbox checks, but no redacted after-fix Discord interaction or mock-gateway transcript showing the changed path. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body reports focused suites and Testbox checks, but no redacted after-fix Discord interaction or mock-gateway transcript showing the changed path. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Canonical action mapping: The PR delegates select values to the existing SDK resolver, which maps only command actions to commands and callback actions to callback values.
Interaction reply contract: All targeted button, select, and modal interactions share the internal reply implementation; it serializes the existing ephemeral payload path.
Command/callback isolation: The unchanged handler keeps opaque callback values out of synthetic command fallback while allowing explicit command actions.
Findings None None.
Security None None.

How this fits together

Discord renders portable presentation actions into persisted buttons, selects, and modals, then routes user interactions through authorization and per-user allowlist checks before dispatching events or private replies.

flowchart LR
  A[Presentation actions] --> B[Discord component renderer]
  B --> C[Persisted components]
  C --> D[Authorization and allowlist checks]
  D --> E[Private reply or event dispatch]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports focused suites and Testbox checks, but no redacted after-fix Discord interaction or mock-gateway transcript showing the changed path. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - Before merge, the PR needs redacted after-fix real Discord interaction proof; the body currently supplies tests and CI only.
  • Complete next step (P2) - Obtain the required real behavior proof and retain human review because the PR carries the protected maintainer label.
Agent review details

Security

None.

PR surface

Source -92. Total -92 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 6 90 182 -92
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 90 182 -92

Review metrics

Metric Value Why it matters
Production/test LOC delta production +90/-182 (net -92); tests +0/-0 The net production reduction supports a consolidation rather than a new runtime or configuration surface.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the Discord-local consolidation and add a redacted real bot or mock-gateway interaction transcript covering a successful component action and an unavailable/expired reply.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the Discord-local consolidation and add a redacted real bot or mock-gateway interaction transcript covering a successful component action and an unavailable/expired reply.

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

Not applicable: this PR refactors existing Discord behavior rather than reporting a discrete user-facing failure.

Is this the best way to solve the issue?

Yes: the shared Discord helper and select builder remove duplicate local policy while preserving the existing SDK action contract and handler boundary.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a8caab5c3d3c.

Labels

Label changes:

  • add P3: This is a behavior-preserving Discord cleanup with no demonstrated user regression.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports focused suites and Testbox checks, but no redacted after-fix Discord interaction or mock-gateway transcript showing the changed path. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P3: This is a behavior-preserving Discord cleanup with no demonstrated user regression.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports focused suites and Testbox checks, but no redacted after-fix Discord interaction or mock-gateway transcript showing the changed path. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

Likely related people:

  • vincentkoc: Blame attributes the current shared interactive renderer and component-handler source to Vincent Koc's recent Discord-area commit. (role: recent area contributor; confidence: medium; commits: 6293b54250fc; files: extensions/discord/src/shared-interactive.ts, extensions/discord/src/monitor/agent-components.handlers.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add redacted after-fix Discord interaction proof; terminal output, a mock-gateway verdict transcript, or a bot interaction recording is sufficient.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

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

@steipete
steipete merged commit 9214e63 into main Aug 5, 2026
186 of 192 checks passed
@steipete
steipete deleted the codex/loc-0804-discord-luem8u branch August 5, 2026 04:01
@steipete

steipete commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant