Skip to content

Add mode display indicators on task cards (main screen and history) #6493

@MuriloFP

Description

@MuriloFP

What specific problem does this solve?

urrently, when users view their task cards on both the main screen and history screen, there's no visual indication of which mode (Code, Architect, Debug, etc.) was used for each task. This affects all users who:

  • Work with multiple modes throughout their day
  • Need to quickly identify which approach was used for past tasks
  • Want to understand patterns in their mode usage
  • Are reviewing task history to find similar problems solved with specific modes

Current behavior: Task cards show timestamp, task description, token usage, and cost, but no mode information - even though this data is already stored in the HistoryItem.mode field.

Expected behavior: Users should see a clear mode indicator showing the mode name on each task card that has mode information. Tasks without mode information should display normally without any badge.

Impact: Users waste time opening individual tasks to check which mode was used, making it harder to:

  • Find tasks where a specific mode was successful
  • Learn from past mode choices
  • Understand their workflow patterns

Additional context (optional)

No response

Roo Code Task Links (Optional)

No response

Request checklist

  • I've searched existing Issues and Discussions for duplicates
  • This describes a specific problem with clear impact and context

Interested in implementing this?

  • Yes, I'd like to help implement this feature

Implementation requirements

  • I understand this needs approval before implementation begins

How should this be solved? (REQUIRED if contributing, optional otherwise)

Add mode indicators to task cards by:

  1. Creating a reusable ModeBadge component that displays the mode name (with optional emoji if present), styled consistently with the existing UI using VSCode theme variables

  2. Updating TaskItemHeader (used in history view) to display the mode badge next to the timestamp when item.mode is available

  3. Updating TaskHeader (used in main chat view) to show the mode from currentTaskItem.mode in the header area

  4. Using the existing getModeBySlug function from src/shared/modes.ts to resolve mode details from the stored slug

The mode indicator should:

  • Display only the mode name (emoji is optional and may not exist for custom modes)
  • Be visually distinct but not overwhelming
  • Handle character limits appropriately (truncate long mode names with ellipsis)
  • Only appear when mode information exists (no badge for tasks without mode data)

How will we know it works? (Acceptance Criteria - REQUIRED if contributing, optional otherwise)

Given I have completed tasks using different modes (Code, Architect, Debug, etc.)
When I view the main chat screen with an active task
Then I see the mode indicator showing the mode name in the task header
And the indicator shows the correct mode that was used

Given I have a history of tasks created with different modes
When I open the history view
Then I see mode indicators on all task cards that have mode information
And tasks without mode information display normally without any badge
And no placeholder, empty badge, or "unknown mode" text appears

Given I'm using a custom mode with a long name
When I view tasks created with that custom mode
Then I see the mode name truncated appropriately with ellipsis
And the full name is available via tooltip on hover

Given I'm using a custom mode without an emoji
When I view tasks created with that mode
Then I see just the mode name displayed correctly
And the badge styling remains consistent

Technical considerations (REQUIRED if contributing, optional otherwise)

🔍 Comprehensive Issue Scoping

Root Cause / Implementation Target

The mode information is already being captured and stored in the HistoryItem.mode field when tasks are created. The infrastructure for resolving mode details from slugs exists via getModeBySlug(). We just need to surface this information in the UI.

Affected Components

  • Primary Files:

    • webview-ui/src/components/history/TaskItemHeader.tsx (lines 14-34): Add mode display to history cards
    • webview-ui/src/components/chat/TaskHeader.tsx (lines 25-100): Add mode display to main chat header
    • NEW: webview-ui/src/components/common/ModeBadge.tsx: Create reusable mode indicator component
  • Secondary Impact:

    • webview-ui/src/components/history/TaskItem.tsx: Passes through the mode data
    • Test files for affected components will need updates

Current Implementation Analysis

  • HistoryItem type includes optional mode?: string field (packages/types/src/history.ts:19)
  • currentTaskItem in ExtensionState is of type HistoryItem (src/shared/ExtensionMessage.ts:275)
  • Mode information is properly stored when tasks are created and when modes are switched
  • getModeBySlug() function can resolve mode details including name (with optional emoji)
  • Mode names are user-defined strings without enforced emoji requirements

Proposed Implementation

Step 1: Create ModeBadge component

  • File: webview-ui/src/components/common/ModeBadge.tsx
  • A simple component that takes a mode slug and displays the resolved mode name
  • Uses getModeBySlug() to get mode details
  • Handles cases where mode is undefined (returns null, no rendering)
  • Handles deleted custom modes gracefully
  • Implements text truncation for long mode names with CSS
  • Styled with VSCode theme variables for consistency

Step 2: Update TaskItemHeader

  • File: webview-ui/src/components/history/TaskItemHeader.tsx
  • Add ModeBadge component next to the timestamp (line 22-24)
  • Only render ModeBadge when item.mode is defined
  • Ensure proper spacing and alignment

Step 3: Update TaskHeader

  • File: webview-ui/src/components/chat/TaskHeader.tsx
  • Add ModeBadge in the header area, possibly near the task title
  • Use currentTaskItem.mode from props
  • Only render when mode exists
  • Consider placement that doesn't interfere with existing UI elements

Testing Requirements

  • Unit Tests:
    • ModeBadge component renders correctly with valid mode
    • ModeBadge returns null when mode is undefined
    • ModeBadge handles deleted custom modes
    • ModeBadge truncates long mode names appropriately
    • TaskItemHeader displays mode badge only when mode exists
    • TaskHeader displays mode badge only when currentTaskItem has mode
  • Integration Tests:
    • Mode displays correctly in history view
    • Mode displays correctly in main chat view
    • Custom modes without emojis display properly
    • Tasks without mode information show no badge

Trade-offs and risks (REQUIRED if contributing, optional otherwise)

  • Legacy tasks without mode data: Many existing tasks won't have mode information. The UI must not show any badge, placeholder, or indication for these tasks.
  • Deleted custom modes: If a custom mode is deleted, tasks created with it will still reference the deleted mode slug. The ModeBadge should handle this gracefully (perhaps show the slug as fallback).
  • Long mode names: Custom modes can have arbitrary names. Implement CSS text truncation with ellipsis and tooltips for full names.
  • Performance: The mode resolution happens for each task card, but since getModeBySlug() is a simple array lookup, impact should be minimal.
  • UI space constraints: On mobile or narrow viewports, ensure mode badges don't cause layout issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.enhancementNew feature or requestproposal

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions