fix: remove misleading hint from replace pos only description#2176
Merged
code-yeongyu merged 1 commit intocode-yeongyu:devfrom Mar 2, 2026
Merged
Conversation
Contributor
|
All contributors have signed the CLA. Thank you! ✅ |
There was a problem hiding this comment.
No issues found across 1 file
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: This is a safe documentation-only change that clarifies tool behavior by removing a misleading hint, posing no risk of functional regression.
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
The hint '(MOST COMMON for single-line edits)' misleads agents into thinking pos-only replace is the default behavior. When agents want to replace multiple lines but only specify pos without end, the tool only replaces one line, causing duplicate code from retained lines.
1673b28 to
c1eaf5f
Compare
4 tasks
dorgonman
pushed a commit
to kanohorizonia/oh-my-opencode
that referenced
this pull request
Mar 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When an agent uses the
replaceoperation withposonly (withoutend) but provides multi-line content inlines, the tool only replaces a single line. This causes subsequent lines from the original file to be retained, resulting in duplicate code.Root Cause
The tool description contains a misleading hint: "(MOST COMMON for single-line edits)". This misleads agents into thinking that pos-only replace is the default/recommended approach, even when they need to replace multiple lines.
Concrete Example
Original file (3 lines):
Agent intends to replace with (4 lines):
Agent constructs:
{ "op": "replace", "pos": "1#ZV", "lines": "export function cn(...inputs: string[]) {\n // test comment\n return inputs.join(' ');\n}" }What happens:
endspecified → usesapplySetLine()(single-line replacement)splice(line - 1, 1, ...replacement)— deletes 1 line, inserts 4 linesActual output (6 lines):
Solution
Remove the misleading hint from the tool description. Agents should understand that:
posonly → replaces exactly one linepos+end→ replaces the entire rangeReproduction Steps
pos-onlyreplace, passing 4 lines in thelinesparameter