Skip to content

fix(discord): register /approve and /deny slash commands, wire up button-based approval UI#4800

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-36a59267
Apr 3, 2026
Merged

fix(discord): register /approve and /deny slash commands, wire up button-based approval UI#4800
teknium1 merged 1 commit into
mainfrom
hermes/hermes-36a59267

Conversation

@teknium1

@teknium1 teknium1 commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes Discord exec approval UX — reported by Tom in the community Discord. Two issues:

Problem 1: /approve not in Discord's slash command picker

/approve and /deny were in the command registry and handled by the gateway, but never registered as native Discord slash commands in _register_slash_commands(). Users saw "no commands found" when typing /approve — they could still send it as text, but didn't know that.

Fix: Register both as native Discord slash commands with optional scope parameters.

Problem 2: Button-based approval UI was dead code

Discord had a fully-built ExecApprovalView with interactive buttons (Allow Once / Always Allow / Deny) and a send_exec_approval() method — but neither was ever called. The gateway sent plain text telling users to type /approve.

Worse, even if the buttons were wired up, ExecApprovalView._resolve() never called resolve_gateway_approval() — clicking buttons wouldn't have unblocked the agent thread.

Fix:

  • ExecApprovalView now takes session_key and calls resolve_gateway_approval() when a button is clicked
  • Added "Allow Session" button for parity with /approve session
  • Gateway's _approval_notify_sync() detects adapters with send_exec_approval() and routes through the rich button UI
  • Graceful fallback to text-based prompt if button send fails
  • Uses getattr(type(adapter), ...) check to avoid MagicMock false positives in tests

Files changed

  • gateway/platforms/discord.py — slash commands + ExecApprovalView rewrite + send_exec_approval updates
  • gateway/run.py — approval notify callback routing
  • 4 test files — updated Discord mocks (added grey/purple to ButtonStyle/Color)

Test results

1949 passed, 3 pre-existing failures (Signal phone redaction), 17 skipped

…ton-based approval UI

Two fixes for Discord exec approval:

1. Register /approve and /deny as native Discord slash commands so they
   appear in Discord's command picker (autocomplete). Previously they
   were only handled as text commands, so users saw 'no commands found'
   when typing /approve.

2. Wire up the existing ExecApprovalView button UI (was dead code):
   - ExecApprovalView now calls resolve_gateway_approval() to actually
     unblock the waiting agent thread when a button is clicked
   - Gateway's _approval_notify_sync() detects adapters with
     send_exec_approval() and routes through the button UI
   - Added 'Allow Session' button for parity with /approve session
   - send_exec_approval() now accepts session_key and metadata for
     thread support
   - Graceful fallback to text-based /approve prompt if button send fails

