OpenCode repeatedly executes a command non stop
Description
I have created a commit command (commit.md) I used to automatically create commits. Usually after I am done making changes, I call this command with /commit. Most of the time it works fantastic. However, every once in a while it goes into a loop continuously committing the same thing over and over again. See below my git history
You can see the session just keeps executing the command. It is entirely possible this maybe my command definition or even the model of my choosing, so I apologize if this is not a bug. The screen shot below shows how the command had pushed the code to my git repo, and immediately after that, began the process again.
OpenCode version
1.0.143
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
Linux Debian 12
Terminal
No response
This issue might be a duplicate of existing issues. Please check:
- #3743: Loop in certain models (models getting stuck in loops with repeated tool calling)
- #3458: Duplicate Executions in Kimi K2 Model (model executing same request multiple times)
- #4158: Tool calling when using opencode-skills plugin seem to loop and fail (similar looping behavior with certain models)
Feel free to ignore if none of these address your specific case.
I see this with certain models, id be super surprised if u got this with sonnet 4.5 even if it wss on copilot
any chance u can share session
You are correct. I use different models depending on the task I am doing for this commits I use opencode/grok-code. Note that I usually run some agent using some model, and then call commit. Often times after calling commit, I immediately create a new session to start working on something else, while the older session finishes its work. I don't know if this has something to do or not.
Here is the session. I did an export. Hopefully, this is what you mean.