bug(tui): TUI slash router rejects colon commands #8792

Open
opened 2026-04-13 23:44:56 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Commit: fd68b85c7be34d011cee7b4f28b190f946e40fc0
  • Branch: master
  • Module: src/cleveragents/tui/commands.py

Background and Context

TuiCommandRouter.handle() splits input on whitespace and compares tokens[0] directly against the strings "persona", "session", and "help". However, the TUI input pipeline (via InputModeRouter in input/modes.py) strips the leading / and passes the remainder unchanged — so a user typing /session:export delivers the string "session:export" to the router.

Because "session:export" != "session", every spec-defined colon-form slash command (/persona:list, /session:export, /plan:list, etc.) hits the else branch and returns "Unknown command". Only bare commands like /help work, because "help" has no colon suffix.

Code evidence:

  1. commands.py lines 48–58 — whitespace split + direct equality checks that ignore the colon-separated verb.
  2. input/modes.py lines 58–63 — passes command text like "session:export" unchanged after removing the leading slash.

Specification reference: docs/specification.md lines 29395–29425 define the /<noun>:<verb> pattern (e.g., /session:export, /persona:list) as the canonical TUI slash command format.


Expected Behavior

TuiCommandRouter.handle() correctly parses the <noun>:<verb> structure of every slash command defined in the slash catalog. Calling router.handle("session:export --format json", session_id="demo") dispatches to the session export handler and returns the expected output instead of "Unknown command: /session:export".


Acceptance Criteria

  • router.handle("persona:list", session_id=...) dispatches to the persona list handler without returning "Unknown command".
  • router.handle("session:export --format json", session_id=...) dispatches to the session export handler.
  • router.handle("plan:list", session_id=...) dispatches to the plan list handler.
  • All other catalogued colon-form slash commands (persona:set, session:new, plan:status, etc.) are routed correctly.
  • Bare commands (help) continue to work as before.
  • Unit tests exist for at least persona:list and session:export colon commands — failing before the fix, passing after.
  • No regression on existing passing tests.

Subtasks

  • Audit TuiCommandRouter.handle() to understand the full dispatch table and all supported commands.
  • Normalize tokens[0] by splitting on ':' (e.g., base, _, sub = tokens[0].partition(':')) before dispatching, or look up the slash catalog by full <noun>:<verb> key and route accordingly.
  • Update input/modes.py if any pre-processing is needed to preserve the colon structure correctly.
  • Add unit tests covering colon commands for at minimum the persona and session namespaces (TDD: write failing tests first, then fix).
  • Verify all catalogued slash commands in slash_catalog.py are reachable after the fix.
  • Run the full test suite and confirm no regressions.

Definition of Done

This issue is closed when:

  1. TuiCommandRouter.handle() correctly dispatches all /<noun>:<verb> slash commands defined in the spec and slash catalog.
  2. Unit tests for colon-form commands exist and pass.
  3. The fix is merged to master with no test regressions.
  4. Manual verification (or automated UAT) confirms /session:export and /persona:list work end-to-end in the TUI.

Note: Issue #8749 ([AUTO-GUARD-3] Implement slash command routing through the A2A facade) covers the broader architectural concern of routing through the A2A facade. This issue is specifically scoped to the parsing/tokenization bug that causes the router to reject all colon-form commands before any dispatch logic is even reached.

TDD Note: Add unit coverage ensuring router.handle dispatches /session:export and /persona:list correctly — tests should fail before the fix and pass after.


Automated by CleverAgents Bot
Agent: new-issue-creator

