Repository navigation
Conversation
Greptile SummaryThis PR fixes a regression where the native Discord Key changes:
One minor style note: the guard condition at line 1021 re-evaluates Confidence Score: 5/5Safe 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.
|
| 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
| 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; | ||
| } |
There was a problem hiding this 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:
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.| await deliverDiscordInteractionReply({ | ||
| interaction, | ||
| payload: statusReply, | ||
| textLimit: resolveTextChunkLimit(cfg, "discord", accountId, { | ||
| fallbackLimit: 2000, | ||
| }), | ||
| maxLinesPerMessage: resolveDiscordMaxLinesPerMessage({ | ||
| cfg, | ||
| discordConfig, | ||
| accountId, | ||
| }), | ||
| preferFollowUp, | ||
| chunkMode: resolveChunkMode(cfg, "discord", accountId), | ||
| }); | ||
| return; |
There was a problem hiding this 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.
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: [], |
There was a problem hiding this 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.
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.There was a problem hiding this comment.
💡 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".
| 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, |
There was a problem hiding this comment.
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 👍 / 👎.
Co-authored-by: Tyler <[email protected]>
ede5af5 to
8c36643
Compare
There was a problem hiding this comment.
💡 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"), |
There was a problem hiding this comment.
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 👍 / 👎.
Co-authored-by: Tyler <[email protected]>
There was a problem hiding this comment.
💡 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".
| const selectedProvider = | ||
| statusEntry?.providerOverride?.trim() || | ||
| statusEntry?.modelProvider?.trim() || | ||
| statusModel.provider; |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 👍 / 👎.
|
@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? |
There was a problem hiding this comment.
💡 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".
| statusEntry?.providerOverride?.trim() || | ||
| statusEntry?.modelProvider?.trim() || | ||
| statusModel.provider; | ||
| const selectedModel = | ||
| statusEntry?.modelOverride?.trim() || statusEntry?.model?.trim() || statusModel.model; |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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]>
bab5ebe to
e1a8ce3
Compare
There was a problem hiding this comment.
💡 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".
| provider: selectedProvider, | ||
| model: selectedModel, |
There was a problem hiding this comment.
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 👍 / 👎.
|
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.
So overall: this PR is directionally correct and addresses the main |
|
thanks for the fix direction here. closing this as superseded by #66434. the carry keeps the credit is preserved in the new changelog entry and linked issue path. |
Summary
Describe the problem and fix in 2–5 bullets:
/statusslash commands could complete with the synthetic✅ Done.acknowledgment instead of the actual status card./statusnow 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./statuscommands.Change Type (select all)
Scope (select all touched areas)
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, writeUnknown./statuspath delegated to the generic reply dispatcher, and in this interaction flow that dispatcher could return zero visible replies (didReply=false,queuedFinal=false, all counts0), so the synthetic fallback acknowledgment rendered instead of the status card./statusreturns a status payload even when the generic dispatcher would otherwise produce no replies.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./statuspath diverged, and the native interaction route relied on a generic dispatch path that does not always emit a deliverable reply for this command.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.extensions/discord/src/monitor/native-command.status-direct.test.ts/statusreturns a direct status reply and does not fall through to the generic dispatcher/empty fallback path.User-visible / Behavior Changes
/statusslash commands render the status card again instead of returning✅ Done..Diagram (if applicable)
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation:Repro + Verification
Environment
openai-codex/gpt-5.4Steps
/statusfrom Discord.Expected
/statusreturns the normal status card (model, usage, session, runtime state).Actual
✅ Done.and no status payload.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
/statusbehavior on a live local Discord/OpenClaw setup, applied the fix, rebuilt, and verified/statusreturned the status card from the live Discord bot./statusslash commands, guild-thread-specific status behavior, and upstream CI lanes beyond the focused build/test work below.Review Conversations
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
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None./statusnow bypasses the generic dispatcher path, so it could diverge from future shared command behavior./statusonly, uses the existingbuildStatusReplyimplementation, 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.tspnpm buildpnpm lint:extensions:no-relative-outside-packagestill reports unrelated pre-existing Feishu/Zalo violations onmain; this patch does not introduce new violations.