Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Aug 7, 2025

Summary

BEFORE
image

AFTER
image

image

This PR addresses the Slack request to make the say(error, ...) display less jarring by matching the styling of the diff_error display.

Changes

  • Modified the error case in ChatRow.tsx to use a collapsible UI similar to diff_error
  • Added state variables for managing error expansion and copy success feedback
  • Implemented a cleaner, less jarring error display with:
    • Collapsible/expandable error container
    • Copy button for error text
    • Chevron indicator for expand/collapse state
    • Error text in a subtle background container when expanded
    • Maintained error icon and color but in a more subtle presentation

Before

The error display was a simple red text with an error icon, which was visually jarring.

After

The error display now matches the diff_error style with:

  • A clickable header that can expand/collapse
  • A copy button for easy error text copying
  • Error content displayed in a subtle background container when expanded
  • Overall less jarring visual presentation while maintaining clarity

Testing

  • All existing tests pass
  • The UI changes are purely visual and don't affect functionality
  • Manually tested the expand/collapse and copy functionality

Important

Improved error display in ChatRow.tsx by introducing collapsible UI with DisclosureHeader and extracting error titles using extractErrorTitle().

  • Behavior:
    • Updated error display in ChatRow.tsx to use a collapsible UI similar to diff_error.
    • Added copy button and chevron indicator for error messages.
    • Error text now appears in a subtle background when expanded.
  • Components:
    • Introduced DisclosureHeader component for collapsible headers in DisclosureHeader.tsx.
  • Utilities:
    • Added extractErrorTitle() in errorTitleExtractor.ts to derive titles from error messages.
    • Comprehensive tests for extractErrorTitle() in errorTitleExtractor.spec.ts.
  • Misc:
    • Removed unused VSCodeButton import in ChatRow.tsx.

This description was created by Ellipsis for 55f7053. You can customize this summary. It will automatically update as commits are pushed.

- Added collapsible UI for error messages similar to diff_error display
- Added copy button for error text
- Added expand/collapse chevron indicator
- Error text now appears in a subtle background container when expanded
- Maintains error icon and color but in a less jarring presentation
@roomote roomote bot requested review from cte, jr and mrubens as code owners August 7, 2025 00:35
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. UI/UX UI/UX related or focused labels Aug 7, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Reviewing my own code is like debugging in production - technically possible but morally questionable.

<div style={headerStyle}>
{icon}
{title}
<div>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I notice there's significant code duplication between the error and diff_error implementations. Both share nearly identical structure for the collapsible UI, copy functionality, and expand/collapse behavior. Could we consider extracting a reusable component like to reduce this duplication and make future maintenance easier?

justifyContent: "space-between",
cursor: "pointer",
}}
onClick={() => setIsErrorExpanded(!isErrorExpanded)}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The clickable div lacks accessibility attributes. Consider adding:

This would improve keyboard navigation and screen reader support.

fontSize: 16,
marginBottom: "-1.5px",
}}></span>
<span style={{ fontWeight: "bold", color: "var(--vscode-errorForeground)" }}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it intentional that the "Error" label uses color while the diff_error "Diff Error" label uses the default color? This creates a visual inconsistency between the two similar components. If this is meant to indicate severity (errors being more critical than diff errors), that's fine, but wanted to confirm this was deliberate.

</span>
</div>
<div style={{ display: "flex", alignItems: "center" }}>
<VSCodeButton
Copy link
Contributor

Choose a reason for hiding this comment

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

For better accessibility, add an aria-label to the VSCodeButton (e.g. aria-label="Copy error message") so that its purpose is clear to screen readers.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 7, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Aug 9, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Aug 9, 2025
@daniel-lxs daniel-lxs marked this pull request as draft August 12, 2025 19:45
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Draft / In Progress] in Roo Code Roadmap Aug 12, 2025
… error/diff_error copy controls; use StandardTooltip with i18n; remove unused import
@hannesrudolph hannesrudolph marked this pull request as ready for review August 21, 2025 22:39
Copilot AI review requested due to automatic review settings August 21, 2025 22:39
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Aug 21, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the error display in the chat interface by making it less visually jarring and more consistent with the existing diff_error styling. The error display is now collapsible with a cleaner, more subtle appearance.

  • Modified error display to use a collapsible UI with expand/collapse functionality
  • Added copy button functionality for error text
  • Implemented visual improvements to make the error display less jarring while maintaining clarity

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

