Skip to content

fix(discord): return native /status reply directly - #57343

Closed
tkozzer wants to merge 4 commits into
openclaw:mainfrom
dewgie-bot:fix/discord-native-status-direct-reply
Closed

tkozzer wants to merge 4 commits into
openclaw:mainfrom
dewgie-bot:fix/discord-native-status-direct-reply

Conversation

@tkozzer

@tkozzer tkozzer commented Mar 29, 2026

Copy link
Copy Markdown

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: native Discord /status slash commands could complete with the synthetic ✅ Done. acknowledgment instead of the actual status card.
  • Why it matters: operators lose a primary health/debugging command in Discord even though the bot is connected and the interaction is authorized.
  • What changed: Discord native /status now resolves the target session and builds/sends the status payload directly through the interaction reply path instead of relying on the generic dispatcher path that can return zero replies here.
  • What did NOT change (scope boundary): this does not change the behavior of other Discord slash commands or the generic empty-reply fallback for non-/status commands.

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)

For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write N/A. If the cause is unclear, write Unknown.

  • Root cause: the native Discord /status path delegated to the generic reply dispatcher, and in this interaction flow that dispatcher could return zero visible replies (didReply=false, queuedFinal=false, all counts 0), so the synthetic fallback acknowledgment rendered instead of the status card.
  • Missing detection / guardrail: there was no Discord-native regression test asserting that /status returns a status payload even when the generic dispatcher would otherwise produce no replies.
  • Prior context (git blame, prior PR, issue, or refactor if known): issue reports [Bug]: Status slash command not displaying data #54629 and /status slash command shows 'Done' without status card after 3.13→3.22 upgrade #53189 describe the /status-specific symptom; the broader Discord native slash regressions after the Carbon reconcile migration are tracked in Discord native slash commands return empty 'Done' after Carbon reconcile migration (v2026.3.22+) #53416.
  • Why this regressed now: the native slash-command path and the text-command /status path diverged, and the native interaction route relied on a generic dispatch path that does not always emit a deliverable reply for this command.
  • If unknown, what was ruled out: ruled out Discord token/auth problems, command allowlist formatting, command registration, and the native interaction fallback itself as primary causes.

Regression Test Plan (if applicable)

For bug fixes or regressions, name the smallest reliable test coverage that should have caught this. Otherwise write N/A.

  • 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 returns a direct status reply and does not fall through to the generic dispatcher/empty fallback path.
  • Why this is the smallest reliable guardrail: the regression is isolated to the Discord native-command interaction handler and can be reproduced deterministically by stubbing the dispatcher to return zero replies.
  • Existing test that already covers this (if any): none found.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

  • Native Discord /status slash commands render the status card again instead of returning ✅ Done..

Diagram (if applicable)

Before:
[user runs /status in Discord] -> [native interaction handler] -> [generic dispatcher emits no reply] -> [synthetic "✅ Done."]

After:
[user runs /status in Discord] -> [native interaction handler] -> [resolve target session] -> [buildStatusReply] -> [Discord interaction reply with status card]

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
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: macOS 26.3.1 (arm64)
  • Runtime/container: Node 24.14.1, launchd-managed local gateway
  • Model/provider: openai-codex/gpt-5.4
  • Integration/channel (if any): Discord native slash commands
  • Relevant config (redacted): Discord bot enabled; native slash commands enabled; command allowlist configured for the invoking user

Steps

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

Expected

  • /status returns the normal status card (model, usage, session, runtime state).

Actual

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

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: reproduced the failing Discord /status behavior on a live local Discord/OpenClaw setup, applied the fix, rebuilt, and verified /status returned the status card from the live Discord bot.
  • Edge cases checked: verified the source patch through a targeted regression test and confirmed it no longer introduces new Discord extension boundary violations.
  • What you did not verify: broader non-/status slash commands, guild-thread-specific status behavior, and upstream CI lanes beyond the focused build/test work below.

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/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps:

Risks and Mitigations

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

  • Risk: Discord native /status now bypasses the generic dispatcher path, so it could diverge from future shared command behavior.
    • Mitigation: the bypass is intentionally scoped to /status only, uses the existing buildStatusReply implementation, and is locked by a targeted regression test.

