Edit Tool issues with Grok Code Fast 1 #2848

Open
opened 2026-02-16 17:37:31 -05:00 by yindo · 11 comments
Owner

Originally created by @daevangelion on GitHub (Nov 13, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

Sourced from my AGENTS.md after my failure analysis workflows did hexdumps of diffs and identified a common failure (30% of edits to python code files have tool control delimiters embedded in them)

Edit Tool Usage Guidelines

Delimiter Conflict Prevention

CRITICAL: The edit tool interprets certain XML/HTML-like tags as control delimiters. Including these tags in content can cause edit operations to fail or corrupt files.

Problematic Tags

The following tags are interpreted as edit tool delimiters and must be avoided in content:

  • </content> - End of content delimiter
  • </parameter - Parameter delimiter
  • </edit> - Edit operation delimiter
  • </file> - File delimiter

Safe Content Inclusion

If you need to include these patterns in code, use character transformation:

# Transform delimiters to safe placeholders
echo '[/content]' | tr '[]' '<>'    # Produces </content> safely
echo '[parameter]' | tr '[]' '<>'   # Produces <parameter> safely

OpenCode version

1.0.63

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

Arch Linux

Terminal

Headless

Originally created by @daevangelion on GitHub (Nov 13, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description Sourced from my AGENTS.md after my failure analysis workflows did hexdumps of diffs and identified a common failure (30% of edits to python code files have tool control delimiters embedded in them) ## Edit Tool Usage Guidelines ### Delimiter Conflict Prevention **CRITICAL**: The edit tool interprets certain XML/HTML-like tags as control delimiters. Including these tags in content can cause edit operations to fail or corrupt files. #### Problematic Tags The following tags are interpreted as edit tool delimiters and must be avoided in content: - `</content>` - End of content delimiter - `</parameter` - Parameter delimiter - `</edit>` - Edit operation delimiter - `</file>` - File delimiter #### Safe Content Inclusion If you need to include these patterns in code, use character transformation: ```bash # Transform delimiters to safe placeholders echo '[/content]' | tr '[]' '<>' # Produces </content> safely echo '[parameter]' | tr '[]' '<>' # Produces <parameter> safely ``` ### OpenCode version 1.0.63 ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System Arch Linux ### Terminal Headless
yindo added the model-problem label 2026-02-16 17:37:31 -05:00
Author
Owner

@rekram1-node commented on GitHub (Nov 13, 2025):

can u show what ur talking about? this seems like the model is calling tools incorrectly?

@rekram1-node commented on GitHub (Nov 13, 2025): can u show what ur talking about? this seems like the model is calling tools incorrectly?
Author
Owner

@daevangelion commented on GitHub (Nov 14, 2025):

yeah it may be, but the tool could do more to hint at the failure mode, often those tags are written to the file in question, the model gets confused because it can't see the change due to the contract hiding it, it then attempts to make multiple edits to correct an "invisible" problem, I have found that intercepting your tool and telling it to look at the hex of the file, or making a blind edit like the one recommended above, it self corrects.

@daevangelion commented on GitHub (Nov 14, 2025): yeah it may be, but the tool could do more to hint at the failure mode, often those tags are written to the file in question, the model gets confused because it can't see the change due to the contract hiding it, it then attempts to make multiple edits to correct an "invisible" problem, I have found that intercepting your tool and telling it to look at the hex of the file, or making a blind edit like the one recommended above, it self corrects.
Author
Owner

@daevangelion commented on GitHub (Nov 14, 2025):

from the session diffs:
" return VOBJ_DATA;\n\n\n(From `src/monitor/vregionctl.c`)</content>\n<parameter name=\"filePath\">docs/references/lib_reference.md"," J_DATA, ARCH_ANY);\n\n// Dump region info\nvregion_dump(r);\n\n<parameter name="filePath">docs/references/kernel_reference.md"

I'd probably just add a detector to identify that condition and as part of the response advise the model

@daevangelion commented on GitHub (Nov 14, 2025): from the session diffs: " return VOBJ_DATA;\n```\n\n(From `src/monitor/vregionctl.c`)</content>\n<parameter name=\"filePath\">docs/references/lib_reference.md"," J_DATA, ARCH_ANY);\n\n// Dump region info\nvregion_dump(r);\n```</content>\n<parameter name=\"filePath\">docs/references/kernel_reference.md" I'd probably just add a detector to identify that condition and as part of the response advise the model
Author
Owner

@taqtiqa-mark commented on GitHub (Nov 27, 2025):

@daevangelion and @rekram1-node I think this may be the same as #4530 .
If you agree, happy to track whichever you prefer.

@taqtiqa-mark commented on GitHub (Nov 27, 2025): @daevangelion and @rekram1-node I think this may be the same as #4530 . If you agree, happy to track whichever you prefer.
Author
Owner

@rekram1-node commented on GitHub (Dec 2, 2025):

It does look related, Ill just leave both open for now

@rekram1-node commented on GitHub (Dec 2, 2025): It does look related, Ill just leave both open for now
Author
Owner

@calebtt commented on GitHub (Jan 30, 2026):

I think this may be related, and it makes the Grok models unusable. Using v1.1.37

→ Read SoundFlowAecTest\SoundFlowAecTest.csproj
← Edit SoundFlowAecTest\SoundFlowAecTest.csproj
Error: oldString not found in content
← Edit SoundFlowAecTest\SoundFlowAecTest.csproj
Error: oldString not found in content
SoundFlowAecTest project created successfully.

@calebtt commented on GitHub (Jan 30, 2026): I think this may be related, and it makes the Grok models unusable. Using v1.1.37 > → Read SoundFlowAecTest\SoundFlowAecTest.csproj > ← Edit SoundFlowAecTest\SoundFlowAecTest.csproj > Error: oldString not found in content > ← Edit SoundFlowAecTest\SoundFlowAecTest.csproj > Error: oldString not found in content > SoundFlowAecTest project created successfully.
Author
Owner

@rekram1-node commented on GitHub (Jan 30, 2026):

@calebtt can you send me a session transcript w/ the tool calls? /export

@rekram1-node commented on GitHub (Jan 30, 2026): @calebtt can you send me a session transcript w/ the tool calls? /export
Author
Owner

@calebtt commented on GitHub (Jan 30, 2026):

@calebtt can you send me a session transcript w/ the tool calls? /export

session markdown is here: https://pastebin.com/Zy6AiGkX

@rekram1-node

@calebtt commented on GitHub (Jan 30, 2026): > [@calebtt](https://github.com/calebtt) can you send me a session transcript w/ the tool calls? /export session markdown is here: https://pastebin.com/Zy6AiGkX @rekram1-node
Author
Owner

@calebtt commented on GitHub (Jan 31, 2026):

Whatever you changed in 1.1.48 works with grok-4-1-fast at a fraction of the cost of ChatGPT Codex. The grok-code-fast-1 model still doesn't work right, however.

For a while, and then you get these lines again:
← Edit NAudioAec.Testbed\MainWindow.xaml.cs
Error: oldString and newString must be different

@calebtt commented on GitHub (Jan 31, 2026): Whatever you changed in 1.1.48 works with grok-4-1-fast at a fraction of the cost of ChatGPT Codex. The grok-code-fast-1 model still doesn't work right, however. For a while, and then you get these lines again: ← Edit NAudioAec.Testbed\MainWindow.xaml.cs Error: oldString and newString must be different
Author
Owner

@taqtiqa-mark commented on GitHub (Feb 1, 2026):

@calebtt, Upgrading to @opencode-ai/sdk/v2 (as shown in script/changelog.ts import and API usage changes) likely added XML entity unescaping in tool argument parsing, partially fixing shell command execution errors with operators like "&&".

See: https://github.com/anomalyco/opencode/blame/c3faeae9d0a71bb6434178f07ba5ac51f348196a/script/changelog.ts#L4

@taqtiqa-mark commented on GitHub (Feb 1, 2026): @calebtt, Upgrading to @opencode-ai/sdk/v2 (as shown in script/changelog.ts import and API usage changes) likely added XML entity unescaping in tool argument parsing, ***partially*** fixing shell command execution errors with operators like "&&". See: https://github.com/anomalyco/opencode/blame/c3faeae9d0a71bb6434178f07ba5ac51f348196a/script/changelog.ts#L4
Author
Owner

@taqtiqa-mark commented on GitHub (Feb 1, 2026):

Also @calebtt if grok-code-fast-1 does not have a reasoning effort parameter it could potentially be a point of difference depending on the model handling logic.... which I have not dug into.

@taqtiqa-mark commented on GitHub (Feb 1, 2026): Also @calebtt if grok-code-fast-1 does not have a reasoning effort parameter it could potentially be a point of difference depending on the model handling logic.... which I have not dug into.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2848