## Metadata - **Commit:** `fd68b85c7be34d011cee7b4f28b190f946e40fc0` - **Branch:** `master` - **Module:** `src/cleveragents/tui/commands.py` --- ## Background and Context `TuiCommandRouter.handle()` splits input on whitespace and compares `tokens[0]` directly against the strings `"persona"`, `"session"`, and `"help"`. However, the TUI input pipeline (via `InputModeRouter` in `input/modes.py`) strips the leading `/` and passes the remainder unchanged — so a user typing `/session:export` delivers the string `"session:export"` to the router. Because `"session:export" != "session"`, every spec-defined colon-form slash command (`/persona:list`, `/session:export`, `/plan:list`, etc.) hits the `else` branch and returns `"Unknown command"`. Only bare commands like `/help` work, because `"help"` has no colon suffix. **Code evidence:** 1. `commands.py` lines 48–58 — whitespace split + direct equality checks that ignore the colon-separated verb. 2. `input/modes.py` lines 58–63 — passes command text like `"session:export"` unchanged after removing the leading slash. **Specification reference:** `docs/specification.md` lines 29395–29425 define the `/<noun>:<verb>` pattern (e.g., `/session:export`, `/persona:list`) as the canonical TUI slash command format. --- ## Expected Behavior `TuiCommandRouter.handle()` correctly parses the `<noun>:<verb>` structure of every slash command defined in the slash catalog. Calling `router.handle("session:export --format json", session_id="demo")` dispatches to the session export handler and returns the expected output instead of `"Unknown command: /session:export"`. --- ## Acceptance Criteria - [ ] `router.handle("persona:list", session_id=...)` dispatches to the persona list handler without returning `"Unknown command"`. - [ ] `router.handle("session:export --format json", session_id=...)` dispatches to the session export handler. - [ ] `router.handle("plan:list", session_id=...)` dispatches to the plan list handler. - [ ] All other catalogued colon-form slash commands (`persona:set`, `session:new`, `plan:status`, etc.) are routed correctly. - [ ] Bare commands (`help`) continue to work as before. - [ ] Unit tests exist for at least `persona:list` and `session:export` colon commands — failing before the fix, passing after. - [ ] No regression on existing passing tests. --- ## Subtasks - [ ] Audit `TuiCommandRouter.handle()` to understand the full dispatch table and all supported commands. - [ ] Normalize `tokens[0]` by splitting on `':'` (e.g., `base, _, sub = tokens[0].partition(':')`) before dispatching, **or** look up the slash catalog by full `<noun>:<verb>` key and route accordingly. - [ ] Update `input/modes.py` if any pre-processing is needed to preserve the colon structure correctly. - [ ] Add unit tests covering colon commands for at minimum the `persona` and `session` namespaces (TDD: write failing tests first, then fix). - [ ] Verify all catalogued slash commands in `slash_catalog.py` are reachable after the fix. - [ ] Run the full test suite and confirm no regressions. --- ## Definition of Done This issue is closed when: 1. `TuiCommandRouter.handle()` correctly dispatches all `/<noun>:<verb>` slash commands defined in the spec and slash catalog. 2. Unit tests for colon-form commands exist and pass. 3. The fix is merged to `master` with no test regressions. 4. Manual verification (or automated UAT) confirms `/session:export` and `/persona:list` work end-to-end in the TUI. --- > **Note:** Issue #8749 (`[AUTO-GUARD-3] Implement slash command routing through the A2A facade`) covers the broader architectural concern of routing through the A2A facade. This issue is specifically scoped to the **parsing/tokenization bug** that causes the router to reject all colon-form commands before any dispatch logic is even reached. > **TDD Note:** Add unit coverage ensuring `router.handle` dispatches `/session:export` and `/persona:list` correctly — tests should fail before the fix and pass after. --- **Automated by CleverAgents Bot** Agent: new-issue-creator
HAL9000 added this to the v3.7.0 milestone 2026-04-14 00:11:45 +00:00
Author
Owner

Triage Decision: VERIFIED — MoSCoW/Must Have

Real bug: all /noun:verb slash commands (e.g., /session:export, /persona:list) are rejected by the router because TuiCommandRouter.handle() splits on whitespace and compares tokens[0] directly without handling the colon structure. This breaks all spec-defined slash commands. Core TUI functionality is broken.

Priority/High — All spec-defined slash commands are non-functional.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

✅ **Triage Decision: VERIFIED — MoSCoW/Must Have** Real bug: all `/noun:verb` slash commands (e.g., `/session:export`, `/persona:list`) are rejected by the router because `TuiCommandRouter.handle()` splits on whitespace and compares `tokens[0]` directly without handling the colon structure. This breaks all spec-defined slash commands. Core TUI functionality is broken. **Priority/High** — All spec-defined slash commands are non-functional. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
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.

Dependencies

No dependencies set.

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