AI-assisted: yes. Testing level: manually verified on a live local Discord/OpenClaw instance and covered with a focused regression test plus local pnpm build.

Local verification run:

  • pnpm exec vitest run --config vitest.config.ts extensions/discord/src/monitor/native-command.status-direct.test.ts
  • pnpm build
  • pnpm lint:extensions:no-relative-outside-package still reports unrelated pre-existing Feishu/Zalo violations on main; this patch does not introduce new violations.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: M labels Mar 29, 2026
@greptile-apps

greptile-apps Bot commented Mar 29, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a regression where the native Discord /status slash command would complete with the synthetic ✅ Done. acknowledgment instead of the actual status card. The fix short-circuits the generic dispatcher path for /status and instead resolves the target session, builds the status reply directly via a new resolveDirectStatusReplyForSession helper in command-auth.ts, and delivers it through the interaction reply path. A targeted regression test guards the fix.

Key changes:

  • native-command.ts: mediaLocalRoots declaration is moved before the new status block (so it is in scope and correctly forwarded to deliverDiscordInteractionReply); a commandName === \"status\" guard short-circuits to the direct status path; a respond(\"Status unavailable.\") fallback prevents the ✅ Done. symptom even for edge-case empty payloads.
  • command-auth.ts: New exported resolveDirectStatusReplyForSession function that mirrors the model/directive-level resolution pipeline and delegates to buildStatusReply; CommandContext type re-exported so the Discord extension can construct it without deep internal imports.
  • native-command.status-direct.test.ts: New regression test that stubs the dispatcher to return zero replies and asserts the status card is still delivered via the direct path.

One minor style note: the guard condition at line 1021 re-evaluates command.nativeName ?? command.key inline rather than reusing the commandName variable already computed at line 987.

Confidence Score: 5/5

Safe to merge — the fix is correctly scoped to /status, previous review concerns (mediaLocalRoots forwarding, Status unavailable fallback) are addressed, and a regression test locks in the behavior.

All remaining findings are P2 or lower. The one flagged item is a minor style nit (reusing commandName vs. repeating the expression). The fix correctly addresses the root cause.

No files require special attention.

Important Files Changed

Filename Overview
extensions/discord/src/monitor/native-command.ts Adds a direct /status reply path before the generic dispatcher: moves mediaLocalRoots declaration earlier, short-circuits when commandName === "status" to call resolveDirectStatusReplyForSession and deliver the payload directly. Falls through to respond("Status unavailable.") if the payload is empty/non-renderable.
src/plugin-sdk/command-auth.ts Exports a new resolveDirectStatusReplyForSession helper that replicates the model/directive-level resolution pipeline and delegates to buildStatusReply. Also re-exports the CommandContext type.
extensions/discord/src/monitor/native-command.status-direct.test.ts New regression test for the /status direct-reply path. Stubs the dispatcher to return zero replies and asserts the status card is still delivered via the direct path.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/discord/src/monitor/native-command.ts
Line: 1021

Comment:
**Reuse the already-computed `commandName`**

`commandName` is computed at line 987 as `command.nativeName ?? command.key`, yet the status check at line 1021 re-evaluates the same expression inline. Using the existing variable is more consistent with the rest of the function (e.g. line 987 is already used in the `resolveDiscordNativeInteractionRouteState` call) and avoids any future drift if the expression ever changes.

```suggestion
  if (!suppressReplies && commandName === "status") {
```

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

Reviews (2): Last reviewed commit: "fix(discord): address native /status rev..." | Re-trigger Greptile

Comment on lines +1047 to +1063
if (statusReply && hasRenderableReplyPayload(statusReply)) {
await deliverDiscordInteractionReply({
interaction,
payload: statusReply,
textLimit: resolveTextChunkLimit(cfg, "discord", accountId, {
fallbackLimit: 2000,
}),
maxLinesPerMessage: resolveDiscordMaxLinesPerMessage({
cfg,
discordConfig,
accountId,
}),
preferFollowUp,
chunkMode: resolveChunkMode(cfg, "discord", accountId),
});
return;
}

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 Silent fallthrough when status reply isn't renderable

