Description
Gemma 4 31B gets confused on the Edit tool when it wants to append contents to the end of a file. It will use oldString: "" which has undocumented side effects:
Wait, if I used edit with oldString: "" and newString: "...", did it append? The documentation says "Performs exact string replacements in files." If oldString is empty, maybe it doesn't work as an append.
[Read File ...]
Yes, it completely overwrote the file because I used oldString: "". The tool doesn't append when oldString is empty; it probably matched the start of the file or something. Actually, looking at the output, the entire previous content is gone.
It will then try to restore the file from memory, which includes a long generation prompt (this case removed about 300LOC). I've seen this bug happen 3 times in the same prompt now.
I run Gemma 4 31B Q6 locally through LMStudio with 128K context window.
Plugins
No response
OpenCode version
1.14.18
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
MacOS 15.6 (24G84)
Terminal
No response
Description
Gemma 4 31B gets confused on the Edit tool when it wants to append contents to the end of a file. It will use
oldString: ""which has undocumented side effects:It will then try to restore the file from memory, which includes a long generation prompt (this case removed about 300LOC). I've seen this bug happen 3 times in the same prompt now.
I run Gemma 4 31B Q6 locally through LMStudio with 128K context window.
Plugins
No response
OpenCode version
1.14.18
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
MacOS 15.6 (24G84)
Terminal
No response