Skip to content

Robust edit#4199

Closed
shantur wants to merge 2 commits into
anomalyco:devfrom
shantur:robust-edit
Closed

Robust edit#4199
shantur wants to merge 2 commits into
anomalyco:devfrom
shantur:robust-edit

Conversation

@shantur

@shantur shantur commented Nov 11, 2025

Copy link
Copy Markdown
Contributor

Handle cases when model sends edit with line number prefixes

shantur and others added 2 commits November 11, 2025 16:09
Update read and edit tool descriptions to remove line number prefixes.

This makes Gemini behave and almost fixes the bad edits and retries
@shantur shantur mentioned this pull request Nov 11, 2025
@rekram1-node

Copy link
Copy Markdown
Collaborator

what llm was exhibiting this behavior and how often? The edit tool is pretty sensitive and core

@shantur

shantur commented Nov 14, 2025

Copy link
Copy Markdown
Contributor Author

It is Gemini 2.5 mostly. This doesn't change the existing edit tool behaviour just adds another case to handle if the edit comes with line numbers.
All other cases work as usual. From LLM perspective nothing changes its just handled at opencode end.
Tests are added. Just to add I use this patch on my local version and it works fine with Gemini 2.5 Flash, Pro, Codex , GPT, MiniMax, Kimi K2 Thinking, GLM 4.6 and Claude 4, 4.5

All these were used one time or another.

@shantur

shantur commented Nov 14, 2025

Copy link
Copy Markdown
Contributor Author

@rekram1-node ☝️

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