If buildStatusReply returns a ReplyPayload that fails hasRenderableReplyPayload (e.g. an empty/minimal payload from an edge-case session state), the code falls through to the generic dispatcher path, which the PR description identifies as exactly the path that can produce zero deliverable replies and the ✅ Done. acknowledgment. In other words, the original symptom would silently resurface for that edge case.

Since /status is a dedicated health-debugging command, consider sending a minimal text fallback in the else branch rather than falling through:

if (statusReply && hasRenderableReplyPayload(statusReply)) {
  await deliverDiscordInteractionReply({ ... });
  return;
} else {
  // status reply was empty – still prevent the generic "✅ Done." fallback
  await respond("Status unavailable.");
  return;
}

This is an edge case (normal sessions always yield a renderable status card), but the guard makes the fix fully complete against the original bug.

Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/discord/src/monitor/native-command.ts
Line: 1047-1063

Comment:
**Silent fallthrough when status reply isn't renderable**

If `buildStatusReply` returns a `ReplyPayload` that fails `hasRenderableReplyPayload` (e.g. an empty/minimal payload from an edge-case session state), the code falls through to the generic dispatcher path, which the PR description identifies as exactly the path that can produce zero deliverable replies and the `✅ Done.` acknowledgment. In other words, the original symptom would silently resurface for that edge case.

Since `/status` is a dedicated health-debugging command, consider sending a minimal text fallback in the `else` branch rather than falling through:

```typescript
if (statusReply && hasRenderableReplyPayload(statusReply)) {
  await deliverDiscordInteractionReply({ ... });
  return;
} else {
  // status reply was empty – still prevent the generic "✅ Done." fallback
  await respond("Status unavailable.");
  return;
}
```

This is an edge case (normal sessions always yield a renderable status card), but the guard makes the fix fully complete against the original bug.

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

Comment on lines +1048 to +1062
await deliverDiscordInteractionReply({
interaction,
payload: statusReply,
textLimit: resolveTextChunkLimit(cfg, "discord", accountId, {
fallbackLimit: 2000,
}),
maxLinesPerMessage: resolveDiscordMaxLinesPerMessage({
cfg,
discordConfig,
accountId,
}),
preferFollowUp,
chunkMode: resolveChunkMode(cfg, "discord", accountId),
});
return;

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 mediaLocalRoots not forwarded to status reply delivery

The generic dispatcher path at line ~1114 passes mediaLocalRoots to deliverDiscordInteractionReply, but the new status-reply call here does not. The variable is declared after this block (line 1098), so it isn't in scope, which is the root cause.

For /status replies (plain text/embeds, no attachments) this makes no practical difference today. If status replies ever start including local-file references, they would silently fail to resolve. Consider moving the getAgentScopedMediaLocalRoots call to before the status block, or at least leaving a comment noting the omission is intentional.

Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/discord/src/monitor/native-command.ts
Line: 1048-1062

Comment:
**`mediaLocalRoots` not forwarded to status reply delivery**

The generic dispatcher path at line ~1114 passes `mediaLocalRoots` to `deliverDiscordInteractionReply`, but the new status-reply call here does not. The variable is declared after this block (line 1098), so it isn't in scope, which is the root cause.

For `/status` replies (plain text/embeds, no attachments) this makes no practical difference today. If status replies ever start including local-file references, they would silently fail to resolve. Consider moving the `getAgentScopedMediaLocalRoots` call to before the status block, or at least leaving a comment noting the omission is intentional.

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

surface: "discord",
channel: "discord",
channelId,
ownerList: [],

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 ownerList hardcoded to empty array

The other CommandContext objects in this file (e.g. the plugin-command path at line ~934) have ownerList populated from the resolved channel/guild access config. Hardcoding [] here is fine since buildStatusReply does not appear to use ownerList today, but if that changes the status command would silently compute with an incorrect owner list. A defensive option is to derive this from the same place other paths do, or at minimum add a comment explaining the intentional empty value.

Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/discord/src/monitor/native-command.ts
Line: 1026

Comment:
**`ownerList` hardcoded to empty array**

