Description
Description
When running opencode in headless mode (opencode run "...") from a directory that does not contain a
.git folder, the command exits without printing the assistant's response. No error, no stack trace. it
just produces empty output. The same prompt works fine in interactive mode, and works fine in headless
mode as soon as a .git directory is present.
This suggests headless mode has a code path that depends on being inside a git repository.
Steps to reproduce
- Create a directory with no git repo:
mkdir /tmp/no-git-test && cd /tmp/no-git-test
- Run
opencode in headless mode with the GLM 5.1 model:
opencode run "say hi"
- Observe: command exits with no response from the agent.
- Now initialize git and retry:
git init
opencode run "say hi"
- Observe: it works and prints the response.
Expected behavior
opencode run should print the agent's response regardless of whether the working directory is a git
repository.
Actual behavior
- Headless, no .git → exits silently, no output. ❌
- Headless, with .git → works as expected. ✅
- Interactive mode, no .git → works as expected. ✅
Environment
- opencode version: 1.15.6
- Model / provider: GLM 5.1 (
zai-coding-plan/glm-5.1)
- OS: Linux (kernel 6.8.0)
- Shell: zsh
Plugins
No
OpenCode version
1.15.6
Steps to reproduce
- Create a directory with no git repo:
mkdir /tmp/no-git-test && cd /tmp/no-git-test
- Run
opencode in headless mode with the GLM 5.1 model:
opencode run "say hi"
- Observe: command exits with no response from the agent.
- Now initialize git and retry:
git init
opencode run "say hi"
- Observe: it works and prints the response.
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Description
Description
When running opencode in headless mode (
opencode run"...") from a directory that does not contain a.gitfolder, the command exits without printing the assistant's response. No error, no stack trace. itjust produces empty output. The same prompt works fine in interactive mode, and works fine in headless
mode as soon as a
.gitdirectory is present.This suggests headless mode has a code path that depends on being inside a git repository.
Steps to reproduce
mkdir /tmp/no-git-test && cd /tmp/no-git-testopencodein headless mode with the GLM 5.1 model:opencode run "say hi"Expected behavior
opencode run should print the agent's response regardless of whether the working directory is a git
repository.
Actual behavior
Environment
zai-coding-plan/glm-5.1)Plugins
No
OpenCode version
1.15.6
Steps to reproduce
mkdir /tmp/no-git-test && cd /tmp/no-git-testopencodein headless mode with the GLM 5.1 model:opencode run "say hi"Screenshot and/or share link
No response
Operating System
No response
Terminal
No response