anomalyco / anomalyco/opencode
bash tool results omit the working directory, leading to pwd/ls loops
@nexxeln is already working on this.
Since Sep 4, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
Bash calls run in a fresh process with cwd reset to the Location, so cd does not persist across calls. Because results never show the working directory, the model infers its location from ls/pwd output — and can misread this as the directory changing between calls, spiraling into repeated pwd/ls checks. Observed with GLM 5.3 Flash, and also reproducible with DeepSeek v4 (same repetition family as #43800 and #45442). The bash tool should echo the resolved working directory in each result so the model has a stable anchor.
Steps to reproduce
- Start a session with GLM 5.3 Flash (also observed with DeepSeek v4).
- Have the agent
cdinto a subdirectory in one bash call, then run further commands in separate calls. - With no cwd in the results, it re-checks
pwd/lsrepeatedly and can loop.
OpenCode version
1.18.27
Operating System
macOS 26 (Darwin 25.5.0)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.