Skip to content

Conversation

@code-crusher
Copy link
Member

  • fix race condition with the isUserInput flag
  • API Streaming Failed to have retry button
  • fix previous commands still show run/reject buttons
  • better checkpoint handling
  • feat: migrate KiloTaskHeader and TaskItem to use ReadOnlyChatText
  • add chat renderer

MIGRATION CHANGES:
- Update KiloTaskHeader.tsx to import and use ReadOnlyChatText component
- Replace custom highlightText function calls with ReadOnlyChatText
- Remove unused highlighting functions (highlightSlashCommands, highlightMentions, highlightText)
- Update TaskItem.tsx to use ReadOnlyChatText for consistent text rendering
- Remove unused highlight property from DisplayHistoryItem interface
- Remove empty DisplayHistoryItem interface to fix linting warning

LINTING FIXES:
- Clean up unused imports (validateSlashCommand, mentionRegexGlobal, vscode)
- Remove unused customModes variable in KiloTaskHeader
- Remove unused Mention import in ChatRow.tsx
- Remove unused imports in ChatTextArea.tsx (getIconForFilePath, getIconUrlByName, formatMentionChipParts, getFileIconForMention, valueToHtml)
- Remove unused mentionRegex import in ReadOnlyChatText.tsx

BENEFITS:
- Provides better text formatting with HTML conversion and mention support
- Maintains all existing styling and layout functionality
- Improves code consistency across chat components
- Eliminates custom highlighting logic in favor of established component
@matter-code-review
Copy link
Contributor

matter-code-review bot commented Dec 26, 2025

Context

This release (v4.205.0) focuses on stabilizing the chat interface and improving API resilience. It addresses race conditions in user input flags, enhances error recovery with retry mechanisms for streaming failures, and centralizes chat rendering logic to ensure UI consistency across the application.

Implementation

The update refactors ChatTextArea.tsx to simplify input handling by removing redundant backspace logic. It introduces a centralized chat-render.ts utility and ReadOnlyChatText component, migrating KiloTaskHeader and TaskItem to use these shared resources. The core Task.ts logic was updated to handle API streaming retries and improve checkpoint management.

Summary By MatterAI MatterAI logo

🔄 What Changed

Release v4.205.0. Implements API retry buttons for failed streams, fixes race conditions in input flags, and centralizes chat rendering via ReadOnlyChatText. It also refines ChatTextArea by removing specific cursor-position backspace logic.

🔍 Impact of the Change

Significantly improves user experience by providing recovery paths for API errors and ensuring a stable, consistent text rendering across chat history and headers. Reduces code duplication by migrating multiple components to a unified renderer.

📁 Total Files Changed

Click to Expand
File ChangeLog
Input Cleanup webview-ui/src/components/chat/ChatTextArea.tsx Removed redundant backspace and cursor position logic to prevent race conditions.
Retry Logic src/core/task/Task.ts Added retry button support and improved checkpoint handling for API streams.
UI Migration webview-ui/src/components/kilocode/KiloTaskHeader.tsx Migrated to use centralized ReadOnlyChatText for consistent rendering.
History Update webview-ui/src/components/history/TaskItem.tsx Updated to utilize the new chat renderer utility.
Render Utility webview-ui/src/utils/chat-render.ts Centralized logic for parsing and rendering chat content.

🧪 Test Added/Recommended

Recommended

  • Verify that removing backspace logic in ChatTextArea does not affect the deletion of mention chips.
  • Regression test for API streaming failures to ensure the retry button appears and functions correctly.

🔒 Security Vulnerabilities

N/A

Screenshots

before after
N/A N/A

How to Test

  1. Open the chat interface and type rapidly to ensure no input lag or race conditions occur with the input flag.
  2. Simulate an API streaming failure and verify the 'Retry' button is visible and functional.
  3. Check KiloTaskHeader and TaskItem in history to ensure text and mentions render correctly using the new shared component.

Get in Touch

N/A

Copy link
Contributor

@matter-code-review matter-code-review bot left a comment

Choose a reason for hiding this comment

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

🧪 PR Review is completed: Found a duplicate code block in ChatTextArea.tsx and a reactivity issue in ReadOnlyChatText.tsx. The retry logic in Task.ts also warrants a closer look regarding blocking user interactions.

Comment on lines +17 to +52
const mentionMapRef = useRef<Map<string, string>>(new Map())

useEffect(() => {
const w = window as any
setMaterialIconsBaseUri(w.MATERIAL_ICONS_BASE_URI)
}, [])

