claude-memory/graph/workflows/pr-review-major-domo-v262-maintenance-mode-flag-request-chan-729df2.md

2.5 KiB

id type title tags importance confidence created updated relations
729df25e-abb1-4b3a-afe5-1f2b5fb8cd50 workflow PR review: major-domo-v2#62 — maintenance mode flag (REQUEST_CHANGES)
pr-reviewer
major-domo-v2
discord
python
maintenance-mode
discord-py
bug
0.6 0.8 2026-03-03T18:04:48.164825+00:00 2026-03-03T18:04:48.550062+00:00
target type direction strength edge_id
4321bee8 RELATED_TO outgoing 0.77 42f305d7-6142-452a-be79-43f83c0e8ba0
target type direction strength edge_id
4321bee8-105e-4fc8-b645-964d1234c966 RELATED_TO outgoing 0.75 39adeb9c-0d2e-49f0-8aa6-c17012da8276
target type direction strength edge_id
8213f0ac-04b6-4555-b42c-da1d44fc2e24 RELATED_TO outgoing 0.75 3bfad476-35dc-4f04-baa2-b8a07c116c65

Review Summary

PR #62: fix: implement actual maintenance mode flag in /admin-maintenance (#28)
Verdict: REQUEST_CHANGES (could not post — Gitea blocks self-review)

Key Bug Found: Double ephemeral message on maintenance gate

When @self.tree.interaction_check returns False, discord.py dispatches CheckFailure to the registered @bot.tree.error handler (on_app_command_error). The existing handler does NOT handle CheckFailure, so it falls to the else branch, which:

  1. Logs the error as "Unhandled command error" (incorrect)
  2. Sends a second ephemeral followup: " An unexpected error occurred." since is_done() is True

Per discord.py docs: "If this function returns False, the invocation does not happen and the function's error handlers are called with a CheckFailure."

Fix Required

Add CheckFailure handling in bot.py on_app_command_error:

elif isinstance(error, discord.app_commands.CheckFailure):
    if not interaction.response.is_done():
        await interaction.response.send_message(
            "❌ You don't have permission to run this command.", ephemeral=True
        )

Files Reviewed

  • bot.py: Added self.maintenance_mode: bool = False in __init__, nested maintenance_check function registered via @self.tree.interaction_check in setup_hook
  • commands/admin/management.py: Added self.bot.maintenance_mode = is_enabling, logging; rest is Black formatter reformatting

Other Notes

  • self.bot.maintenance_mode is not type-safe (self.bot: commands.Bot doesn't declare the attribute) — minor
  • No tests added for the new blocking behavior
  • Core logic is correct; admins pass through in maintenance mode, non-Members also blocked in DMs