Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@marius-kilocode
Copy link
Collaborator

Summary

During streaming, incomplete diff markers like <<<<, <<<<<<< S, >>>>>>, and ======= were appearing in the CLI diff output. This fix adds comprehensive filtering for all partial/incomplete markers.

Problem

When the CLI displayed diffs during streaming, partial SEARCH/REPLACE markers would appear in the output:

⏺︎ Update( webview-ui/src/i18n/locales/ca/agentManager.json) ⎿ +4, -3
      92 + >>>>>>

⏺︎ Update( webview-ui/src/i18n/locales/es/agentManager.json)
           <<<<

⏺︎ Update( webview-ui/src/i18n/locales/pt-BR/agentManager.json)
           <<<<<<< S

Solution

Added isPartialSearchReplaceMarker() function in cli/src/ui/messages/extension/diff.ts that detects and filters:

  • Partial start markers: <<<<, <<<<<, <<<<<<, <<<<<<< S, etc.
  • Partial end markers: >>>>, >>>>>, >>>>>>, etc.
  • Separator markers: ===, ====, =====, ======, =======
  • Git merge conflict markers: <<<<<<< HEAD, >>>>>>> branch-name, etc.
  • Escaped markers with backslash prefix: \<<<<, \>>>>>>, etc.
  • Markers with leading whitespace: <<<<, <<<<<<< S

The fix applies to both SEARCH/REPLACE format and unified diff format parsing.

Testing

Added comprehensive tests covering:

  • Partial markers in SEARCH/REPLACE format
  • Partial markers in unified diff format (as additions, deletions, and context)
  • Git merge conflict markers
  • Escaped markers with backslash prefix
  • Markers with leading whitespace (exact bug report case)
  • Markers with tabs and spaces

All 2047 CLI tests pass.

@changeset-bot
Copy link

changeset-bot bot commented Jan 19, 2026

🦋 Changeset detected

Latest commit: 638b3a6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@kilocode/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@marius-kilocode marius-kilocode requested a review from a team January 19, 2026 12:57
@marius-kilocode marius-kilocode enabled auto-merge (squash) January 19, 2026 12:58
@kiloconnect
Copy link
Contributor

kiloconnect bot commented Jan 19, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

This PR adds filtering for partial/incomplete SEARCH/REPLACE markers and git merge conflict markers during streaming in the CLI diff display. The implementation is well-structured with:

  1. New isPartialSearchReplaceMarker() function - Detects and filters:

    • Partial markers like <<<<, <<<<<<< S, >>>>>>, ===
    • Git merge conflict markers like <<<<<<< HEAD, >>>>>>> branch-name, =======
    • Escaped markers with backslash prefix
    • Markers with leading whitespace/tabs
  2. Updated parsers - Both parseSearchReplaceFormat() and parseUnifiedDiffFormat() now filter out these markers

  3. New isSearchReplaceFormat() helper - Improved detection of SEARCH/REPLACE format including partial markers during streaming

Strengths

  • Comprehensive test coverage - 450+ lines of new tests covering edge cases from actual bug reports
  • Preserves legitimate content - HTML tags like <div> and comparison operators are not filtered
  • Handles real-world scenarios - Tests include exact cases from bug reports (e.g., markers with indentation, markers appearing as additions)
  • Clean refactoring - Uses continue statements for early returns, improving readability
Files Reviewed (3 files)
  • .changeset/fix-cli-diff-partial-markers.md - Changeset for patch release
  • cli/src/ui/messages/extension/diff.ts - Core implementation (79 lines added)
  • cli/src/ui/messages/extension/__tests__/diff.test.ts - Test coverage (453 lines added)

@marius-kilocode marius-kilocode merged commit 2881689 into main Jan 19, 2026
12 checks passed
@marius-kilocode marius-kilocode deleted the cli-filter-partial-search-markers branch January 19, 2026 14:37
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.

3 participants