The other `CommandContext` objects in this file (e.g. the plugin-command path at line ~934) have `ownerList` populated from the resolved channel/guild access config. Hardcoding `[]` here is fine since `buildStatusReply` does not appear to use `ownerList` today, but if that changes the status command would silently compute with an incorrect owner list. A defensive option is to derive this from the same place other paths do, or at minimum add a comment explaining the intentional empty value.

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

@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: ede5af5194

ℹ️ 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 thread src/plugin-sdk/command-auth.ts Outdated
Comment on lines +140 to +144
resolvedVerboseLevel: (statusEntry?.verboseLevel as VerboseLevel | undefined) ?? "off",
resolvedReasoningLevel: (statusEntry?.reasoningLevel as ReasoningLevel | undefined) ?? "off",
resolvedElevatedLevel: statusEntry?.elevatedLevel as ElevatedLevel | undefined,
resolveDefaultThinkingLevel: async () =>
resolveAgentConfig(statusCfg, statusAgentId)?.thinkingDefault,

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 Preserve resolved status defaults for native /status

The new direct /status path hard-codes resolvedVerboseLevel and resolvedReasoningLevel to "off" (and only sources thinking default from resolveAgentConfig), which bypasses the normal default resolution used by command handling (src/auto-reply/reply/get-reply-directives.ts:382-447). In sessions without explicit overrides, Discord native /status will now report options as off even when agent/model defaults enable them, so operators get incorrect runtime state in the status card.

Useful? React with 👍 / 👎.

@dewgie-bot
dewgie-bot force-pushed the fix/discord-native-status-direct-reply branch from ede5af5 to 8c36643 Compare March 29, 2026 23:58

@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: 8c36643f93

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

command: statusCommand,
sessionKey: statusTargetSessionKey,
isGroup: isGuild || isGroupDm,
defaultGroupActivation: () => (!isDirectMessage && !isGroupDm ? "mention" : "always"),

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 Derive status activation default from config

The new native /status fast path hard-codes defaultGroupActivation based only on DM vs guild (mention for guild, always otherwise), so when a group session has no explicit groupActivation, the status card no longer reflects channel/group policy from config (for example Discord groups configured as always-on). Previously this command went through the normal directive path that resolves require-mention from runtime config, so Discord operators can now see incorrect activation state in production even though routing behavior is unchanged.

Useful? React with 👍 / 👎.

@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: 2a8750a2a8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +129 to +132
const selectedProvider =
statusEntry?.providerOverride?.trim() ||
statusEntry?.modelProvider?.trim() ||
statusModel.provider;

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 Respect channel model overrides in direct /status path

This helper chooses provider/model only from session fields and agent defaults, then renders status from those values. In the normal command flow, channel/group model overrides are applied before /status is built, so Discord channels with configured model overrides will now report the wrong model in native /status (especially before any run has persisted runtime model fields). Please resolve channel override inputs here (or pass the caller’s already-resolved model selection) so status reflects actual runtime routing.

Useful? React with 👍 / 👎.

storePath: statusLoaded.storePath,
provider: selectedProvider,
model: selectedModel,
contextTokens: statusEntry?.contextTokens ?? 0,

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 Compute /status context window from active model defaults

The direct status path passes contextTokens from sessionEntry?.contextTokens ?? 0, which is often unset for fresh sessions or after model changes. That makes native /status show a zero/unknown context limit even when the active model has a valid configured window. The previous dispatcher path computed context tokens from config + resolved model before building status, so this should derive context tokens dynamically instead of relying on the session cache fallback.

Useful? React with 👍 / 👎.

@dewgie-bot

Copy link
Copy Markdown

@greptile-apps @chatgpt-codex-connector I pushed follow-up changes addressing the review feedback on this PR. Could you both please take another look at the latest commit and re-review when you get a chance?

@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: bab5ebe270

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +130 to +134
statusEntry?.providerOverride?.trim() ||
statusEntry?.modelProvider?.trim() ||
statusModel.provider;
const selectedModel =
statusEntry?.modelOverride?.trim() || statusEntry?.model?.trim() || statusModel.model;

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 Apply channel model overrides before building direct /status

