Skip to content

refactor(plugins): route Discord runtime through plugin sdk#51444

Merged
scoootscooob merged 1 commit intoopenclaw:mainfrom
scoootscooob:codex/discord-runtime-plugin-sdk
Mar 21, 2026
Merged

refactor(plugins): route Discord runtime through plugin sdk#51444
scoootscooob merged 1 commit intoopenclaw:mainfrom
scoootscooob:codex/discord-runtime-plugin-sdk

Conversation

@scoootscooob
Copy link
Copy Markdown
Contributor

Summary

Describe the problem and fix in 2-5 bullets:

  • Problem: src/plugins/runtime/runtime-discord.ts and src/plugins/runtime/runtime-discord-ops.runtime.ts still imported extensions/discord/runtime-api.js directly.
  • Why it matters: that keeps Discord on the grandfathered side of the plugin import-boundary tripwire instead of using the public plugin-sdk surface that recent refactors are converging on.
  • What changed: rewired both Discord runtime entrypoints to import from src/plugin-sdk/discord.ts and refreshed the boundary inventory to remove the 3 Discord direct-import entries.
  • What did NOT change (scope boundary): this does not change Discord runtime behavior or the exported Discord runtime-api surface; it only changes which internal boundary src/plugins/runtime/* depends on.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

User-visible / Behavior Changes

None intended.

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node 22 / pnpm
  • Model/provider: not applicable
  • Integration/channel (if any): Discord plugin runtime surface
  • Relevant config (redacted): none required

Steps

  1. Replace direct extensions/discord/runtime-api.js imports in src/plugins/runtime/* with src/plugin-sdk/discord.ts imports.
  2. Refresh the plugin import-boundary inventory.
  3. Run plugin boundary guardrails, Discord-focused tests, direct runtime smoke, and repo check/build.

Expected

  • Discord disappears from the src/plugins/** -> extensions/** inventory.
  • The published Discord runtime-api guardrails still pass.
  • Discord runtime surface shape stays intact.

Actual

  • After this patch, the import-boundary inventory drops from 8 entries to 5 remaining grandfathered entries.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
    • pnpm lint:plugins:no-extension-imports
    • pnpm test -- test/plugin-extension-import-boundary.test.ts
    • pnpm test -- src/plugin-sdk/runtime-api-guardrails.test.ts
    • pnpm test -- src/plugins/runtime/runtime-discord-typing.test.ts extensions/discord/src/monitor/provider.lifecycle.test.ts
    • pnpm check
    • pnpm build
    • direct smoke: instantiated createRuntimeDiscord() and confirmed the expected runtime surface methods are present
  • Edge cases checked:
    • Discord dropped out of the boundary inventory completely
    • runtime-api allowlist/guardrails still match current exports
    • local build/check remained green after the refactor
  • What you did not verify:
    • full remote GitHub Actions matrix
    • live Discord bot traffic against a real account

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: revert commit fc11b66950ae204127a2eb239ad0bdc943c767c3
  • Files/config to restore:
    • src/plugins/runtime/runtime-discord.ts
    • src/plugins/runtime/runtime-discord-ops.runtime.ts
    • test/fixtures/plugin-extension-import-boundary-inventory.json
  • Known bad symptoms reviewers should watch for:
    • Discord reappearing in the plugin extension import-boundary inventory
    • missing Discord runtime methods in plugin consumers
    • runtime-api guardrail drift for Discord exports

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk: src/plugin-sdk/discord.ts could diverge from the extension runtime surface expected by src/plugins/runtime/*.
    • Mitigation: runtime-api guardrails, Discord-focused tests, direct runtime smoke, and full local check/build all passed.

@openclaw-barnacle openclaw-barnacle bot added size: XS maintainer Maintainer-authored PR labels Mar 21, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 21, 2026

Greptile Summary

This PR is a clean, scope-limited refactor that reroutes the Discord runtime entrypoints (runtime-discord.ts and runtime-discord-ops.runtime.ts) off the grandfathered extensions/discord/runtime-api.js direct import path and onto the public src/plugin-sdk/discord.ts surface, then updates the plugin import-boundary inventory to reflect that Discord no longer appears in the grandfathered list.

  • All 17 named exports consumed by runtime-discord-ops.runtime.ts and all 9 consumed by runtime-discord.ts are confirmed present in src/plugin-sdk/discord.ts — no missing bindings.
  • The boundary inventory correctly drops from 8 to 5 entries (iMessage ×1, Slack-ops ×1, Telegram-ops ×2, Telegram ×1 remaining).
  • src/plugin-sdk/discord.ts itself still re-exports from extensions/discord/runtime-api.js, so the actual runtime symbols are unchanged — this is purely an import-path boundary change.
  • The only non-critical finding is that runtime-discord-ops.runtime.ts retains two separate import { … } from "../../plugin-sdk/discord.js" blocks (they were already two blocks before this PR); collapsing them into one would be a minor readability win but is entirely optional.

Confidence Score: 5/5

  • Safe to merge — purely a boundary refactor with no behavioral changes and all required symbols verified present in the target module.
  • Every imported symbol in both changed files was cross-checked against src/plugin-sdk/discord.ts and confirmed present. The boundary inventory update is correct and consistent with the code changes. No logic, types, or runtime behavior is altered. The only outstanding item is an optional style consolidation of two same-module import blocks.
  • No files require special attention.

Comments Outside Diff (1)

  1. src/plugins/runtime/runtime-discord-ops.runtime.ts, line 1-21 (link)

    P2 Duplicate import blocks from the same module

    Both import blocks (lines 1–9 and 10–21) now resolve to the same specifier ../../plugin-sdk/discord.js. Since this PR is already touching both blocks, it's a natural opportunity to collapse them into a single import { … } from "../../plugin-sdk/discord.js" statement, which is a minor readability improvement.

    Feel free to leave as-is if you prefer to keep the two import groups for readability — totally understandable given they were originally two separate conceptual clusters.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/plugins/runtime/runtime-discord-ops.runtime.ts
    Line: 1-21
    
    Comment:
    **Duplicate import blocks from the same module**
    
    Both import blocks (lines 1–9 and 10–21) now resolve to the same specifier `../../plugin-sdk/discord.js`. Since this PR is already touching both blocks, it's a natural opportunity to collapse them into a single `import { … } from "../../plugin-sdk/discord.js"` statement, which is a minor readability improvement.
    
    
    
    Feel free to leave as-is if you prefer to keep the two import groups for readability — totally understandable given they were originally two separate conceptual clusters.
    
    How can I resolve this? If you propose a fix, please make it concise.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/plugins/runtime/runtime-discord-ops.runtime.ts
Line: 1-21

Comment:
**Duplicate import blocks from the same module**

Both import blocks (lines 1–9 and 10–21) now resolve to the same specifier `../../plugin-sdk/discord.js`. Since this PR is already touching both blocks, it's a natural opportunity to collapse them into a single `import { … } from "../../plugin-sdk/discord.js"` statement, which is a minor readability improvement.

```suggestion
import {
  auditDiscordChannelPermissions as auditDiscordChannelPermissionsImpl,
  createThreadDiscord as createThreadDiscordImpl,
  deleteMessageDiscord as deleteMessageDiscordImpl,
  editChannelDiscord as editChannelDiscordImpl,
  editMessageDiscord as editMessageDiscordImpl,
  listDiscordDirectoryGroupsLive as listDiscordDirectoryGroupsLiveImpl,
  listDiscordDirectoryPeersLive as listDiscordDirectoryPeersLiveImpl,
  monitorDiscordProvider as monitorDiscordProviderImpl,
  pinMessageDiscord as pinMessageDiscordImpl,
  probeDiscord as probeDiscordImpl,
  resolveDiscordChannelAllowlist as resolveDiscordChannelAllowlistImpl,
  resolveDiscordUserAllowlist as resolveDiscordUserAllowlistImpl,
  sendDiscordComponentMessage as sendDiscordComponentMessageImpl,
  sendMessageDiscord as sendMessageDiscordImpl,
  sendPollDiscord as sendPollDiscordImpl,
  sendTypingDiscord as sendTypingDiscordImpl,
  unpinMessageDiscord as unpinMessageDiscordImpl,
} from "../../plugin-sdk/discord.js";
```

Feel free to leave as-is if you prefer to keep the two import groups for readability — totally understandable given they were originally two separate conceptual clusters.

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: "refactor: route disc..."

@scoootscooob scoootscooob self-assigned this Mar 21, 2026
@scoootscooob scoootscooob force-pushed the codex/discord-runtime-plugin-sdk branch from fc11b66 to 6747bbb Compare March 21, 2026 14:32
@scoootscooob scoootscooob merged commit f10d054 into openclaw:main Mar 21, 2026
37 checks passed
JohnJAS pushed a commit to JohnJAS/openclaw that referenced this pull request Mar 22, 2026
pholpaphankorn pushed a commit to pholpaphankorn/openclaw that referenced this pull request Mar 22, 2026
frankekn pushed a commit to artwalker/openclaw that referenced this pull request Mar 23, 2026
furaul pushed a commit to furaul/openclaw that referenced this pull request Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant