anomalyco / anomalyco/opencode

bash tool results omit the working directory, leading to pwd/ls loops

Open
#47,308 1 comment 0 reactions 1 assignee View on GitHub

@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
  1. Start a session with GLM 5.3 Flash (also observed with DeepSeek v4).
  2. Have the agent cd into a subdirectory in one bash call, then run further commands in separate calls.
  3. With no cwd in the results, it re-checks pwd/ls repeatedly and can loop.
OpenCode version

1.18.27

Operating System

macOS 26 (Darwin 25.5.0)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.