Skip to content

apply_patch silently drops earlier duplicate Update File operations #48474

Description

@schielc

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions