Skip to content

fix(skills): use atomic_json_write for LockFile and TapsManager#32233

Closed
sprmn24 wants to merge 1 commit into
NousResearch:mainfrom
sprmn24:fix/skills-hub-atomic-lock-taps
Closed

fix(skills): use atomic_json_write for LockFile and TapsManager#32233
sprmn24 wants to merge 1 commit into
NousResearch:mainfrom
sprmn24:fix/skills-hub-atomic-lock-taps

Conversation

@sprmn24

@sprmn24 sprmn24 commented May 25, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?
LockFile.save() and TapsManager.save() write lock.json and taps.json using write_text(), which is non-atomic. If the process is killed or crashes mid-write (e.g. OOM, SIGKILL, power loss), the target file is left partially written and JSON-corrupt. On the next run load() falls back to an empty default — silently discarding all installed-skill records or all custom taps.

Switches both methods to atomic_json_write from utils, which writes to a temp file, fsyncs, then os.replaces — guaranteeing the old file survives intact if the write doesn't complete.

Type of Change

  • Bug fix

Changes Made

  • tools/skills_hub.py: replace write_text with atomic_json_write in LockFile.save() and TapsManager.save()

How to Test

  1. Add a skill tap: hermes skills hub tap some/repo
  2. Kill -9 the process during the write
  3. Confirm taps.json is not corrupted on next read
  4. Same for hermes skills install → kill → re-run hermes skills list

Checklist

  • Read the Contributing Guide
  • Commit messages follow Conventional Commits
  • Searched for existing PRs to avoid duplicates
  • PR contains only changes related to this fix
  • Tested on: Ubuntu 24.04 (WSL2)
  • No documentation changes needed

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/tools Tool registry, model_tools, toolsets tool/skills Skills system (list, view, manage) duplicate This issue or pull request already exists labels May 25, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #16440 (same fix — atomic writes for LockFile.save() and TapsManager.save() in skills_hub.py). Also overlaps with #29699 and the broader #29019.

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

Labels

comp/tools Tool registry, model_tools, toolsets duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have 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.

2 participants