Also updates test mocks to include grey/secondary ButtonStyle and
purple Color (used by new button styles).
@teknium1 teknium1 merged commit aecbf7f into main Apr 3, 2026
3 of 4 checks passed
jooray added a commit to jooray/hermes-agent that referenced this pull request Apr 3, 2026
* upstream/main: (38 commits)
  fix(memory): Fix ByteRover plugin - run brv query synchronously before LLM call
  chore: release v0.7.0 (2026.4.3) (NousResearch#4812)
  fix: route memory provider tools in sequential execution path (NousResearch#4803)
  fix: persist API server sessions to shared SessionDB (state.db) (NousResearch#4802)
  fix(discord): register /approve and /deny slash commands, wire up button-based approval UI (NousResearch#4800)
  fix: respect per-platform disabled skills in Telegram menu and gateway dispatch (NousResearch#4799)
  fix(gateway): route /approve and /deny through running-agent guard (NousResearch#4798)
  docs: add community FAQ entries — multi-model workflows, WhatsApp binding, verbose control, skills config, thread sessions, migration, install troubleshooting (NousResearch#4797)
  fix: handle None mcp_servers in _get_platform_tools()
  fix(mcp): stability fix pack — reload timeout, shutdown cleanup, event loop handler, OAuth non-blocking (NousResearch#4757)
  fix: prevent compression death spiral from API disconnects (NousResearch#2153) (NousResearch#4750)
  fix: handle Anthropic Sonnet long-context tier 429 by reducing to 200k (NousResearch#4747)
  fix: correct qwen3.6-plus model slug
  fix: handle Anthropic long-context tier 429 by reducing to 200k
  docs(acp): fix zed config
  fix: use get_hermes_home(), consolidate git_cmd, update tests
  Add fork detection and upstream sync to hermes update
  fix(update): handle conflicted git index during hermes update (NousResearch#4735)
  fix: remove redundant restart message from update launchd path
  fix(update): avoid launchd restart race on macOS
  ...
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…ton-based approval UI (NousResearch#4800)

Two fixes for Discord exec approval:

1. Register /approve and /deny as native Discord slash commands so they
   appear in Discord's command picker (autocomplete). Previously they
   were only handled as text commands, so users saw 'no commands found'
   when typing /approve.

2. Wire up the existing ExecApprovalView button UI (was dead code):
   - ExecApprovalView now calls resolve_gateway_approval() to actually
     unblock the waiting agent thread when a button is clicked
   - Gateway's _approval_notify_sync() detects adapters with
     send_exec_approval() and routes through the button UI
   - Added 'Allow Session' button for parity with /approve session
   - send_exec_approval() now accepts session_key and metadata for
     thread support
   - Graceful fallback to text-based /approve prompt if button send fails

Also updates test mocks to include grey/secondary ButtonStyle and
purple Color (used by new button styles).
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…ton-based approval UI (NousResearch#4800)

Two fixes for Discord exec approval:

1. Register /approve and /deny as native Discord slash commands so they
   appear in Discord's command picker (autocomplete). Previously they
   were only handled as text commands, so users saw 'no commands found'
   when typing /approve.

2. Wire up the existing ExecApprovalView button UI (was dead code):
   - ExecApprovalView now calls resolve_gateway_approval() to actually
     unblock the waiting agent thread when a button is clicked
   - Gateway's _approval_notify_sync() detects adapters with
     send_exec_approval() and routes through the button UI
   - Added 'Allow Session' button for parity with /approve session
   - send_exec_approval() now accepts session_key and metadata for
     thread support
   - Graceful fallback to text-based /approve prompt if button send fails

Also updates test mocks to include grey/secondary ButtonStyle and
purple Color (used by new button styles).
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…ton-based approval UI (NousResearch#4800)

Two fixes for Discord exec approval:

1. Register /approve and /deny as native Discord slash commands so they
   appear in Discord's command picker (autocomplete). Previously they
   were only handled as text commands, so users saw 'no commands found'
   when typing /approve.

2. Wire up the existing ExecApprovalView button UI (was dead code):
   - ExecApprovalView now calls resolve_gateway_approval() to actually
     unblock the waiting agent thread when a button is clicked
   - Gateway's _approval_notify_sync() detects adapters with
     send_exec_approval() and routes through the button UI
   - Added 'Allow Session' button for parity with /approve session
   - send_exec_approval() now accepts session_key and metadata for
     thread support
   - Graceful fallback to text-based /approve prompt if button send fails

Also updates test mocks to include grey/secondary ButtonStyle and
purple Color (used by new button styles).
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…ton-based approval UI (NousResearch#4800)

Two fixes for Discord exec approval:

1. Register /approve and /deny as native Discord slash commands so they
   appear in Discord's command picker (autocomplete). Previously they
   were only handled as text commands, so users saw 'no commands found'
   when typing /approve.

2. Wire up the existing ExecApprovalView button UI (was dead code):
   - ExecApprovalView now calls resolve_gateway_approval() to actually
     unblock the waiting agent thread when a button is clicked
   - Gateway's _approval_notify_sync() detects adapters with
     send_exec_approval() and routes through the button UI
   - Added 'Allow Session' button for parity with /approve session
   - send_exec_approval() now accepts session_key and metadata for
     thread support
   - Graceful fallback to text-based /approve prompt if button send fails

Also updates test mocks to include grey/secondary ButtonStyle and
purple Color (used by new button styles).
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…ton-based approval UI (NousResearch#4800)

Two fixes for Discord exec approval:

1. Register /approve and /deny as native Discord slash commands so they
   appear in Discord's command picker (autocomplete). Previously they
   were only handled as text commands, so users saw 'no commands found'
   when typing /approve.

2. Wire up the existing ExecApprovalView button UI (was dead code):
   - ExecApprovalView now calls resolve_gateway_approval() to actually
     unblock the waiting agent thread when a button is clicked
   - Gateway's _approval_notify_sync() detects adapters with
     send_exec_approval() and routes through the button UI
   - Added 'Allow Session' button for parity with /approve session
   - send_exec_approval() now accepts session_key and metadata for
     thread support
   - Graceful fallback to text-based /approve prompt if button send fails

Also updates test mocks to include grey/secondary ButtonStyle and
purple Color (used by new button styles).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant