Skip to content

[Bug] Multiple sequential edits to the same file are lost - only the last one persists (after fix #8513) #25868

Description

@martin-mirantes

What happened?

Description:
After the fix in PR #8513 ("Serialize function calls that mutate state"), the bug of multiple edits on the same file still occurs.

When the model performs multiple sequential edits on the same file (even when each edit is individually accepted with ✓ Edit ... → Accepted), only the last edit is persisted. All previous edits are lost/overwritten.

Steps to Reproduce:

  1. Ask Gemini CLI to make changes to a file (in my case update_prompts_v7.sql)
  2. The model proposes edit 1 → I accept it
  3. The model proposes edit 2 on the same file → I accept it
  4. The model proposes edit 3 on the same file → I accept it
  5. Only the 3rd edit remains. Edits 1 and 2 are gone.

What did you expect to happen?

All accepted edits should be applied sequentially and persist in the file.

Actual behavior:
Only the last accepted edit is kept. Previous edits are discarded.

Client information

  • CLI Version: 0.39.0
  • Git Commit: 398f78d
  • Session ID: 2d20a950-0729-40c7-a778-3d937abf3493
  • Operating System: linux v20.19.2
  • Sandbox Environment: no sandbox
  • Model Version: gemini-3.1-pro-preview
  • Auth Type: oauth-personal
  • Memory Usage: 443.4 MB
  • Terminal Name: Unknown
  • Terminal Background: #1e1e1e
  • Kitty Keyboard Protocol: Unsupported

Login information

No response

Anything else we need to know?

  • I have strong rules in GEMINI.md telling the model to never do multiple edits on the same file and to always plan everything in one edit, but it still happens.
  • This occurs even though each edit is confirmed individually.
  • The problem was supposedly fixed in Serialize function calls that mutate state #8513, but it is still reproducible in April 2026.

References:

This is a critical reliability issue for using Gemini CLI in real development workflows.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stalearea/agentIssues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Qualitykind/bugpriority/p1Important and should be addressed in the near term.status/bot-triaged

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions