The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(discord): avoid duplicate exec approval details
KoNit-K5e0a1852f505
diff --git a/plugins/platforms/discord/adapter.py b/plugins/platforms/discord/adapter.pyindex 36cb224533f..4f26f79a23d 100644--- a/plugins/platforms/discord/adapter.py+++ b/plugins/platforms/discord/adapter.py@@ -5404,7 +5404,6 @@ class DiscordAdapter(DiscordMediaMixin, BasePlatformAdapter):_EA_CODE_CLOSE = "\n```\n"_EA_REASON_LABEL = f"**{EA_REASON_LABEL_TEXT}:** "_EA_SMART_DENY_LINE = "\n\n**Smart DENY:** owner override applies to this one operation only."- _EA_REASON_BUDGET = 300def _exec_approval_cmd_budget(self, description: str, smart_denied: bool) -> int:# Mentions ride in front of the content and count against the 2000-char message cap too.@@ -5415,7 +5414,7 @@ class DiscordAdapter(DiscordMediaMixin, BasePlatformAdapter):return max(0, self.MAX_MESSAGE_LENGTH - fixed)async def _send_exec_approval_prompt(self, prompt: ExecApprovalPrompt) -> SendResult:- """Button view + embed mirror; buttons call ``resolve_gateway_approval()`` (not /approve)."""+ """Send an approval with content as its canonical payload and an embed for state."""def _build(_channel):content = prompt.textmention_content = self._approval_mention_content()@@ -5423,10 +5422,8 @@ class DiscordAdapter(DiscordMediaMixin, BasePlatformAdapter):content = f"{mention_content}\n{content}"embed = discord.Embed(title=f"⚠️ {EA_HEADER_TEXT}",- description=f"```\n{self._embed_body(prompt.command)}\n```",color=discord.Color.orange(),)- embed.add_field(name=EA_REASON_LABEL_TEXT, value=self._truncate_preview(prompt.description, self._EA_REASON_BUDGET), inline=False)require_admin, admin_user_ids = _resolve_exec_approval_admin_gate(getattr(self.config, "extra", None))choices = set(prompt.choices)view = ExecApprovalView(diff --git a/tests/gateway/test_discord_exec_approval_content.py b/tests/gateway/test_discord_exec_approval_content.pyindex 9d2f3a97925..65918b5a2de 100644--- a/tests/gateway/test_discord_exec_approval_content.py+++ b/tests/gateway/test_discord_exec_approval_content.py@@ -48,4 +48,11 @@ async def test_exec_approval_prompt_uses_visible_content_with_command_and_reasonassert "script execution via -c flag" in prompt_textassert "it will NOT run" in prompt_text+ # Content is the canonical, accessible approval payload. The embed retains+ # its visual state but must not repeat either user-facing value.+ embed = sent["embed"]+ assert command not in (embed.description or "")+ assert "script execution via -c flag" not in (embed.description or "")+ assert all(command not in (field.value or "") for field in embed.fields)+ assert all("script execution via -c flag" not in (field.value or "") for field in embed.fields)