Skip to content

Windows 1.2.20: Agent edits stop showing Modified Files and /undo does not restore files #16391

@yeyaowei

Description

@yeyaowei

Description

On Windows in 1.2.20, when Agent edits files in a Git repository, the TUI no longer shows Modified Files, and /undo only rewinds the conversation state while leaving the edited files unchanged.

This worked in 1.2.19. I also confirmed locally that reverting commit 74effa8eec01b3cb816178a37921333420fe2d82 on top of 1.2.20 restores the previous behavior.

OpenCode version

1.2.20

Steps to reproduce

  1. On Windows PowerShell, open a Git repository with OpenCode 1.2.20.
  2. Ask the Agent to modify a file.
  3. Observe that the TUI sidebar does not show Modified Files.
  4. Run /undo.
  5. Observe that the conversation rewinds, but the edited file is not restored.

Expected behavior

Agent edits should appear under Modified Files, and /undo should restore the file changes from the last step.

Actual behavior

The sidebar shows no Modified Files, and /undo only rewinds the conversation state.

Screenshot and/or share link

N/A

Operating System

Windows 11

Terminal

PowerShell 7

Additional investigation from a local instrumented build

This section is only diagnostic evidence. It is not required for reproduction.

I added a small local probe to log the worker environment and git detection path:

console.log({
  PATH: process.env.PATH ?? null,
  Path: process.env.Path ?? null,
  which_git: which("git"),
  bun_git: Bun.which("git") ?? null,
  git: await Process.run(["git", "--version"], { nothrow: true }),
})

Relevant result from the worker process:

{
  "PATH": null,
  "Path": "...;C:\\Program Files\\Git\\cmd;...",
  "which_git": null,
  "bun_git": "C:\\Program Files\\Git\\cmd\\git.exe",
  "git": {
    "code": 0,
    "stdout": "git version 2.53.0.windows.1\n"
  }
}

This suggests the regression introduced by 74effa8eec01b3cb816178a37921333420fe2d82:

  • the worker ends up with Path, but not PATH
  • which("git") returns null
  • Bun.which("git") still finds Git
  • git --version still works

That makes project detection fall back to non-git mode, which skips snapshots. Once snapshots are skipped, Modified Files disappears and /undo can no longer restore edited files.

Note: this issue text was generated by GPT 5.4 and reviewed against a local repro.

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)windows

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions