Skip to content

Conversation

@YuriNachos
Copy link

Fixes #4680

Summary

Previously, the validation logic incorrectly flagged the tool's own required closing marker >>>>>>> REPLACE as a "special marker" in the diff content, causing the error:

ERROR: Special marker '>>>>>>> REPLACE' found in your diff content

This prevented the apply_diff tool from working correctly even when the diff was properly formatted.

Root Cause

The validation checked if lines start with the REPLACE_PREFIX (>>>>>>>) to catch git merge conflict markers, but this also caught the legitimate >>>>>>> REPLACE closing marker that is part of the tool's own syntax.

Changes

  • Modified the validation in validateMarkerSequencing() to exclude the exact >>>>>>> REPLACE marker from the merge conflict check
  • Added condition && marker !== REPLACE to both START and AFTER_SEARCH state checks for REPLACE_PREFIX

This allows the >>>>>>> REPLACE marker to be recognized as the valid closing delimiter for diff blocks while still catching actual git merge conflict markers.

Test Plan

  • All existing tests pass (7386 passed)
  • The fix allows properly formatted diffs to be processed without false positives

Co-Authored-By: Claude [email protected]

Yurii Chukhlib and others added 3 commits January 10, 2026 01:10
Fixes Kilo-Org#4779

Previously, the display path for global skills used "~/.kilocode" which
caused issues on Windows when the AI model tried to read the skill file.
The tilde (~) is not automatically expanded to the home directory on
Windows, resulting in malformed paths like:
  e:\Projects\Temp\test_skill\\~\\.kilocode\skills\skill-creator\SKILL.md

This fix uses `os.homedir()` to get the actual home directory path instead
of using the tilde shorthand. This ensures the path works correctly when
the AI model tries to read the file on all platforms, especially Windows.

Changes:
- Modified `getDisplayPath()` in `skills.ts` to use `os.homedir()` for
  global skills instead of `~/.kilocode`
- Added imports for `os` and `path` modules
- Updated JSDoc comments to reflect the new behavior

Co-Authored-By: Claude <[email protected]>
Fixes Kilo-Org#4703

Previously, the code attempted to access `vscode.lm.selectChatModels`
directly without checking if `vscode.lm` exists. This caused a runtime
error "Cannot read properties of undefined (reading 'selectChatModels')"
when using the vscode-lm provider in CLI context, where the VS Code
Language Model API is not available.

This fix adds checks for `vscode.lm` existence before using it:
1. In `createClient()` - throws a clear error message indicating that
   vscode-lm provider is only available in VS Code extension, not CLI
2. In `getVsCodeLmModels()` - returns an empty array with a warning

Changes:
- Added check in `createClient()` method to throw descriptive error
  when `vscode.lm` is undefined
- Added check in `getVsCodeLmModels()` function to return empty array
  when `vscode.lm` is undefined

Co-Authored-By: Claude <[email protected]>
Fixes Kilo-Org#4680

Previously, the validation logic incorrectly flagged the tool's own
required closing marker `>>>>>>> REPLACE` as a "special marker" in
the diff content, causing the error:

"ERROR: Special marker '>>>>>>> REPLACE' found in your diff content"

This prevented the apply_diff tool from working correctly even when
the diff was properly formatted.

The root cause was that the validation checked if lines start with
the REPLACE_PREFIX (`>>>>>>>`) to catch git merge conflict markers,
but this also caught the legitimate `>>>>>>> REPLACE` closing marker
that is part of the tool's own syntax.

Changes:
- Modified the validation in `validateMarkerSequencing()` to exclude
  the exact `>>>>>>> REPLACE` marker from the merge conflict check
- Added condition `&& marker !== REPLACE` to both START and AFTER_SEARCH
  state checks for REPLACE_PREFIX

This allows the `>>>>>>> REPLACE` marker to be recognized as the valid
closing delimiter for diff blocks while still catching actual git merge
conflict markers.

Co-Authored-By: Claude <[email protected]>
@changeset-bot
Copy link

changeset-bot bot commented Jan 10, 2026

⚠️ No Changeset found

Latest commit: e23992c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

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.

apply_diff False Positive - Validator triggers on tool's own syntax marker

2 participants