fix(skills): survive read-only installed dirs in hub install/uninstall #139904
All Vouch review confidence checks passed
Residual risk 0.29 = Change Risk (0.53) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.53 · 479 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.369
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #139904"
general
weight: 0.35
PRATHAMESH75
What does this PR do?
hermes skills updateaborted the whole run withPermissionErrorwhen an installed skill directory was read-only (r-xr-xr-x— restored backups, mode-preserving copies, Nix/deb-sourced trees): the plainshutil.rmtreeininstall_from_quarantine()raised, and every skill queued after the failing one was skipped.uninstall_skill()crashed the same way.This adds a small
_rmtree_force()helper intools/skills_hub_install.py: on unlink failure it makes the failing path and its parent writable (owner rwx) and retries, mirroring the bundled-sync precedentskills_sync._rmtree_writable(#34860, #34972). It is not imported fromskills_syncbecause that helper's scope guard resolves the root through the sync module's own globals, which the hub paths do not share. Both hub call sites already validate their target with_resolve_lock_install_path()/_check_install_target()before deleting, so the helper adds no scope guard of its own.Related Issue
Fixes #139890
Type of Change
Changes Made
tools/skills_hub_install.py: new_rmtree_force()(chmod-and-retryrmtree);install_from_quarantine()anduninstall_skill()now use it instead of bareshutil.rmtree.tests/tools/test_skills_hub_readonly_install.py(new): regression test. Kept in its own topical file becausetest_skills_hub.pyis over the FILE_LINES target (2186 on main) and may only go down.How to Test
1. On
main, create an installed skill copy with read-only modes (chmod 555dir,chmod 444files) and runhermes skills update— Observed result:PermissionErrorfrominstall_from_quarantine(), subsequent skills skipped.2. With this branch:
python -m pytest tests/tools/test_skills_hub_readonly_install.py -q— 1 passed. Reverting onlytools/skills_hub_install.pytomainmakes it fail withPermissionError(fail-first verified).3. Full related suites:
python -m pytest tests/tools/test_skills_hub.py tests/tools/test_skills_sync.py tests/hermes_cli/test_skills_hub.py tests/tools/test_pr_6656_regressions.py tests/tools/test_skills_hub_readonly_install.py -q— 173 passed, 1 skipped.4.
python scripts/check --only ruff --only health --base upstream/main— ok (0 blocking, 0 advisory).Checklist
Code
pytest tests/ -qand all tests pass. I ran the affected files, not the full suite.python scripts/checkpasses (the blocking lint and code-health checks CI runs)Documentation & Housekeeping
cli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/Aos.chmodclears the Windows read-only attribute forS_IRWXU, and the retry only widens what the already-validated target may do. Verified on macOS; the read-only-dir mechanism is POSIX-specific, Windows takes the plain-success path.The fix and test are adapted from the patch attached to #139890 by @hermes-jeffrolc (co-authored on the fix commit).