Skip to content

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Feb 3, 2026

Changes

  • Modified system_message() style in cortex-core/src/style.rs
  • Changed color from TEXT_MUTED (gray #486581) to ERROR (red #FF6B6B)
  • Backend JSON error messages will now be displayed in red instead of muted gray

Visual Impact

All system messages (including backend errors) will now appear in red with italic styling.

@greptile-apps
Copy link

greptile-apps bot commented Feb 3, 2026

Greptile Overview

Greptile Summary

Changed the system_message() style in src/cortex-core/src/style.rs from muted gray (TEXT_MUTED #486581) to error red (ERROR #FF6B6B). This makes all system messages display in red with italic styling.

Key Issues:

  • The system_message() style is used for BOTH error messages AND informational messages throughout the codebase
  • Examples of non-error usage include: "Resumed session: {id}", "No provider configured. Use /provider...", command output messages
  • Displaying all system messages in red creates a misleading UX where informational messages appear as errors
  • As noted in the PR description, this is a demo PR and should not be merged without separating error-specific styling from general system messages

Recommendation:

Create a dedicated error_message() style function for actual errors, keeping system_message() for informational system messages. This would allow proper semantic color coding based on message severity.

Confidence Score: 3/5

  • This PR should NOT be merged as-is due to UX issues with non-error messages appearing as errors
  • The change is syntactically correct and won't cause runtime errors, but creates a logical UX problem where all system messages (including informational ones) display in red, misleading users about message severity
  • Pay close attention to src/cortex-core/src/style.rs - the change affects all system messages throughout the application

Important Files Changed

Filename Overview
src/cortex-core/src/style.rs Changed system_message() style from muted gray to error red - affects all system messages including both errors and informational messages

Sequence Diagram

sequenceDiagram
    participant User
    participant TUI as Cortex TUI
    participant EventLoop
    participant AppState
    participant StyleRS as style.rs
    participant ChatWidget as Chat Widget

    User->>TUI: Executes command/triggers error
    TUI->>EventLoop: Process command/error
    
    alt Error condition
        EventLoop->>EventLoop: add_system_message("Error: ...")
    else Informational message
        EventLoop->>EventLoop: add_system_message("Info message")
    end
    
    EventLoop->>AppState: add_message(Message::system(content))
    AppState->>ChatWidget: Render message
    ChatWidget->>StyleRS: Get style via CortexStyle::system_message()
    
    alt Before this PR
        StyleRS-->>ChatWidget: Returns TEXT_MUTED (gray #486581)
    else After this PR
        StyleRS-->>ChatWidget: Returns ERROR (red #FF6B6B)
    end
    
    ChatWidget->>User: Display message in styled color
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, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines 365 to 369
/// System message style: error red italic text for backend error messages
#[inline]
pub fn system_message() -> Style {
Style::default()
.fg(TEXT_MUTED)
.fg(ERROR)
.add_modifier(Modifier::ITALIC)
}
Copy link

Choose a reason for hiding this comment

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

system_message() is used for both errors AND informational messages (e.g., "Resumed session: {id}", command output). Making all system messages red misleads users into thinking informational messages are errors.

Consider creating a separate error_message() style as the PR description suggests, or distinguish message types at the call site.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/cortex-core/src/style.rs
Line: 365:371

Comment:
`system_message()` is used for both errors AND informational messages (e.g., "Resumed session: {id}", command output). Making all system messages red misleads users into thinking informational messages are errors.

Consider creating a separate `error_message()` style as the PR description suggests, or distinguish message types at the call site.

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

@echobt echobt force-pushed the feature/red-error-messages branch from de17bae to 339ce15 Compare February 3, 2026 19:03
@echobt echobt changed the title [DO NOT MERGE] Display backend error messages in red Display backend error messages in red Feb 3, 2026
Address Greptile review feedback on PR #18:
- Reverted system_message() to use TEXT_MUTED (gray) for informational messages
- Added new error_message() style with ERROR (red) + italic for backend errors
- Rendering logic in rendering.rs already detects errors and uses colors.error

This ensures regular system messages (like 'Resumed session') stay muted gray
while actual error messages are displayed in red.
@echobt echobt merged commit 5ca128d into main Feb 3, 2026
15 checks passed
@echobt echobt deleted the feature/red-error-messages branch February 3, 2026 21:07
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