anomalyco / anomalyco/opencode

Edit tool reported success but file content unchanged (parallel Bash+Edit batch)

Open
#44,491 0 comments 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Aug 23, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Version

opencode 1.18.21 (agent build, model x-preview-f-free via provider opencode), Linux.

What happened

During a refactor session, one message contained two parallel tool calls on
two distinct files:

  1. Bash — heredoc rewrite of ~/dotfiles/run_onchange_setup-mcps.sh
  2. Edit — replacing a 4-line const block in ~/dotfiles/scripts/mcp-pins.ts
    (MCP_CONFIG_FILES, dropping the ".mcp.json" entry)

The Edit tool returned:

Edit applied successfully.

…but the file was unchanged. Verified afterwards with sed -n '7,13p' and
git diff scripts/mcp-pins.ts: old content still present, no diff. The failure
only surfaced downstream when tests ran (bun test failed with ENOENT on the
deleted .mcp.json, proving the old const was still live). An identical retry
of the same Edit call then applied correctly and all checks passed.

Expected

Either the edit is applied, or the tool reports an error. A silent success with
no file mutation breaks the trust contract for agentic workflows that rely on
tool results instead of re-reading files after every write.

Suspected cause

Race in concurrent application of batched tool calls (Bash + Edit in the same
assistant message). Single occurrence; no deterministic repro yet. The files
were different, so a file-level lock collision seems unlikely — more likely a
result/write-back ordering issue where the Bash call's success path clobbered or
short-circuited the Edit result propagation.

Reproduction hints
  • Session transcript: opencode storage DB (~/.local/share/opencode/opencode.db,
    table session, id ses_fd0d5ac5dffee8DEEUdFj3Hxgk, directory /home/b3ngous/dotfiles),
    date 2026-08-23.
  • The retry pattern to probe: batch [Bash(write file A), Edit(file B)] in one
    message, then assert file B content.

Transcript de référence : session opencode ses_fd0d5ac5dffee8DEEUdFj3Hxgk
(opencode 1.18.21, dépôt /home/b3ngous/dotfiles, 2026-08-23 ; stockée dans
~/.local/share/opencode/opencode.db, table session).

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.