Skip to content

fix(discord): return native status replies directly - #66434

Merged
vincentkoc merged 1 commit into
mainfrom
kitsune/pr-57343-carry
Apr 14, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
kitsune/pr-57343-carry

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Summary

  • fix native Discord /status so it returns the real status card instead of falling through to the synthetic ✅ Done. ack
  • add a narrow lazy openclaw/plugin-sdk/command-status-runtime seam instead of widening command-auth with status-runtime logic
  • update the Discord native-command tests to lock the new direct /status path while keeping non-status native command dispatch behavior unchanged
  • supersedes fix(discord): return native /status reply directly #57343 with a smaller maintainer carry that rebases cleanly on current main

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • 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

Root Cause / Regression History (if applicable)

  • Root cause: the native Discord /status slash path delegated to the generic reply dispatcher, and that path can legitimately emit zero visible replies for deterministic status commands, which then triggers the synthetic ✅ Done. fallback instead of a status payload.
  • Missing detection / guardrail: we did not have a Discord-native regression test asserting that /status bypasses the generic dispatcher and still returns a deliverable reply.
  • Prior context (git blame, prior PR, issue, or refactor if known): fix(discord): return native /status reply directly #57343 identified the right symptom and general direction, but it widened src/plugin-sdk/command-auth.ts with runtime-heavy status logic and no longer rebased cleanly on current main.
  • Why this regressed now: native slash handling diverged from the text-command /status path and started relying on a generic delivery flow that is not guaranteed to materialize a visible reply for this command class.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: extensions/discord/src/monitor/native-command.status-direct.test.ts
  • Scenario the test should lock in: native Discord /status resolves the routed session and sends the status payload directly without touching the generic dispatcher.
  • Why this is the smallest reliable guardrail: the bug is isolated to the native Discord interaction handler and the direct-vs-dispatch routing decision.

User-visible / Behavior Changes

  • Native Discord /status once again returns the status card instead of replying with ✅ Done..

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No

Repro + Verification

Environment

  • OS: macOS 26.3.1 (arm64)
  • Runtime/container: Node 25.9.0
  • Integration/channel (if any): Discord native slash commands

Steps

  1. Configure OpenClaw with Discord native slash commands.
  2. Run /status from Discord.
  3. Observe the interaction reply.

Expected

  • /status returns the normal status card.

Actual

  • Before this fix, the interaction could complete with ✅ Done. and no status payload.

Evidence

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

Human Verification (required)

  • Verified scenarios: focused Discord native-command regression tests, Plugin SDK contract checks, Plugin SDK export check, API baseline regeneration, and full pnpm build.
  • Edge cases checked: configured ACP-bound /status routes still resolve the bound session through the direct path; unbound routed /status still targets the routed channel session.
  • What I did not verify: live Discord manual repro on this carry branch.

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.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No

Risks and Mitigations

  • Risk: the new direct status seam could become another broad runtime helper bucket if we keep piling command-specific behavior into it.
    • Mitigation: the new SDK surface is intentionally narrow (command-status-runtime) and lazy, and only carries the status-specific runtime resolution logic.

AI-assisted: yes. Testing level: targeted local verification plus pnpm build.

Local verification run:

  • OPENCLAW_LOCAL_CHECK=0 pnpm exec vitest run --config test/vitest/vitest.extension-channels.config.ts extensions/discord/src/monitor/native-command.status-direct.test.ts extensions/discord/src/monitor/native-command.plugin-dispatch.test.ts
  • OPENCLAW_LOCAL_CHECK=0 pnpm exec vitest run --config test/vitest/vitest.contracts.config.ts src/plugins/contracts/plugin-sdk-index.test.ts src/plugins/contracts/plugin-sdk-package-contract-guardrails.test.ts
  • node scripts/check-plugin-sdk-subpath-exports.mjs
  • pnpm plugin-sdk:api:gen
  • pnpm build

@vincentkoc vincentkoc self-assigned this Apr 14, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord scripts Repository scripts size: M maintainer Maintainer-authored PR labels Apr 14, 2026
@vincentkoc
vincentkoc force-pushed the kitsune/pr-57343-carry branch from eb3148e to 5855dfd Compare April 14, 2026 08:46
@vincentkoc
vincentkoc marked this pull request as ready for review April 14, 2026 08:49
@greptile-apps

