Skip to content

fix: restore Discord metadata reads in official plugin installs - #147658

Merged
shakkernerd merged 2 commits into
openclaw:mainfrom
shakkernerd:fix/discord-metadata-reads
Sep 14, 2026
Merged

shakkernerd merged 2 commits into
openclaw:mainfrom
shakkernerd:fix/discord-metadata-reads

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Related: #115367

Builds on #143341, now merged into main.

What Problem This Solves

Agents using the official Discord plugin installed through npm or ClawHub can see metadata actions in the message tool, but allowed requests are rejected with an exact-current-conversation error before Discord can apply its configured access rules. This affects permission inspection, member and role information, emoji and channel lists, voice status, and scheduled-event lists. For example, inspecting the bot's permissions in an allowed sibling channel fails even though the bundled plugin supports that request.

User Impact

Restores the existing permissions, member-info, role-info, emoji-list, channel-list, voice-status, and event-list reads for verified official installations. Results retain their existing shapes, including guild roles, bounded emoji output, member presence when available, and a normal absent result for unknown voice state.

Permission inspection still requires an allowed channel. Guild metadata still requires a guild allowed by the selected account's current configuration and unrestricted or wildcard channel access. Only direct operators retain the filtered-results relaxation for channel-list. The existing coordinated core/plugin release requirement applies; this adds no setting, migration, or new Discord capability.

Why This Change Was Made

Discord's explicit readAuthorityActions list covered its original six conversation reads. Qualifying the seven existing metadata reads through that list and the host's allowed read set lets their established provider gates run in verified official installations. Requiring both declarations keeps a shared action name from silently opting another adapter into more authority, including Matrix's mixed permissions action.

The existing read-authority mechanism retains the originating caller and registration through awaited work, queued requests, retries, and final results or errors. Provider code, account/requester/origin checks, token and action gates, and destination policies keep their existing owners. Revocation prevents subsequent requests and rejects stale completion; it cannot undo a request already sent. Message mutations, moderation, uploads, voice participation, event creation, and presence changes are outside this patch.

Two equivalent dispatcher simplifications reuse its prepared context and inline a single-use origin normalizer to satisfy the existing file-size guard.

Evidence

  • The new registered-provider regression suite validates advertised, schema-valid inputs and exercises the actual Discord handlers and REST client against a loopback HTTP server. All seven ordinary requests failed at the host gate before the change and now return their expected metadata using GET requests only.

  • All 45 integration cases passed, covering action/token denial, guild and channel restrictions, missing or mismatched origin/account context, unverified and legacy registrations, direct-versus-delegated channel listing, unknown voice state, current-channel emoji resolution, and stale results/errors/retries. Permission revocation after channel lookup prevents later bot-permission requests. Shared-runner controls return channel permissions with GETs only and reject seven user-alias forms, including an allowlisted numeric user, before any provider request.

  • The existing Discord/Slack HTTP authority suite, registered dispatcher/security cases, Discord provider behavior, REST fencing, emoji-cache/voice controls, and target/reaction-owner tests passed. The complete changed gate passed again on the rebased head, including core, extension and test type graphs, formatting, lints, docs and boundary guards. Its exact-head 80-case preflight and 395 additional source cases also passed. Independent review and the focused alias-test review found no actionable P0–P2 issues.

  • Fresh core and Discord packages built from the rebased head passed 57 scenarios each after native npm and canonical ClawHub installation (114 total), including all seven advertised reads, configured denials, registration/caller revocation, and stale successes, errors and retries. The probe uses existing compiled exports verified against the core tarball and real installer/loader records. The ClawHub audit verifies the complete package/artifact/download request sequence and native integrity checks. Fixture processes joined cleanly and source/artifact hashes remained unchanged. The build used a private 2026.9.5 release fixture through the canonical release-version and package helpers; it did not publish a release.

  • Shared compatibility qualification in fix: restore context reads for installed official Discord and Slack plugins #143341 passed four expected old-core API rejections and both actual published 2026.9.3/2026.9.4 update drivers. Those runs preserved configuration, plugin and workspace records and passed four existing reads after upgrade. The receipt applies to the unchanged prerequisite contracts; the Discord-specific installed scenarios above establish this patch’s consumer behavior.

The focused regression can be run with:

node scripts/run-vitest.mjs test/discord-metadata-read-authority.integration.test.ts

Both commits are now rebased onto the merged prerequisite on main; the four affected files are byte-identical to the earlier tested patch. Fresh integrated loading/build proof passed on this head, and its current ClawSweeper review is Platinum with no actionable code or security findings. Hosted CI completed with one unrelated Docker helper assertion failure and its aggregate failure. The same assertion was reproduced on the main baseline with identical consumed inputs; #148118 owns that repair. Current HTTP evidence uses synthetic credentials and provider responses; it is not authenticated Discord or production rollout evidence.

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord size: L maintainer Maintainer-authored PR labels Sep 14, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. labels Sep 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 14, 2026, 5:23 AM ET / 09:23 UTC (Revision 3).

ClawSweeper review

What this changes

Restores seven existing Discord metadata reads for verified official plugin installations, documents their access restrictions, and adds registered-provider HTTP regression coverage.

Merge readiness

⛔ Blocked before merge - 2 items remain

This remains a useful, focused fix: current main still excludes the seven metadata reads, and the merged prerequisite does not supersede it. No actionable introduced defect was found.

