codex - 💡(How to fix) Fix Undo functionality should never depend on Git repository presence [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#19205Fetched 2026-04-24 05:58:46
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×3commented ×2

Error Message

When attempting to undo changes made by the agent outside of a Git repository, the system shows an error indicating that undo requires a Git repository.

RAW_BUFFERClick to expand / collapse

What variant of Codex are you using?

Codex via VS Code extension (default model, not user-configurable)

What feature would you like to see?

Make "ask" mode the default, require explicit confirmation before applying any file changes, and clearly separate preview from execution to prevent unintended destructive edits.

Additional information

Undo should never depend on Git, especially when the tool can modify files automatically.

<img width="452" height="306" alt="Image" src="https://github.com/user-attachments/assets/f267407e-072d-41bc-84ab-11a9a174df47" />

In addition, undo functionality appears to depend on being inside a Git repository.

When attempting to undo changes made by the agent outside of a Git repository, the system shows an error indicating that undo requires a Git repository.

This is unexpected and problematic. Undo is a fundamental editor feature and should not depend on version control. It is expected to work as a local operation regardless of repository state.

This behavior becomes especially risky in combination with agent mode, which can directly modify or overwrite files.

As a result:

  • Files may be overwritten
  • Undo may be unavailable
  • No reliable recovery path is provided

This creates a real risk of irreversible data loss during normal development workflows.

extent analysis

TL;DR

The issue can be mitigated by ensuring that the Codex extension is used within a Git repository or by exploring alternative undo mechanisms that do not rely on version control.

Guidance

  • Investigate the feasibility of using the Codex extension within a Git repository to enable the undo functionality.
  • Explore alternative undo mechanisms that do not rely on version control, such as local file backups or editor-specific undo features.
  • Consider modifying the Codex extension to use a local operation for undo, rather than relying on Git.
  • Evaluate the risks of using the Codex extension in "ask" mode with explicit confirmation before applying file changes to prevent unintended destructive edits.

Example

No code snippet is provided as the issue does not imply a specific code-based solution.

Notes

The provided solution is limited by the lack of information about the internal workings of the Codex extension and its dependencies on Git for undo functionality. Further investigation is required to determine the best approach.

Recommendation

Apply workaround: Use the Codex extension within a Git repository or explore alternative undo mechanisms to mitigate the risk of irreversible data loss. This is recommended because it allows for a reliable recovery path and prevents unintended destructive edits.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Undo functionality should never depend on Git repository presence [2 comments, 2 participants]