Skip to content

refactor(tui): remove [i] prefix from system messages and use red color for errors#121

Merged
echobt merged 1 commit intomainfrom
remove-system-message-prefix
Feb 5, 2026
Merged

refactor(tui): remove [i] prefix from system messages and use red color for errors#121
echobt merged 1 commit intomainfrom
remove-system-message-prefix

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Feb 5, 2026

Summary

This PR removes the [i] prefix from system messages and improves error message visibility.

Changes

  • Remove [i] prefix from info system messages for cleaner output
  • Add error detection for provider overload and connection issues
  • Display error messages in red color (colors.error)
  • Display info messages in muted color without prefix
  • Simplify text wrapping loop without indent handling

Before

[i] The provider appears to be overloaded or your internet connection/proxy is experiencing issues communicating with it.

After

The provider appears to be overloaded or your internet connection/proxy is experiencing issues communicating with it.

(displayed in red color for error messages)

Testing

  • ✅ Code compiles successfully (cargo check)
  • ✅ All 895 tests pass (cargo test -p cortex-tui --lib)
  • ✅ Security audit: No issues found

…or for errors

- Remove [i] prefix from info system messages for cleaner output
- Add error detection for provider overload and connection issues
- Display error messages in red color (colors.error)
- Display info messages in muted color without prefix
- Simplify text wrapping loop without indent handling
@greptile-apps
Copy link

greptile-apps bot commented Feb 5, 2026

Greptile Overview

Greptile Summary

This PR improves the visual presentation of system messages in the TUI by removing the [i] prefix and enhancing error message visibility through color coding.

Key Changes

  • Removed [i] prefix from all system messages for cleaner output
  • Added new error detection patterns: "provider appears to be overloaded", "internet connection", "proxy is experiencing issues"
  • Error messages now display in red (colors.error), while info messages use muted color
  • Simplified text wrapping logic by removing prefix handling and indent calculations
  • Updated text_width calculation to account for no prefix (simplified from saturating_sub(prefix_width + 1) to saturating_sub(1))

Impact

The refactoring maintains the same functional behavior while improving code clarity and message readability. All 895 tests pass, confirming no regressions.

Confidence Score: 5/5

  • This PR is safe to merge with no risks
  • The changes are purely cosmetic (UI text formatting) with no logic changes that could affect functionality. The refactoring simplifies the code by removing conditional prefix handling, making it more maintainable. All 895 tests pass, confirming no regressions.
  • No files require special attention

Important Files Changed

Filename Overview
src/cortex-tui/src/views/minimal_session/rendering.rs Removed [i] prefix from system messages, added error detection patterns for provider/connection issues, simplified text wrapping logic

Sequence Diagram

sequenceDiagram
    participant User
    participant TUI as Terminal UI
    participant Renderer as render_message_with_theme
    participant WrapText as wrap_text
    participant Display as Terminal Display

    User->>TUI: System message (error/info)
    TUI->>Renderer: Call with Message
    
    alt MessageRole::System
        Renderer->>Renderer: Detect error patterns<br/>("overloaded", "connection", etc.)
        
        alt Is Error Message
            Renderer->>Renderer: Set text_color = colors.error (red)
        else Is Info Message
            Renderer->>Renderer: Set text_color = colors.text_muted
        end
        
        Renderer->>Renderer: Calculate text_width<br/>(no prefix deduction)
        Renderer->>WrapText: wrap_text(content, text_width)
        WrapText-->>Renderer: Vec<String> (wrapped lines)
        
        loop For each wrapped line
            Renderer->>Renderer: Create Line with Span<br/>(no prefix, just colored text)
        end
        
        Renderer-->>TUI: Vec<Line> (all lines colored)
    end
    
    TUI->>Display: Render lines to buffer
    Display->>User: Show message (red for errors, muted for info)
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@echobt echobt merged commit ebabc51 into main Feb 5, 2026
15 checks passed
@echobt echobt deleted the remove-system-message-prefix branch February 5, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant