bug: maintenance mode interaction_check is never registered (no-op) #82

Closed
opened 2026-03-17 17:21:12 +00:00 by cal · 1 comment
Owner

Problem

setup_hook in bot.py uses @self.tree.interaction_check as a decorator, but CommandTree.interaction_check is an async method meant to be overridden via subclassing, not a decorator factory. The result:

  • Python calls the coroutine with the decorated function as its argument
  • Produces an unawaited coroutine (the RuntimeWarning in logs)
  • The maintenance check is never registered — maintenance mode is a complete no-op
RuntimeWarning: coroutine 'CommandTree.interaction_check' was never awaited

Impact

/admin-maintenance appears to toggle maintenance mode but no commands are actually blocked for non-admin users.

Fix

  1. Create a MaintenanceAwareTree(discord.app_commands.CommandTree) subclass that overrides interaction_check
  2. Pass tree_cls=MaintenanceAwareTree to Bot.__init__
  3. Remove the @self.tree.interaction_check block from setup_hook

Introduced in commit e3610e8.

## Problem `setup_hook` in `bot.py` uses `@self.tree.interaction_check` as a decorator, but `CommandTree.interaction_check` is an async method meant to be **overridden via subclassing**, not a decorator factory. The result: - Python calls the coroutine with the decorated function as its argument - Produces an unawaited coroutine (the RuntimeWarning in logs) - The maintenance check is **never registered** — maintenance mode is a complete no-op ``` RuntimeWarning: coroutine 'CommandTree.interaction_check' was never awaited ``` ## Impact `/admin-maintenance` appears to toggle maintenance mode but no commands are actually blocked for non-admin users. ## Fix 1. Create a `MaintenanceAwareTree(discord.app_commands.CommandTree)` subclass that overrides `interaction_check` 2. Pass `tree_cls=MaintenanceAwareTree` to `Bot.__init__` 3. Remove the `@self.tree.interaction_check` block from `setup_hook` Introduced in commit `e3610e8`.
Claude added the
ai-working
status/in-progress
labels 2026-03-17 17:30:54 +00:00
Claude removed the
status/in-progress
label 2026-03-17 17:32:03 +00:00
Collaborator

Fixed in PR #84.

Approach: Added MaintenanceAwareTree(discord.app_commands.CommandTree) that overrides interaction_check with the maintenance check logic. Passed tree_cls=MaintenanceAwareTree to SBABot.__init__ and removed the broken @self.tree.interaction_check decorator block from setup_hook. 945 tests passing.

Fixed in PR #84. **Approach:** Added `MaintenanceAwareTree(discord.app_commands.CommandTree)` that overrides `interaction_check` with the maintenance check logic. Passed `tree_cls=MaintenanceAwareTree` to `SBABot.__init__` and removed the broken `@self.tree.interaction_check` decorator block from `setup_hook`. 945 tests passing.
Claude added
status/pr-open
ai-pr-opened
and removed
ai-working
labels 2026-03-17 17:32:20 +00:00
cal closed this issue 2026-03-17 17:34:17 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/major-domo-v2#82
No description provided.