You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rtk init rewrites existing files with mode 0600, whatever mode they had #4631
atomic_write in src/hooks/init/mod.rs writes the new content to a NamedTempFile in the same directory and renames it over the target. NamedTempFile creates the file with mode 0600, and nothing copies the original file's mode onto it, so every file rtk init rewrites in place loses its group and other permission bits.
$ chmod 644 .agents/rules/antigravity-rtk-rules.md # user content + an appended RTK block
$ rtk init --agent antigravity # with #4335, strips RTK's block
$ stat -c %a .agents/rules/antigravity-rtk-rules.md
600
(Reproduced on #4335's head merged onto develop 7bff768.) Every caller of atomic_write on an existing file behaves the same way: settings.json patches, CLAUDE.md / AGENTS.md patches and the other instruction files. In a checkout shared between users, or one read by an agent running under another uid, the file becomes unreadable to them after rtk init or rtk init --uninstall.
What a fix has to do
When the target already exists, the replacement keeps its mode (on Unix, copy the original permissions onto the temp file before the rename).
A newly created file keeps getting the mode it gets today.
A test that pins it: write a 0644 file, rewrite it through atomic_write, and check the mode is still 0644 (cfg(unix)).
#4335 newly routes a user-owned rules file through atomic_write and waits on this fix before it merges.
atomic_write in src/hooks/init/mod.rs drops existing file permissions to 0600 instead of preserving original mode; fix and add a cfg(unix) regression test.
This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.
📁 Relevant files
src/hooks/init/mod.rs
Suggested Actions
Fix atomic_write to copy the target file's existing permissions onto the temp file before rename (Unix)
Activity
rtk-wshm-sync-bot commentedon Oct 17, 2026
🔍 Automated Triage
bughighSummary
atomic_write in src/hooks/init/mod.rs drops existing file permissions to 0600 instead of preserving original mode; fix and add a cfg(unix) regression test.
📁 Relevant files
src/hooks/init/mod.rsSuggested Actions
Triaged automatically by wshm · This is an automated analysis, not a human review.