apply_patch rejects a patch with several hunks for the same file

Offen
#6 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
62/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
cli, python
Bereich
cli, tooling

Rechercherichtung

Start by locating the apply_patch implementation and its patch validation path, then reproduce the reported failure with two hunks targeting one file. Check whether the parser rejects repeated file operations and whether the tool description documents the supported patch shape. Done when the tool accepts the patch or its description clearly guides the model to a valid patch, with a regression check for the reported case.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Release version

v0.3.0

What happened?

The agent's apply_patch tool call is rejected when one patch contains more than one hunk for the same file. The error is:

apply_patch verification failed: invalid patch: multiple operations target <file>

The agent recovers by retrying with separate patches, but each failure costs a turn and tokens. I saw this 3 times across two sessions, each time while the agent edited a single Python file.

Expected: the tool accepts several hunks for one file in one patch. If that is not supported, the tool description should tell the model to group all hunks for a file under one file operation, so the model does not produce the rejected shape.

Steps to reproduce
  1. Start genie exec in a project with a Python file of a few hundred lines.
  2. Ask for two separate edits in different parts of that file in one request.
  3. If the model emits one patch with two operations on the same file, the call fails with the error above.
Environment

macOS (Apple silicon), Genie Code CLI installed with install.sh, Unity Gateway model provider.

Vorherrschende Sprache
Keine Sprachdaten
Sterne
13
Forks
1
Ø Merge
35 Min.
Gemergte PRs (30 T.)
1

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus databricks/genie-code-cli

Alle Issues in databricks/genie-code-cli

Ähnliche Issues

Weitere Issues zu CLI

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.