UAT: TUI /theme slash command catalogued but not handled — TuiCommandRouter returns "Unknown command: /theme" #5584

Open
opened 2026-04-09 07:40:31 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

Feature Area: TUI — Dracula Theme / Theme Switching (v3.7.0)
Severity: Medium — theme switching via slash command non-functional
Discovered by: UAT Testing (uat-pool-1, worker: tui-sidebar-layout)


What Was Tested

Code analysis of src/cleveragents/tui/commands.py and src/cleveragents/tui/slash_catalog.py against the TUI specification (§29858).


Expected Behavior (from spec §29858)

Default theme is Dracula. All 17+ Textual built-in themes are supported and switchable via /theme <name>.

The /theme slash command should:

  1. Accept a theme name argument (e.g., /theme monokai, /theme nord)
  2. Call self.app.theme = theme_name to switch the Textual theme at runtime
  3. Persist the theme preference to ui.theme config key

Actual Behavior

src/cleveragents/tui/slash_catalog.py line 83 registers the command:

SlashCommandSpec("theme", "Utility", "Switch color theme"),

But TuiCommandRouter.handle() in commands.py has no handler for theme:

def handle(self, raw: str, *, session_id: str) -> str:
    tokens = raw.strip().split()
    if not tokens:
        return "Empty command"
    if tokens[0] == "persona":
        return self._persona_command(tokens[1:], session_id=session_id)
    if tokens[0] == "session":
        return self._session_command(tokens[1:], session_id=session_id)
    if tokens[0] == "help":
        return self._help_command(tokens[1:])
    return f"Unknown command: /{raw}"  # ← /theme falls through here

Typing /theme dracula in the TUI returns "Unknown command: /theme dracula".


Impact

  • Users cannot switch themes via the slash command interface
  • The 17+ Textual built-in themes advertised in the spec are inaccessible
  • The Dracula theme cannot be restored if accidentally changed

Add a _theme_command() handler to TuiCommandRouter:

if tokens[0] == "theme":
    return self._theme_command(tokens[1:])
def _theme_command(self, tokens: list[str]) -> str:
    if not tokens:
        return "Usage: /theme <name>  (e.g., /theme dracula, /theme monokai)"
    theme_name = tokens[0]
    # Theme switching requires access to the App instance
    # This should be wired via a callback or message to the App
    return f"Theme switched to: {theme_name}"

Note: The TuiCommandRouter currently has no reference to the App instance, so theme switching will require either a callback injection or a Textual message posted to the app.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Bug Report **Feature Area:** TUI — Dracula Theme / Theme Switching (v3.7.0) **Severity:** Medium — theme switching via slash command non-functional **Discovered by:** UAT Testing (uat-pool-1, worker: tui-sidebar-layout) --- ## What Was Tested Code analysis of `src/cleveragents/tui/commands.py` and `src/cleveragents/tui/slash_catalog.py` against the TUI specification (§29858). --- ## Expected Behavior (from spec §29858) > Default theme is **Dracula**. All 17+ Textual built-in themes are supported and switchable via `/theme <name>`. The `/theme` slash command should: 1. Accept a theme name argument (e.g., `/theme monokai`, `/theme nord`) 2. Call `self.app.theme = theme_name` to switch the Textual theme at runtime 3. Persist the theme preference to `ui.theme` config key --- ## Actual Behavior `src/cleveragents/tui/slash_catalog.py` line 83 registers the command: ```python SlashCommandSpec("theme", "Utility", "Switch color theme"), ``` But `TuiCommandRouter.handle()` in `commands.py` has no handler for `theme`: ```python def handle(self, raw: str, *, session_id: str) -> str: tokens = raw.strip().split() if not tokens: return "Empty command" if tokens[0] == "persona": return self._persona_command(tokens[1:], session_id=session_id) if tokens[0] == "session": return self._session_command(tokens[1:], session_id=session_id) if tokens[0] == "help": return self._help_command(tokens[1:]) return f"Unknown command: /{raw}" # ← /theme falls through here ``` Typing `/theme dracula` in the TUI returns `"Unknown command: /theme dracula"`. --- ## Impact - Users cannot switch themes via the slash command interface - The 17+ Textual built-in themes advertised in the spec are inaccessible - The Dracula theme cannot be restored if accidentally changed --- ## Recommended Fix Add a `_theme_command()` handler to `TuiCommandRouter`: ```python if tokens[0] == "theme": return self._theme_command(tokens[1:]) ``` ```python def _theme_command(self, tokens: list[str]) -> str: if not tokens: return "Usage: /theme <name> (e.g., /theme dracula, /theme monokai)" theme_name = tokens[0] # Theme switching requires access to the App instance # This should be wired via a callback or message to the App return f"Theme switched to: {theme_name}" ``` Note: The `TuiCommandRouter` currently has no reference to the `App` instance, so theme switching will require either a callback injection or a Textual message posted to the app. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.2.0 milestone 2026-04-09 07:45:13 +00:00
Author
Owner

Label compliance fix applied:

  • Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md

Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: backlog-groomer

Label compliance fix applied: - Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: backlog-groomer
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#5584
No description provided.