Repository navigation
fix(windows): keep config backups writable so a read-only config can't block later writes - #44466
Conversation
…ig can't block later writes On Windows, copyFile keeps the read-only attribute, so backing up a read-only config.toml produced a read-only config.toml.bak. Windows refuses to rename over a read-only file, so once the user made the config writable again every later Orca write to it (Codex trust grants, hook and settings writes) failed with EPERM on the backup rename until the attribute was cleared by hand. The backup copy is now made writable before it replaces the old backup, and an existing read-only backup is made writable first. POSIX is unchanged. Fixes STA-16113
…hard-linked backups alone
|
Status: ready Problem: on Windows, a read-only Codex User-facing change: once the config is writable again, writes to it work, and users who are already stuck recover on their next write. Orca's Fixed during review:
Deferred: none. Verified:
|
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Problem
On Windows, if a Codex
config.tomlis read-only when Orca writes it (for example a workspace trust grant at launch), Orca's rolling backup copies the read-only attribute intoconfig.toml.bak. After the user makesconfig.tomlwritable again, every later Orca write to that config fails withEPERM … rename 'config.toml.bak.<pid>.<uuid>.tmp' -> 'config.toml.bak', because Windows won't rename over a read-only file. Codex launches fall back to Codex's own trust prompt, and hook/settings writes to that config keep failing until the user clears the attribute on the.bakby hand. The async hooks-JSON writer (Claude agent-view and theme settings) has its own backup rotation with the same failure. Found in Windows QA for #44244 at ~1,900 worktrees. The bug is the same on main and in stable (v1.4.263).Fix
writeRollingFileBackupandwriteHooksJsonAsync) clear the read-only attribute on the fresh copy before renaming it over the backup.rolling-file-backup.tsgoes up by one (chmodSync). It runs only on Windows, inside the existing synchronous backup copy.Test
rolling-file-backup.win32.test.tsis added to the Windows package job's boundary tests. It has four cases:.bakleft by an earlier version gets replaced;.bakand a read-only hooks JSON.Run on a real Windows machine:
EPERMon the rename.Fixes STA-16113