Priority: P1
Reviewed head: 7d073b98eb4c801eedaea86557cdce10fb376ebe

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful production-boundary evidence and no actionable correctness findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Recorded npm/ClawHub installation and real REST-client HTTP runs exercise the changed dispatcher-to-Discord path, including permitted reads, forbidden account/destination cases, and revocation before subsequent I/O or result delivery. Preserve that proof; the separately acknowledged integrated loading/build refresh remains outstanding.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Recorded npm/ClawHub installation and real REST-client HTTP runs exercise the changed dispatcher-to-Discord path, including permitted reads, forbidden account/destination cases, and revocation before subsequent I/O or result delivery. Preserve that proof; the separately acknowledged integrated loading/build refresh remains outstanding.
Evidence reviewed 10 items Introduced scope verified: The merge-base comparison confirms the two coordinated action-list additions, equivalent dispatcher simplifications, documentation changes, and integration suite. Raw test-merge parents match the pinned base followed by the exact PR head.
Current main still needs this fix: Current main’s Discord adapter declares only the original six reads; its host allowlist likewise excludes permissions and the six guild metadata actions.
Merged prerequisite: GitHub confirms #143341 merged on September 14. Its documented scope covers the original six Discord reads and supplies the shared registration and transport authority mechanism.
Findings None None.
Security None None.

How this fits together

OpenClaw’s shared message dispatcher authorizes agent requests before handing them to Discord. Discord then applies account and destination policies, performs REST requests, and returns metadata under the originating caller’s active authority.

flowchart TD
 A[Agent metadata request] --> B[Shared message dispatcher]
 C[Verified plugin registration] --> B
 B --> D[Discord account and destination checks]
 D --> E[REST requests with lifetime checks]
 E --> F[Metadata result]
 B --> G[Reject unauthorized or stale request]
 E --> G
Loading

Before merge

  • Resolve merge risk (P1) - The seven newly fenced bundled reads require a live registration; delegated artifact-only fallback calls now fail closed. Integrated loading/build qualification remains outstanding, and deployment must preserve the prerequisite’s coordinated core/plugin compatibility contract.
  • Complete next step (P2) - Complete the acknowledged integrated loading/build qualification on the rebased composition, preserving active-registration and coordinated core/plugin compatibility behavior.
Agent review details

Security

None.

PR surface

Source +11, Tests +480, Docs +7. Total +498 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 28 17 +11
Tests 1 480 0 +480
Docs 1 14 7 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 522 24 +498

Review metrics

Metric Value Why it matters
Delegated read eligibility 7 existing actions added; 0 new settings Host eligibility and Discord’s explicit opt-in expand together without implicitly opting other adapters in.
Production versus regression coverage Production net +11 lines; tests +480 lines Production growth is limited to action declarations and is justified by restoring existing metadata operations.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #115367
Summary: This PR addresses the Discord metadata subset of the broader official-plugin read-gate issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Finish integrated package qualification (recommended)
    Refresh loading/build evidence on the rebased composition while preserving active registration and the demonstrated core/plugin upgrade contract.

Technical review

Best possible solution:

Keep the existing Discord policy owners and ship the coordinated action opt-in with integrated package-loading and upgrade qualification.

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

Yes, from source: an official external Discord registration requesting role-info or sibling-channel permissions falls outside main’s six-action allowlist and reaches the exact-current rejection. This read-only review did not execute tests.

Is this the best way to solve the issue?

Yes. Extending both existing opt-in lists reaches the established Discord handlers without duplicating access policy or granting authority to unverified adapters.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against d99619cc4e68.

Labels

Label justifications:

  • P1: Official installed Discord plugins reject existing metadata operations before provider checks, including reported channel-list workflows.
  • merge-risk: 🚨 compatibility: The newly opted-in bundled reads require an active registration, making integrated loading and coordinated package compatibility material before merge.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Recorded npm/ClawHub installation and real REST-client HTTP runs exercise the changed dispatcher-to-Discord path, including permitted reads, forbidden account/destination cases, and revocation before subsequent I/O or result delivery. Preserve that proof; the separately acknowledged integrated loading/build refresh remains outstanding.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded npm/ClawHub installation and real REST-client HTTP runs exercise the changed dispatcher-to-Discord path, including permitted reads, forbidden account/destination cases, and revocation before subsequent I/O or result delivery. Preserve that proof; the separately acknowledged integrated loading/build refresh remains outstanding.

Evidence

What I checked:

Likely related people:

  • anyech: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • shakkernerd: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Refresh integrated loading/build evidence after prerequisite integration, retaining the demonstrated registration and upgrade behavior.

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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-14T01:28:27.574Z sha 93f554ca81d2a7bed1891d465750eaf3797a0251 :: blocked before merge. :: none
  • reviewed 2026-09-14T01:52:42.202Z sha 93f554ca81d2a7bed1891d465750eaf3797a0251 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 14, 2026
@shakkernerd
shakkernerd changed the base branch from stack/official-plugin-reads to main September 14, 2026 08:56
@shakkernerd
shakkernerd force-pushed the fix/discord-metadata-reads branch from 93f554c to 7d073b9 Compare September 14, 2026 08:56
@shakkernerd shakkernerd self-assigned this Sep 14, 2026
@shakkernerd
shakkernerd merged commit df663a9 into openclaw:main Sep 14, 2026
222 of 226 checks passed
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: official Discord plugin installations can read bot permissions and guild metadata with the existing access and lifetime checks.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 15, 2026
…claw#147658)

Restore bot-permission and guild metadata reads for verified official Discord plugins while preserving existing access and lifetime checks.

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

Labels

channel: discord Channel integration: discord docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

1 participant