UAT: TUI shell danger detection not wired to prompt — ShellSafetyService exists but visual warning never shown #5058

Closed
opened 2026-04-09 00:52:28 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

Feature Area: TUI — Shell Danger Detection / Safety Behaviors

Severity: Medium (safety warning not displayed)

What Was Tested

Shell danger detection as defined in the specification (§ Shell Danger Detection).

Expected Behavior (from spec)

When shell mode is active (!/$ prefix), the prompt performs heuristic analysis of the command to detect potentially destructive operations. Dangerous commands are highlighted with $error styling and a warning indicator appears below the prompt:

⚠ Potentially destructive command detected

The warning is advisory only — it never prevents command execution. Danger detection is controlled by shell.warn_dangerous setting (default: true).

Risk levels:

Pattern Risk Level
rm -rf / rm -r High
chmod 777 Medium
> /dev/sda / dd if= High
Fork bomb patterns High
mkfs / fdisk / parted High
kill -9 / killall Medium
sudo / su Low

Actual Behavior (from code analysis)

The ShellSafetyService and DangerousPatternDetector are fully implemented in src/cleveragents/tui/shell_safety/ with comprehensive pattern matching. However, they are never used by the TUI prompt.

The InputModeRouter in src/cleveragents/tui/input/modes.py uses a separate, simpler looks_dangerous() function from shell_exec.py (lines 21-31) that only checks 5 hardcoded patterns and blocks the command rather than showing a warning.

The ShellSafetyService is never instantiated or called anywhere in the TUI app code. No visual warning widget exists in the prompt area.

Steps to Reproduce

  1. Run agents tui
  2. Type !chmod 777 /var/www and press Enter
  3. Observe: command executes without any visual warning
  4. Type !sudo rm /etc/passwd and press Enter
  5. Observe: command executes without any visual warning (only blocked if it matches the 5 hardcoded patterns in looks_dangerous())

Code Location

  • src/cleveragents/tui/shell_safety/safety_service.py — fully implemented but unused
  • src/cleveragents/tui/input/shell_exec.py lines 21-31 (looks_dangerous() — simple blocking, no visual warning)
  • src/cleveragents/tui/app.pyShellSafetyService never imported or used

Impact

The spec-required visual warning for dangerous shell commands is never shown. Users receive no advisory feedback before executing potentially destructive commands. The ShellSafetyService implementation is dead code.


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

## Bug Report **Feature Area:** TUI — Shell Danger Detection / Safety Behaviors **Severity:** Medium (safety warning not displayed) ### What Was Tested Shell danger detection as defined in the specification (§ Shell Danger Detection). ### Expected Behavior (from spec) When shell mode is active (`!`/`$` prefix), the prompt performs heuristic analysis of the command to detect potentially destructive operations. Dangerous commands are highlighted with `$error` styling and a warning indicator appears below the prompt: > `⚠ Potentially destructive command detected` The warning is advisory only — it never prevents command execution. Danger detection is controlled by `shell.warn_dangerous` setting (default: `true`). Risk levels: | Pattern | Risk Level | |---------|-----------| | `rm -rf` / `rm -r` | High | | `chmod 777` | Medium | | `> /dev/sda` / `dd if=` | High | | Fork bomb patterns | High | | `mkfs` / `fdisk` / `parted` | High | | `kill -9` / `killall` | Medium | | `sudo` / `su` | Low | ### Actual Behavior (from code analysis) The `ShellSafetyService` and `DangerousPatternDetector` are fully implemented in `src/cleveragents/tui/shell_safety/` with comprehensive pattern matching. However, they are **never used by the TUI prompt**. The `InputModeRouter` in `src/cleveragents/tui/input/modes.py` uses a separate, simpler `looks_dangerous()` function from `shell_exec.py` (lines 21-31) that only checks 5 hardcoded patterns and **blocks** the command rather than showing a warning. The `ShellSafetyService` is never instantiated or called anywhere in the TUI app code. No visual warning widget exists in the prompt area. ### Steps to Reproduce 1. Run `agents tui` 2. Type `!chmod 777 /var/www` and press Enter 3. Observe: command executes without any visual warning 4. Type `!sudo rm /etc/passwd` and press Enter 5. Observe: command executes without any visual warning (only blocked if it matches the 5 hardcoded patterns in `looks_dangerous()`) ### Code Location - `src/cleveragents/tui/shell_safety/safety_service.py` — fully implemented but unused - `src/cleveragents/tui/input/shell_exec.py` lines 21-31 (`looks_dangerous()` — simple blocking, no visual warning) - `src/cleveragents/tui/app.py` — `ShellSafetyService` never imported or used ### Impact The spec-required visual warning for dangerous shell commands is never shown. Users receive no advisory feedback before executing potentially destructive commands. The `ShellSafetyService` implementation is dead code. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
Author
Owner

Closing as duplicate of #4736 — both issues report the same problem: TUI shell danger detection not wired to ShellSafetyService.


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

Closing as duplicate of #4736 — both issues report the same problem: TUI shell danger detection not wired to ShellSafetyService. --- **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.

Dependencies

No dependencies set.

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