Repository navigation
refactor(commands): share native plugin command merging - #120972
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 5:48 PM ET / 21:48 UTC. ClawSweeper reviewWhat this changesThis PR centralizes native plugin-command merging for Discord and Slack and makes Discord’s voice command part of the validated command catalog. Merge readinessKeep open for explicit maintainer acceptance of the new public Plugin SDK contract. The refactor removes duplicated Discord/Slack merge policy at the appropriate shared seam and fixes Discord voice-command planning; no blocking correctness or security defect was found. Priority: P2 Review scores
Verification
How this fits togetherCore command definitions are converted into channel-native command catalogs, then Discord and Slack register those catalogs with their transports. The shared merger decides which built-in or plugin command wins before either channel exposes commands to users. flowchart LR
A[Core command definitions] --> B[Native command catalog]
B --> C[Shared merge policy]
C --> D[Discord command deployment]
C --> E[Slack slash registration]
D --> F[Channel users]
E --> F[Channel users]
Decision needed
Why: The implementation is additive and appropriate for two bundled plugins, but exporting it makes its merge semantics a third-party compatibility commitment. Before merge
Agent review detailsSecurityNone. PR surfaceSource +40, Tests +462, Generated 0, Other +2. Total +504 across 14 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Accept the generic SDK merger as the canonical cross-plugin policy, retain the focused regression coverage, and land only after the current-main merge result is validated. Do we have a high-confidence way to reproduce the issue? Yes—current-main source shows Discord plans plugin commands before the interaction layer appends the voice command, so the planned catalog can differ from the deployed command set; the branch adds focused coverage for that path. Is this the best way to solve the issue? Yes—the shared SDK helper is the best fix because both bundled plugins need identical policy and cannot import core internals; the remaining question is whether to make that generic helper public. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4b4be7448edd. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
0be272e to
d8a06d4
Compare
|
@clawsweeper re-review Current-main refresh is complete at exact head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Land-ready verification is complete for exact head
Known proof gap: no live Discord or Slack roundtrip was run. Focused transport-owner tests, build proof, and exact-head hosted CI cover the changed registration surfaces. |
|
Merged via squash.
|
What Problem This Solves
Discord and Slack each carried their own native/plugin command merge policy. The duplicate implementations had already drifted: Discord appended
/vcafter collision and cap planning, while Slack used a separate normalization/deduplication loop. That made it easy for sibling channels to disagree about primary precedence, blank names, normalized duplicates, and collision diagnostics.Why This Change Was Made
This refactor introduces one narrow
mergeNativeCommandSpecsowner on the existingnative-command-registryPlugin SDK subpath. The helper performs stable trimmed/lowercase deduplication: primary entries win, blank or duplicate primary entries are ignored, secondary entries append in source order, and only rejected secondary entries invoke the optional collision callback.Discord now includes its canonical
/vcdescriptor in the primary catalog before plugin collision checks, the 100-command cap, and diagnostics. The interaction layer replaces that planned descriptor with the specialized voice handler in place instead of appending a second command after planning. Slack adopts the same merger while retaining its existing silent collision behavior, command registration, dispatch, and deferred reply handling.The public seam is accepted deliberately. Bundled Discord and Slack plugins cannot import core internals, and the pure catalog policy is shared behavior rather than channel-specific runtime state. The change adds one public function on an existing SDK subpath; it adds no subpath, execution handle, plugin identity, winner metadata, configuration, or migration surface.
Task #27's selected plugin execution identity/rematching seam remains explicitly out of scope.
User Impact
Native plugin commands now use the same primary-first merge semantics across Discord and Slack. Discord
/vcparticipates in the authoritative catalog limit and collision plan, so the registered interaction set cannot silently exceed or disagree with the catalog that was validated. Existing Slack behavior remains unchanged apart from using the shared policy owner.No operator action, configuration change, migration, or new default is required.
Evidence
d8a06d4f0a7b1a1d9b0f6c5e22a6fde440c56375on current base87ba8ef82b4d4db450f4ee967b6d72fba37ae048.docs/.generated/plugin-sdk-api-baseline.sha256; it was regenerated withpnpm plugin-sdk:api:genrather than hand-merged.pnpm plugin-sdk:api:checkpnpm plugin-sdk:surface:checktbx_01kzm3n9nt8pfrks99mxv8ptg1, run https://github.com/openclaw/openclaw/actions/runs/31334541340, passed the focused suites, Plugin SDK API/export/surface checks, andpnpm build.ui/package.jsonnoVNC range pin. This branch has no UI or dependency delta.git diff --checkpassed.No live Discord/Slack roundtrip was run; focused transport-owner tests, build proof, and hosted exact-head CI cover the changed registration surfaces. No changelog edit is included because changelog generation is release-owned.