Refactor broad exception handling in TUI widget files #2362

Open
opened 2026-04-03 17:20:40 +00:00 by freemo · 2 comments
Owner

Several TUI widget files use a _load_static_base (or similar) function that catches a broad Exception when trying to import the textual library. This pattern can be found in the following files:

  • src/cleveragents/tui/widgets/thought_block.py
  • src/cleveragents/tui/widgets/slash_command_overlay.py
  • src/cleveragents/tui/widgets/reference_picker.py
  • src/cleveragents/tui/widgets/prompt.py
  • src/cleveragents/tui/widgets/persona_bar.py
  • src/cleveragents/tui/widgets/permission_question.py
  • src/cleveragents/tui/widgets/help_panel_overlay.py
  • src/cleveragents/tui/widgets/actor_selection_overlay.py

While this is used for a fallback mechanism, it is better to catch more specific exceptions, such as ImportError, to avoid masking other unexpected errors.

Recommendation:

Refactor the _load_..._base functions in the TUI widget files to catch ImportError instead of the broad Exception.


Automated by CleverAgents Bot
Supervisor: Architecture Guard | Agent: ca-architecture-guard

Several TUI widget files use a `_load_static_base` (or similar) function that catches a broad `Exception` when trying to import the `textual` library. This pattern can be found in the following files: * `src/cleveragents/tui/widgets/thought_block.py` * `src/cleveragents/tui/widgets/slash_command_overlay.py` * `src/cleveragents/tui/widgets/reference_picker.py` * `src/cleveragents/tui/widgets/prompt.py` * `src/cleveragents/tui/widgets/persona_bar.py` * `src/cleveragents/tui/widgets/permission_question.py` * `src/cleveragents/tui/widgets/help_panel_overlay.py` * `src/cleveragents/tui/widgets/actor_selection_overlay.py` While this is used for a fallback mechanism, it is better to catch more specific exceptions, such as `ImportError`, to avoid masking other unexpected errors. **Recommendation:** Refactor the `_load_..._base` functions in the TUI widget files to catch `ImportError` instead of the broad `Exception`. --- **Automated by CleverAgents Bot** Supervisor: Architecture Guard | Agent: ca-architecture-guard
Author
Owner

Label compliance fix applied:

  • Added missing label: State/Unverified
  • Added missing label: Type/Task
  • Added missing label: Priority/Backlog
  • Reason: Per CONTRIBUTING.md, every issue must have exactly one State/, Type/, and Priority/* label. This issue was created without any labels.

Note: This issue also has no milestone and no parent Epic link. Please link it to the appropriate Epic and assign a milestone.


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

Label compliance fix applied: - Added missing label: `State/Unverified` - Added missing label: `Type/Task` - Added missing label: `Priority/Backlog` - Reason: Per CONTRIBUTING.md, every issue must have exactly one State/*, Type/*, and Priority/* label. This issue was created without any labels. Note: This issue also has no milestone and no parent Epic link. Please link it to the appropriate Epic and assign a milestone. --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: ca-backlog-groomer
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Backlog — Refactoring broad exception handling in TUI widget files is a code quality improvement.
  • Milestone: v3.8.0
  • MoSCoW: Could Have — Error handling improvement with no functional impact. Can be done opportunistically.
  • Parent Epic: #868 (TUI Interface, Modals and Persona System)

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

Issue triaged by project owner: - **State**: Verified - **Priority**: Backlog — Refactoring broad exception handling in TUI widget files is a code quality improvement. - **Milestone**: v3.8.0 - **MoSCoW**: Could Have — Error handling improvement with no functional impact. Can be done opportunistically. - **Parent Epic**: #868 (TUI Interface, Modals and Persona System) --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
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#2362
No description provided.