fix(exec): dedupe Discord approval delivery#58002
Conversation
Greptile SummaryThis PR fixes a duplicate approval-card delivery bug that surfaced under The fix is applied at two complementary levels:
Both regression test scenarios (the DM-session fallback in Key observations:
Confidence Score: 5/5
Prompt To Fix All With AIThis is a comment left during a code review.
Path: extensions/discord/src/approval-native.ts
Line: 1-2
Comment:
**Duplicate import from same module**
`createApproverRestrictedNativeApprovalAdapter` and `resolveExecApprovalSessionTarget` are both imported from `"openclaw/plugin-sdk/approval-runtime"` as two separate statements. They should be merged into one import to keep the file consistent and avoid redundant module references.
```suggestion
import { createApproverRestrictedNativeApprovalAdapter, resolveExecApprovalSessionTarget } from "openclaw/plugin-sdk/approval-runtime";
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(exec): dedupe Discord approval deliv..." | Re-trigger Greptile |
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* fix(exec): dedupe Discord approval delivery * Update extensions/discord/src/approval-native.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* fix(exec): dedupe Discord approval delivery * Update extensions/discord/src/approval-native.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* fix(exec): dedupe Discord approval delivery * Update extensions/discord/src/approval-native.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* fix(exec): dedupe Discord approval delivery * Update extensions/discord/src/approval-native.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* fix(exec): dedupe Discord approval delivery * Update extensions/discord/src/approval-native.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* fix(exec): dedupe Discord approval delivery * Update extensions/discord/src/approval-native.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* fix(exec): dedupe Discord approval delivery * Update extensions/discord/src/approval-native.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Summary
channels.discord.execApprovals.target="both"was enabled.discord:dm:*sessions.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause / Regression History (if applicable)
DiscordExecApprovalHandlerstill posted twice.discordChannelId, and thediscord:dm:*session-store fallback could still reintroduce an origin target.git blame, prior PR, issue, or refactor if known): this regressed in the shared channel approval unification from refactor(exec): unify channel approvals and restore routing/auth #57838, which moved Discord native approval delivery onto the shared planner/runtime.target="both"intentionally schedules origin + approver delivery, but Discord DM surfaces can converge after DM creation rather than at plan time.Regression Test Plan (if applicable)
extensions/discord/src/monitor/exec-approvals.test.tstarget="both", and only one card is posted.Routes.userChannels()into a DM channel id, so it needs the delivery seam rather than a pure planner unit test.extensions/discord/src/approval-native.test.tsnow also covers the narrowerdiscord:dm:*session-store fallback path.User-visible / Behavior Changes
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation:Repro + Verification
Environment
mainchannels.discord.execApprovals.enabled=true,channels.discord.execApprovals.target="both", single approver configuredSteps
mainwith Discord exec approvals enabled andtarget="both".Expected
Actual
Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
main, patched the clean smoke runtime, and confirmed the same Discord DM-origin approval flow produced only one card after the fix.discord:dm:*session-store fallback;pnpm buildpassed.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) NoFailure Recovery (if this breaks)
bothtodmorchannel.extensions/discord/src/monitor/exec-approvals.ts,extensions/discord/src/approval-native.tsdiscord:dm:*sessions.Risks and Mitigations