UAT: $ prefix not detected as shell mode in InputModeRouter #10412

Closed
opened 2026-04-18 09:36:11 +00:00 by HAL9000 · 1 comment
Owner

Summary

The spec requires both ! and $ to activate shell mode, but InputModeRouter.detect_mode() only recognises ! as the shell mode trigger.

Expected Behavior (from spec)

Both ! and $ prefixes must activate shell mode.

Actual Behavior

src/cleveragents/tui/input/modes.py only checks for !:

@staticmethod
def detect_mode(text: str) -> InputMode:
    stripped = text.lstrip()
    if stripped.startswith("/"):
        return InputMode.COMMAND
    if stripped.startswith("!"):
        return InputMode.SHELL
    return InputMode.NORMAL

$echo hello is routed to NORMAL mode instead of SHELL mode.

Reproduction Steps

  1. Inspect src/cleveragents/tui/input/modes.py
  2. Call InputModeRouter.detect_mode("$echo hello")
  3. Observe it returns InputMode.NORMAL instead of InputMode.SHELL

Subtasks

  • Add $ detection to detect_mode() in modes.py
  • Strip $ prefix before passing command to shell executor (same as !)
  • Add tests for $ prefix shell mode detection
  • Update help text to mention both ! and $

Definition of Done

  • detect_mode("$echo hello") returns InputMode.SHELL
  • Shell command executes correctly with $ prefix
  • Tests pass

Automated by CleverAgents Bot
Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor

## Summary The spec requires both `!` and `$` to activate shell mode, but `InputModeRouter.detect_mode()` only recognises `!` as the shell mode trigger. ## Expected Behavior (from spec) Both `!` and `$` prefixes must activate shell mode. ## Actual Behavior `src/cleveragents/tui/input/modes.py` only checks for `!`: ```python @staticmethod def detect_mode(text: str) -> InputMode: stripped = text.lstrip() if stripped.startswith("/"): return InputMode.COMMAND if stripped.startswith("!"): return InputMode.SHELL return InputMode.NORMAL ``` `$echo hello` is routed to NORMAL mode instead of SHELL mode. ## Reproduction Steps 1. Inspect `src/cleveragents/tui/input/modes.py` 2. Call `InputModeRouter.detect_mode("$echo hello")` 3. Observe it returns `InputMode.NORMAL` instead of `InputMode.SHELL` ## Subtasks - [x] Add `$` detection to `detect_mode()` in `modes.py` - [x] Strip `$` prefix before passing command to shell executor (same as `!`) - [x] Add tests for `$` prefix shell mode detection - [x] Update help text to mention both `!` and `$` ## Definition of Done - [x] `detect_mode("$echo hello")` returns `InputMode.SHELL` - [x] Shell command executes correctly with `$` prefix - [x] Tests pass --- **Automated by CleverAgents Bot** Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor
HAL9000 added the
State
Unverified
Type
Bug
Priority
Critical
MoSCoW
Must have
labels 2026-04-18 09:41:00 +00:00
HAL9000 added
State
Verified
and removed
State
Unverified
labels 2026-04-18 10:00:50 +00:00
HAL9000 removed the
MoSCoW
Must have
Priority
Critical
State
Verified
Type
Bug
labels 2026-04-19 11:45:48 +00:00
HAL9000 added the
State
In Review
label 2026-04-19 11:48:43 +00:00
Author
Owner

Implementation Attempt - Tier 1: haiku - Success
Fixed bug in InputModeRouter.detect_mode() where $ prefix was not recognized as shell mode trigger.

Changes made:

  • src/cleveragents/tui/input/modes.py: Added $ to shell prefix detection alongside !
  • features/tui_input_modes.feature: Added 4 new BDD scenarios for $ prefix
  • features/steps/tui_input_modes_steps.py: Added step definitions for detect_mode() testing

Quality gates: lint ✓, typecheck ✓, unit_tests ✓ (11 scenarios, 33 steps)
PR: #10752


Automated by CleverAgents Bot
Supervisor: Implementation Pool | Agent: implementation-worker

**Implementation Attempt** - Tier 1: haiku - Success Fixed bug in `InputModeRouter.detect_mode()` where `$` prefix was not recognized as shell mode trigger. **Changes made:** - `src/cleveragents/tui/input/modes.py`: Added `$` to shell prefix detection alongside `!` - `features/tui_input_modes.feature`: Added 4 new BDD scenarios for `$` prefix - `features/steps/tui_input_modes_steps.py`: Added step definitions for `detect_mode()` testing **Quality gates:** lint ✓, typecheck ✓, unit_tests ✓ (11 scenarios, 33 steps) **PR:** https://git.cleverthis.com/cleveragents/cleveragents-core/pulls/10752 --- **Automated by CleverAgents Bot** Supervisor: Implementation Pool | Agent: implementation-worker
Sign in to join this conversation.
No Label
State
In Review
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cleveragents/cleveragents-core#10412