background: "transparent",
}}
onClick={(e) => {
<IconButton
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

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

The copy feedback logic for the diff error and the new error display is duplicated. Consider extracting this into a reusable function to reduce code duplication.

Copilot uses AI. Check for mistakes.
copyWithFeedback(message.text || "").then((success) => {
if (success) {
// Show checkmark
setShowCopySuccess(true)
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

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

The copy feedback state being set here should be setShowErrorCopySuccess(true) instead of setShowCopySuccess(true) to match the new error display state variables.

Copilot uses AI. Check for mistakes.

// Reset after a brief delay
setTimeout(() => {
setShowCopySuccess(false)
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

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

The copy feedback state being set here should be setShowErrorCopySuccess(false) instead of setShowCopySuccess(false) to match the new error display state variables.

Suggested change
setShowCopySuccess(false)
setShowErrorCopySuccess(false)

Copilot uses AI. Check for mistakes.
justifyContent: "space-between",
cursor: "pointer",
}}
onClick={() => setIsErrorExpanded(!isErrorExpanded)}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding accessibility attributes (e.g. role="button" and tabIndex) to the clickable error header div to improve keyboard navigation and screen reader support.

Suggested change
onClick={() => setIsErrorExpanded(!isErrorExpanded)}>
onClick={() => setIsErrorExpanded(!isErrorExpanded)} role="button" tabIndex={0}>

<IconButton
iconClass={showErrorCopySuccess ? "codicon-check" : "codicon-copy"}
title={t("chat:codeblock.tooltips.copy_code")}
onClick={(e: React.MouseEvent) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

The copy button’s onClick handler in the error block duplicates logic found in the diff_error block. Consider abstracting this copy-with-feedback functionality into a reusable component or helper to reduce duplication.

…error headers (aria, keyboard, chevron consistency)
{onCopy && (
<IconButton
iconClass={copyIconClass ?? "codicon-copy"}
title={copyTitle ?? "Copy"}
Copy link
Contributor

Choose a reason for hiding this comment

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

The default copy title is hardcoded as 'Copy'. Consider using a translatable string (via an i18n function) instead of a literal string to adhere to internationalization guidelines.

Suggested change
title={copyTitle ?? "Copy"}
title={copyTitle ?? t("copy")}

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

Copy link
Contributor

Choose a reason for hiding this comment

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

New case for 'file_not_found_error' mirrors the diff_error UI. Consider using a more specific translation key (e.g., 'chat:fileNotFoundError') instead of reusing 'chat:error' to provide clearer context in the UI.

Suggested change
title={<span style={{ fontWeight: "bold" }}>{t("chat:error")}</span>}
title={<span style={{ fontWeight: "bold" }}>{t("chat:fileNotFoundError")}</span>}

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

@hannesrudolph hannesrudolph force-pushed the fix/error-display-styling branch from a7a3988 to 0f47482 Compare August 21, 2025 23:44
Merge Resolver added 3 commits August 21, 2025 17:52
- Parse error messages to extract title before first colon
- Display extracted title (e.g. 'File Not Found') instead of generic 'Error'
- Remove redundant 'Error' prefix from extracted titles
- Maintain full error message in expanded content for context
- Parse error messages to extract specific error types (File Not Found, Permission Denied, etc.)
- Display extracted title instead of generic 'Error' in header
- Handle 'Error reading file: File not found:' pattern specifically
- Maintain full error message in expanded content for context
- Created errorTitleExtractor utility with pattern matching for all error types
- Handles MCP errors, file operations, tool errors, API errors, and embeddings errors
- Extracts meaningful titles instead of generic 'Error' for better UX
- Added comprehensive test suite with 44 test cases covering all error patterns
- Updated ChatRow.tsx to use the new extraction utility

This addresses the concern that error messages should display specific, meaningful titles rather than just 'Error' in the chat view.
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Aug 22, 2025
Merge Resolver added 2 commits August 21, 2025 18:48
…errors and tests

- Map "Roo tried to use ... without value for required parameter" to 'Missing Required Parameter'
- Keep existing 'Invalid Tool Arguments' mapping
- Add unit test covering the exact screenshot string
- No backend changes; only ChatView title extraction
… localized diff error title

- Prefer t('chat:diffError.title') for apply_diff missing param messages
- Keep invalid JSON argument as 'Invalid Tool Arguments'
- Add stable tool-scoped fallbacks for other tools
- Update tests accordingly (45 passing)

// Special-case: if tool use is missing a required param for apply_diff, title as the diff error (localized).
// Example: "Roo tried to use apply_diff without value for required parameter 'path'. Retrying..."
const missingRequiredParamRe =
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider refining the regex for missing required parameters so that it only applies to errors from the apply_diff tool. Currently, the regex matches any error of the form 'Roo tried to use ... without value for required parameter', which might unintentionally affect errors from other tools.

@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 23, 2025
@github-project-automation github-project-automation bot moved this from PR [Draft / In Progress] to Done in Roo Code Roadmap Aug 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR - Draft / In Progress size:XL This PR changes 500-999 lines, ignoring generated files. UI/UX UI/UX related or focused

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants