GPT-5 Codex in VSCode: File overwritten into empty bytes after Set-Content replacement — anyone else?

Hi all,

I’ve been using GPT-5 Codex inside VSCode to do code/file replacements.
Sometimes after it applies a patch (e.g., using PowerShell Set-Content to rewrite a file), the file ends up being overwritten into just a few bytes, effectively empty.

This looks like Codex ran a command that failed in the middle, but still executed the final write.

Environment:

  • Extension Identifier: openai.chatgpt

  • Version: 0.4.12

  • Installation Size: 32.61 MB

  • Marketplace Published: 2025-03-06

  • Last Updated / Released: 2025-09-19

Questions:

  • Has anyone else experienced this “empty file” overwrite issue when using GPT-5 Codex in VSCode?

  • Is this a known bug in the Codex VSCode extension, or is it more of a PowerShell side effect?

  • Any recommended safe workflow to prevent data loss (e.g., writing to temp file, auto backup)?

Would love to hear if others ran into the same thing.

Thanks!

me too.. wtf what’s the problem i can’t restore my file