You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Infinite clarification/compaction loop on empty git repo #32615
OpenCode can enter a clarification/compaction loop on an empty git repository and burn tokens without making progress. This is both a correctness bug and a cost-control bug.
Why this matters
On a directory that contains only .git/, there is no project context to inspect. The expected behavior is a single short clarification prompt and then idle waiting. Instead, OpenCode can keep re-entering the same "I don't have a clear task / What would you like me to help you with?" flow and trigger compaction again.
That behavior is not just noisy. It can consume a large amount of context and API budget while producing no useful output.
Repository state: only .git/ exists, no source files
Reproduction
Create or open a directory that contains only a .git folder.
Start OpenCode in that directory.
Send a minimal prompt such as teste.
Observe OpenCode respond that the directory is empty / no clear task exists.
Observe repeated clarification prompts and compaction attempts instead of a single pause for user input.
Actual behavior
Clarification prompts repeat instead of stopping
Compaction may fire repeatedly
The session can burn a large number of tokens without any progress
Expected behavior
One short clarification prompt
No compaction loop on an empty repo
No repeated re-entry into the same idle state
Notes
I also observed that compaction.auto = false avoids the loop in my local config, which suggests the failure is in the compaction/empty-context path rather than in the model output itself.
If your issue is distinct from these (e.g. specific to an empty git repo triggering the loop rather than general session state), please add a note clarifying what differentiates it.
opencode debug file list . in /Users/bestoptionnotebook/Projects/teste returns only .git/.
opencode debug scrap recognizes the repo as worktree=/Users/bestoptionnotebook/Projects/teste with vcs=git.
opencode debug config currently resolves compaction.auto=false when set globally.
With compaction.auto=false, a minimal prompt completes normally.
With compaction enabled via config override on the same empty repo, the user-visible behavior is the repeated clarification / compaction loop described above.
Relevant local session data:
Session on the empty repo with a short prompt and compaction disabled completed normally with only ~7.8k input tokens.
Earlier sessions that hit the bad path on the same machine showed ~249k input tokens before aborting / looping.
Separate note: there is also a model-resolution pitfall if the model is passed without the provider prefix. The working identifier in my environment is opencode/deepseek-v4-flash-free.
Activity
Cunhov commentedon Jun 16, 2026
Local measurements:
/Users/bestoptionnotebook/Projects/testecontains only.git/.opencode debug file list .returns only.git/.opencode debug scraprecognizes the repo correctly asworktree=/Users/bestoptionnotebook/Projects/teste.compaction.auto=false, a minimal prompt completes normally.This looks like a failure in the empty-repo / clarification path and should be guarded so it cannot re-enter compaction without new user input.
github-actions commentedon Jun 16, 2026
This issue might be a duplicate of existing issues. Please check:
compaction.auto = falseas a workaround, and this issue reports that same flag is being bypassedIf your issue is distinct from these (e.g. specific to an empty git repo triggering the loop rather than general session state), please add a note clarifying what differentiates it.
Cunhov commentedon Jun 16, 2026
Follow-up with local evidence:
opencode debug file list .in/Users/bestoptionnotebook/Projects/testereturns only.git/.opencode debug scraprecognizes the repo asworktree=/Users/bestoptionnotebook/Projects/testewithvcs=git.opencode debug configcurrently resolvescompaction.auto=falsewhen set globally.compaction.auto=false, a minimal prompt completes normally.Relevant local session data:
Separate note: there is also a model-resolution pitfall if the model is passed without the provider prefix. The working identifier in my environment is
opencode/deepseek-v4-flash-free.github-actions commentedon Aug 16, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.