Skip to content

fix(skills): preserve modes during atomic writes#14410

Open
sgaofen wants to merge 1 commit into
NousResearch:mainfrom
sgaofen:codex/fix-14181-skill-atomic-modes
Open

fix(skills): preserve modes during atomic writes#14410
sgaofen wants to merge 1 commit into
NousResearch:mainfrom
sgaofen:codex/fix-14181-skill-atomic-modes

Conversation

@sgaofen

@sgaofen sgaofen commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #14181.

This preserves file permissions when Hermes rewrites skill runtime files through atomic temp-file replacement.

Root cause

tempfile.mkstemp() creates replacement files as 0600. Both skill_manage writes and bundled skill manifest writes then used os.replace() directly, so existing group-readable/group-writable files could be silently recreated as owner-private files in managed/shared deployments.

Fix

  • Preserve the existing target file mode before replacing SKILL.md or .bundled_manifest.
  • For new files, apply the process umask-derived default file mode instead of leaving the mkstemp() default.
  • Add regressions for skill_manage atomic writes and skills_sync manifest writes preserving 0660 files.

Validation

  • /Users/stephenyu/Documents/hermes-agent/.venv/bin/python -m pytest tests/tools/test_skill_manager_tool.py::TestAtomicWriteText::test_preserves_existing_file_mode tests/tools/test_skills_sync.py::TestReadWriteManifest::test_write_manifest_preserves_existing_file_mode -q --tb=short
  • /Users/stephenyu/Documents/hermes-agent/.venv/bin/python -m pytest tests/tools/test_skill_manager_tool.py tests/tools/test_skills_sync.py -q --tb=short
  • git diff --check

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists tool/skills Skills system (list, view, manage) labels Apr 23, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #14280 — same fix for #14181 (preserve file modes across atomic skill writes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Medium — degraded but workaround exists tool/skills Skills system (list, view, manage) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Managed/shared Hermes runtime: atomic writes recreate SKILL.md and .bundled_manifest as 0600, causing permission-denied failures

2 participants