anomalyco / anomalyco/opencode

apply_patch silently drops earlier duplicate Update File operations

Open
#48,474 0 comments 2 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Sep 11, 2026.

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

Description

Description

A single apply_patch call with multiple *** Update File: sections for the same path reports success for every section, but only the final section’s changes persist. Earlier updates are computed from the original file and then overwritten during the write phase, while the returned diff incorrectly shows all changes as applied.

This disproportionately affects GPT Astra, which frequently emits multiple Update File sections for the same file in one apply_patch call. The silent loss then causes unnecessary repair turns and token use.

Plugins

none

OpenCode version

1.18.30

Steps to reproduce

Use any gpt model and prompt:

Create a temporary text file with two distinct lines using apply_patch. Then, in a single subsequent apply_patch call, include two separate *** Update File: sections targeting that same file: change the first line in the first section and the second line in the second section. Read the file afterward and report its contents. Do not merge the two edits into one Update File section.

It will drop the first update in this apply_patch call.

Screenshot and/or share link
Image
Operating System

Ubuntu 24.04

Terminal

Ghostty

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.