The direct /status helper picks provider/model only from session overrides and agent defaults, so a channel-level model override is ignored when the session has no explicit model fields yet. In that common “fresh session” case, native Discord /status can report a different model than the one routing actually uses. Fresh evidence in this commit is that resolveDirectStatusReplyForSession never calls channel override resolution, while the normal path still applies resolveChannelModelOverride in src/auto-reply/reply/get-reply.ts:259-287 before status handling.

Useful? React with 👍 / 👎.

})
? "mention"
: "always"
: "always",

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 Respect mention-default policy for Discord group DMs

The new native /status activation default forces non-guild conversations to "always", which makes Discord group DMs report always-on activation even when the platform default is mention-triggered. This diverges from the standard directive path, where Discord group mention policy is resolved via group-policy helpers and defaults to require-mention unless configured otherwise. Fresh evidence in this commit is the explicit non-guild fallback branch to "always".

Useful? React with 👍 / 👎.

Keep the native Discord /status fast path aligned with real requireMention behavior for guild channels, and rewrite the focused regression test to stay within plugin-sdk/extension boundaries.

- derive defaultGroupActivation from resolveDiscordGroupRequireMention instead of a guild-vs-DM shortcut
- keep the direct /status reply path scoped to the Discord native command handler
- update the /status regression test to mock only plugin-sdk seams
- add a guild/channel case proving requireMention:false maps to always activation

Co-authored-by: Tyler <[email protected]>
@dewgie-bot
dewgie-bot force-pushed the fix/discord-native-status-direct-reply branch from bab5ebe to e1a8ce3 Compare March 30, 2026 00:50

@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: 491c363437

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +180 to +181
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 modelState selection in direct /status

resolveDirectStatusReplyForSession computes modelState but then renders /status with selectedProvider/selectedModel instead of modelState.provider/modelState.model. This drops model resolution that createModelSelectionState applies (notably parent-session inherited overrides), so native Discord /status can show the default model even when the active session is inheriting a different override from its parent.

Useful? React with 👍 / 👎.

@Garyko0730

Copy link
Copy Markdown

I tested the Discord native-command fix direction locally on top of 2026.3.31 and wanted to share a few findings that may help tighten this up further.

  1. This PR fixes the core /status symptom, but the same failure mode also affects other native shortcut-style commands. In my local runtime, /commands was still falling through to the synthetic ✅ Done. path even after /status was handled specially. The underlying pattern seems broader than /status: native commands that should immediately materialize a reply can still end up on the generic dispatcher/empty-reply path.

  2. My first local patch was ineffective because I implemented the fallback too late in the interaction flow. I initially tried to recover only after the generic dispatcher had already returned zero visible replies. That was too fragile, and in one iteration I also pulled the wrong runtime helper into the fallback path, which caused a runtime exception instead of a reply. The version that finally worked was to move the direct-reply handling earlier into the native Discord command path itself, rather than treating it as a last-ditch empty-reply fallback.

  3. What finally worked locally: I extended the direct native-reply approach beyond /status to other native shortcut commands such as /commands (and the same pattern should likely apply to /help / /whoami). In practice, building the reply payload directly from the command handler and sending it through the interaction reply path was much more reliable than letting those commands go through the generic dispatcher and hoping a deliverable reply emerged.

  4. Separate remaining issue: Discord native /model picker confirmation path. This looks distinct from /new. After submitting a model change, the picker internally dispatches /model <provider/model> and then reads the current session model back too early, which can produce a false warning like Tried to set minimax/MiniMax-M2.7, but current model is minimax/MiniMax-M2.1. even though the model-change request itself was issued correctly.

So overall: this PR is directionally correct and addresses the main /status bug, but my local testing suggests the more general fix may be: for native Discord commands that are effectively deterministic info/status commands, prefer a direct interaction reply path instead of the generic dispatcher path.

@vincentkoc

Copy link
Copy Markdown
Member

thanks for the fix direction here.

closing this as superseded by #66434. the carry keeps the /status direct-reply behavior, rebases on current main, and narrows the runtime surface to a lazy command-status-runtime sdk seam instead of widening command-auth.

credit is preserved in the new changelog entry and linked issue path.

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

Labels

channel: discord Channel integration: discord size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Status slash command not displaying data

4 participants