greptile-apps Bot commented Apr 14, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes native Discord /status interactions falling through to the synthetic ✅ Done. fallback by adding a new lazy openclaw/plugin-sdk/command-status-runtime seam and wiring a direct status-reply path in native-command.ts that short-circuits before the generic dispatcher. All authorization checks remain upstream of the new branch, and the /status-specific routing is properly exercised by the new regression test file.

Confidence Score: 5/5

  • Safe to merge — the fix is narrow, well-tested, and the only finding is a pre-existing stale mock reference in a test file.
  • All remaining findings are P2 (style). The stale vi.mock("openclaw/plugin-sdk/reply-runtime") reference in native-command.plugin-dispatch.test.ts doesn't affect correctness since actual interception goes through the setDispatchReplyWithDispatcher seam; it's a cleanup opportunity. No logic, data-integrity, or security issues were found.
  • No files require special attention.

Comments Outside Diff (1)

  1. extensions/discord/src/monitor/native-command.plugin-dispatch.test.ts, line 375 (link)

    P2 Stale reply-runtime mock and type cast

    The vi.mock("openclaw/plugin-sdk/reply-runtime", ...) at the top of this file (and the type cast as typeof import("openclaw/plugin-sdk/reply-runtime").dispatchReplyWithDispatcher on line 375) reference reply-runtime, but native-command.ts imports dispatchReplyWithDispatcher from openclaw/plugin-sdk/reply-dispatch-runtime. The stale mock doesn't intercept anything in the production path — the real interception happens via discordNativeCommandTesting.setDispatchReplyWithDispatcher(). Since this file was modified in the PR, this would have been a good opportunity to align the reference (the new native-command.status-direct.test.ts correctly uses reply-dispatch-runtime).

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: extensions/discord/src/monitor/native-command.plugin-dispatch.test.ts
    Line: 375
    
    Comment:
    **Stale `reply-runtime` mock and type cast**
    
    The `vi.mock("openclaw/plugin-sdk/reply-runtime", ...)` at the top of this file (and the type cast `as typeof import("openclaw/plugin-sdk/reply-runtime").dispatchReplyWithDispatcher` on line 375) reference `reply-runtime`, but `native-command.ts` imports `dispatchReplyWithDispatcher` from `openclaw/plugin-sdk/reply-dispatch-runtime`. The stale mock doesn't intercept anything in the production path — the real interception happens via `discordNativeCommandTesting.setDispatchReplyWithDispatcher()`. Since this file was modified in the PR, this would have been a good opportunity to align the reference (the new `native-command.status-direct.test.ts` correctly uses `reply-dispatch-runtime`).
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/discord/src/monitor/native-command.plugin-dispatch.test.ts
Line: 375

Comment:
**Stale `reply-runtime` mock and type cast**

The `vi.mock("openclaw/plugin-sdk/reply-runtime", ...)` at the top of this file (and the type cast `as typeof import("openclaw/plugin-sdk/reply-runtime").dispatchReplyWithDispatcher` on line 375) reference `reply-runtime`, but `native-command.ts` imports `dispatchReplyWithDispatcher` from `openclaw/plugin-sdk/reply-dispatch-runtime`. The stale mock doesn't intercept anything in the production path — the real interception happens via `discordNativeCommandTesting.setDispatchReplyWithDispatcher()`. Since this file was modified in the PR, this would have been a good opportunity to align the reference (the new `native-command.status-direct.test.ts` correctly uses `reply-dispatch-runtime`).

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

Reviews (1): Last reviewed commit: "fix(discord): return native status repli..." | Re-trigger Greptile

@vincentkoc
vincentkoc merged commit 381a8e8 into main Apr 14, 2026
60 of 63 checks passed
@vincentkoc
vincentkoc deleted the kitsune/pr-57343-carry branch April 14, 2026 08:55

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5855dfd915

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +113 to +114
provider: selectedProvider,
model: selectedModel,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use resolved model selection in direct status replies

resolveDirectStatusReplyForSession computes modelState but then calls buildStatusReply with the pre-normalized selectedProvider/selectedModel instead of modelState.provider/modelState.model. When a session has an invalid persisted override (for example, after allowlist changes), createModelSelectionState can reset the override to defaults, but this path still renders /status with the stale model values, so the status card can report a model that is no longer actually selected.

Useful? React with 👍 / 👎.

kvnkho pushed a commit to kvnkho/openclaw that referenced this pull request Apr 17, 2026
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
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 scripts Repository scripts size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Status slash command not displaying data

1 participant