UAT: TUI TuiCommandRouter cannot dispatch colon-namespaced slash commands — all session:*, persona:*, scope:*, plan:* commands return 'Unknown command' #3273

Open
opened 2026-04-05 08:57:14 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/tui-command-router-colon-namespace-dispatch
  • Commit Message: fix(tui): parse colon-namespaced slash commands in TuiCommandRouter
  • Milestone: v3.7.0
  • Parent Epic: #868

Bug Report

Feature Area: TUI Implementation — Reference and Command System (ADR-046)
Severity: High
Priority: Backlog

What Was Tested

Analyzed the TuiCommandRouter.handle() method in src/cleveragents/tui/commands.py against the slash command catalog in src/cleveragents/tui/slash_catalog.py.

Expected Behavior (from spec)

Per ADR-046, the slash command system uses colon-namespaced commands:

  • /session:create, /session:list, /session:show, /session:switch, /session:close, /session:delete, /session:rename, /session:export, /session:import
  • /persona:list, /persona:set, /persona:create, /persona:edit, /persona:delete, /persona:export, /persona:import
  • /scope:add, /scope:remove, /scope:clear, /scope:show
  • /plan:use, /plan:list, /plan:status, etc.

The SlashCommandOverlay correctly displays these colon-namespaced commands. When the user selects one and presses enter, the command should be dispatched and executed.

Actual Behavior

TuiCommandRouter.handle() splits the raw command string on spaces and checks tokens[0]:

def handle(self, raw: str, *, session_id: str) -> str:
    tokens = raw.strip().split()
    if not tokens:
        return "Empty command"
    if tokens[0] == "persona":          # ← checks for "persona" (no colon)
        return self._persona_command(tokens[1:], session_id=session_id)
    if tokens[0] == "session":          # ← checks for "session" (no colon)
        return self._session_command(tokens[1:], session_id=session_id)
    if tokens[0] == "help":
        return "Commands: /persona, /session, /help"
    return f"Unknown command: /{raw}"   # ← all other commands fall here

When a user types /session:create, the InputModeRouter strips the leading / and passes session:create to handle(). The tokens[0] is "session:create", which does NOT match "session". The result is:

Unknown command: /session:create

This means all colon-namespaced commands (the entire slash catalog except help) return "Unknown command". The only commands that work are:

  • /persona list (space-separated, not colon-namespaced)
  • /persona set <name> (space-separated)
  • /session show (space-separated)
  • /session export (space-separated)
  • /session import (space-separated)

Steps to Reproduce

  1. Launch the TUI
  2. Type /session:create and press enter
  3. Observe: "Unknown command: /session:create"
  4. Type /persona:list and press enter
  5. Observe: "Unknown command: /persona:list"

Code Location

  • src/cleveragents/tui/commands.py lines 46-56 — handle() method checks for space-separated tokens, not colon-namespaced commands
  • src/cleveragents/tui/slash_catalog.py lines 17-88 — catalog uses colon-namespaced commands throughout

Root Cause

The command router was implemented with space-separated sub-commands (/persona list, /session show) but the slash catalog and ADR-046 spec use colon-namespaced commands (/persona:list, /session:show). The router needs to parse the colon-separated namespace prefix and dispatch accordingly.

Impact

All 87 catalogued slash commands except help are non-functional when typed in the colon-namespaced format shown in the overlay. Users see the correct commands in the overlay but cannot execute them.

Subtasks

  • Parse namespace:subcommand format in TuiCommandRouter.handle() by splitting on : before falling through to space-token dispatch
  • Add dispatch branches for all namespaces defined in slash_catalog.py: session, persona, scope, plan
  • Implement or wire _scope_command() and _plan_command() handler methods (currently absent)
  • Update the help command response to list colon-namespaced commands
  • Tests (Behave): Add scenarios covering colon-namespaced dispatch for each namespace
  • Tests (Behave): Add regression scenario confirming space-separated legacy format still works (if intentionally supported)
  • Tests (Robot): Add integration test exercising the TUI command overlay → dispatch path
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • TuiCommandRouter.handle() correctly dispatches all colon-namespaced commands listed in slash_catalog.py without returning "Unknown command".
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass.
  • Coverage >= 97%.