// Build mention map similar to ChatTextArea
useEffect(() => {
mentionMapRef.current.clear()

// Add opened tabs to mention map
openedTabs
.filter((tab) => tab.path)
.forEach((tab) => {
const fullPath = "/" + tab.path
const segments = fullPath.split("/").filter(Boolean)
const filename = segments.pop() || fullPath
mentionMapRef.current.set(filename, fullPath)
})

// Add file paths to mention map (excluding already added opened tabs)
filePaths
.map((file) => "/" + file)
.filter((path) => !openedTabs.some((tab) => tab.path && "/" + tab.path === path))
.forEach((fullPath) => {
const segments = fullPath.split("/").filter(Boolean)
const filename = segments.pop() || fullPath
mentionMapRef.current.set(filename, fullPath)
})
}, [filePaths, openedTabs])

const htmlContent = useMemo(() => {
if (!value) return '<br data-plain-break="true">'
return valueToHtml(value, materialIconsBaseUri, mentionMapRef.current, customModes)
}, [value, materialIconsBaseUri, customModes])
Copy link
Contributor

Choose a reason for hiding this comment

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

🟡 Bug / Reactivity

Issue: mentionMapRef is not reactive. If filePaths or openedTabs change (e.g., user opens a new file), the htmlContent will not re-render to highlight the new file mentions because useMemo does not track ref mutations.

Fix: Use useMemo to derive mentionMap directly, ensuring htmlContent updates when dependencies change.

Impact: Ensures correct syntax highlighting for file mentions as the workspace context changes.

Suggested change
const mentionMapRef = useRef<Map<string, string>>(new Map())
useEffect(() => {
const w = window as any
setMaterialIconsBaseUri(w.MATERIAL_ICONS_BASE_URI)
}, [])
// Build mention map similar to ChatTextArea
useEffect(() => {
mentionMapRef.current.clear()
// Add opened tabs to mention map
openedTabs
.filter((tab) => tab.path)
.forEach((tab) => {
const fullPath = "/" + tab.path
const segments = fullPath.split("/").filter(Boolean)
const filename = segments.pop() || fullPath
mentionMapRef.current.set(filename, fullPath)
})
// Add file paths to mention map (excluding already added opened tabs)
filePaths
.map((file) => "/" + file)
.filter((path) => !openedTabs.some((tab) => tab.path && "/" + tab.path === path))
.forEach((fullPath) => {
const segments = fullPath.split("/").filter(Boolean)
const filename = segments.pop() || fullPath
mentionMapRef.current.set(filename, fullPath)
})
}, [filePaths, openedTabs])
const htmlContent = useMemo(() => {
if (!value) return '<br data-plain-break="true">'
return valueToHtml(value, materialIconsBaseUri, mentionMapRef.current, customModes)
}, [value, materialIconsBaseUri, customModes])
const mentionMap = useMemo(() => {
const map = new Map<string, string>()
// Add opened tabs to mention map
openedTabs
.filter((tab) => tab.path)
.forEach((tab) => {
const fullPath = "/" + tab.path
const segments = fullPath.split("/").filter(Boolean)
const filename = segments.pop() || fullPath
map.set(filename, fullPath)
})
// Add file paths to mention map (excluding already added opened tabs)
filePaths
.map((file) => "/" + file)
.filter((path) => !openedTabs.some((tab) => tab.path && "/" + tab.path === path))
.forEach((fullPath) => {
const segments = fullPath.split("/").filter(Boolean)
const filename = segments.pop() || fullPath
map.set(filename, fullPath)
})
return map
}, [filePaths, openedTabs])
const htmlContent = useMemo(() => {
if (!value) return '<br data-plain-break="true">'
return valueToHtml(value, materialIconsBaseUri, mentionMap, customModes)
}, [value, materialIconsBaseUri, mentionMap, customModes])

@matter-code-review
Copy link
Contributor

✅ Reviewed the changes: Verified the cleanup in ChatTextArea.tsx. The duplicate handleHistoryNavigation block has been removed, resolving the previously identified issue.

@matter-code-review
Copy link
Contributor

Note

PR Review Skipped

PR review skipped as no relevant changes found due to large diff hunk OR part of a non-reviewable file.

📄Files skipped in review
  • undefined: undefined
  • undefined: undefined
  • undefined: undefined
  • undefined: undefined
  • undefined: undefined
  • undefined: undefined
  • undefined: undefined
  • undefined: undefined
  • undefined: undefined
  • undefined: undefined
  • undefined: undefined
  • undefined: undefined
💡Tips to use MatterAI

Command List

  • /matter summary: Generate AI Summary for the PR
  • /matter review: Generate AI Reviews for the latest commit in the PR
  • /matter review-full: Generate AI Reviews for the complete PR
  • /matter release-notes: Generate AI release-notes for the PR
  • /matter : Chat with your PR with MatterAI Agent
  • /matter remember : Generate AI memories for the PR
  • /matter explain: Get an explanation of the PR
  • /matter help: Show the list of available commands and documentation
  • Need help? Join our Discord server: https://discord.gg/fJU5DvanU3

@code-crusher code-crusher merged commit 8a29a1a into main Dec 26, 2025
6 of 13 checks passed
@code-crusher code-crusher deleted the release/v4.205.0 branch December 26, 2025 06:00
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.

2 participants