Backlog note: This issue was discovered during autonomous operation
on milestone v3.7.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/tui-command-router-colon-namespace-dispatch` - **Commit Message**: `fix(tui): parse colon-namespaced slash commands in TuiCommandRouter` - **Milestone**: v3.7.0 - **Parent Epic**: #868 ## Bug Report **Feature Area:** TUI Implementation — Reference and Command System (ADR-046) **Severity:** High **Priority:** Backlog ### What Was Tested Analyzed the `TuiCommandRouter.handle()` method in `src/cleveragents/tui/commands.py` against the slash command catalog in `src/cleveragents/tui/slash_catalog.py`. ### Expected Behavior (from spec) Per ADR-046, the slash command system uses colon-namespaced commands: - `/session:create`, `/session:list`, `/session:show`, `/session:switch`, `/session:close`, `/session:delete`, `/session:rename`, `/session:export`, `/session:import` - `/persona:list`, `/persona:set`, `/persona:create`, `/persona:edit`, `/persona:delete`, `/persona:export`, `/persona:import` - `/scope:add`, `/scope:remove`, `/scope:clear`, `/scope:show` - `/plan:use`, `/plan:list`, `/plan:status`, etc. The `SlashCommandOverlay` correctly displays these colon-namespaced commands. When the user selects one and presses enter, the command should be dispatched and executed. ### Actual Behavior `TuiCommandRouter.handle()` splits the raw command string on spaces and checks `tokens[0]`: ```python def handle(self, raw: str, *, session_id: str) -> str: tokens = raw.strip().split() if not tokens: return "Empty command" if tokens[0] == "persona": # ← checks for "persona" (no colon) return self._persona_command(tokens[1:], session_id=session_id) if tokens[0] == "session": # ← checks for "session" (no colon) return self._session_command(tokens[1:], session_id=session_id) if tokens[0] == "help": return "Commands: /persona, /session, /help" return f"Unknown command: /{raw}" # ← all other commands fall here ``` When a user types `/session:create`, the `InputModeRouter` strips the leading `/` and passes `session:create` to `handle()`. The `tokens[0]` is `"session:create"`, which does NOT match `"session"`. The result is: ``` Unknown command: /session:create ``` This means **all colon-namespaced commands** (the entire slash catalog except `help`) return "Unknown command". The only commands that work are: - `/persona list` (space-separated, not colon-namespaced) - `/persona set <name>` (space-separated) - `/session show` (space-separated) - `/session export` (space-separated) - `/session import` (space-separated) ### Steps to Reproduce 1. Launch the TUI 2. Type `/session:create` and press enter 3. Observe: "Unknown command: /session:create" 4. Type `/persona:list` and press enter 5. Observe: "Unknown command: /persona:list" ### Code Location - `src/cleveragents/tui/commands.py` lines 46-56 — `handle()` method checks for space-separated tokens, not colon-namespaced commands - `src/cleveragents/tui/slash_catalog.py` lines 17-88 — catalog uses colon-namespaced commands throughout ### Root Cause The command router was implemented with space-separated sub-commands (`/persona list`, `/session show`) but the slash catalog and ADR-046 spec use colon-namespaced commands (`/persona:list`, `/session:show`). The router needs to parse the colon-separated namespace prefix and dispatch accordingly. ### Impact All 87 catalogued slash commands except `help` are non-functional when typed in the colon-namespaced format shown in the overlay. Users see the correct commands in the overlay but cannot execute them. ## Subtasks - [ ] Parse `namespace:subcommand` format in `TuiCommandRouter.handle()` by splitting on `:` before falling through to space-token dispatch - [ ] Add dispatch branches for all namespaces defined in `slash_catalog.py`: `session`, `persona`, `scope`, `plan` - [ ] Implement or wire `_scope_command()` and `_plan_command()` handler methods (currently absent) - [ ] Update the `help` command response to list colon-namespaced commands - [ ] Tests (Behave): Add scenarios covering colon-namespaced dispatch for each namespace - [ ] Tests (Behave): Add regression scenario confirming space-separated legacy format still works (if intentionally supported) - [ ] Tests (Robot): Add integration test exercising the TUI command overlay → dispatch path - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - `TuiCommandRouter.handle()` correctly dispatches all colon-namespaced commands listed in `slash_catalog.py` without returning "Unknown command". - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass. - Coverage >= 97%. > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.7.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.7.0 milestone 2026-04-05 09:14:20 +00:00
freemo removed this from the v3.7.0 milestone 2026-04-07 00:11:18 +00:00
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.

Blocks
Reference
cleveragents/cleveragents-core#3273
No description provided.