fix(skills): safely repair nested self-links - #37
Conversation
Preserve real skill directories and files during ordinary sync. Add an explicit allowlisted nested-self-link repair that validates the entire batch before unlinking and reports partial progress on later failures. Detect this loop topology in the read-only fleet audit, document the scoped owner workflow, and cover preservation, refusals, idempotence, and recurrence with isolated HOME fixtures.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 5:44 PM ET / 21:44 UTC. ClawSweeper reviewWhat this changesThe PR preserves locally owned skill directories during normal synchronization, adds an allowlisted repair for nested self-links, detects the loop in the fleet audit, and adds fixture tests and CI coverage. Merge readinessKeep this owner-authored PR open for normal merge review. The current main baseline still uses the unsafe directory-targeting link operation, while this branch adds a narrowly validated repair and regression coverage. Priority: P2 Review scores
Verification
How this fits togetherThe skill mirror synchronizer projects local skill directories into Claude and Codex discovery roots. Its audit reports drift, while the new scoped repair removes only a verified nested symlink loop without rebuilding the broader mirror. flowchart LR
A[Local skill directories] --> B[Skill mirror synchronizer]
B --> C[Claude skill registry]
B --> D[Codex skill registry]
C --> E[Fleet link audit]
E --> F[Scoped nested-link repair]
F --> C
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the fail-safe conflict behavior and the narrow allowlisted repair, with the documented nonzero conflict outcome as the upgrade contract. Do we have a high-confidence way to reproduce the issue? Yes, at source level: the fetched main helper directly invokes ln -sfn on destination paths, and the supplied fixture describes the resulting nested-directory case. The review did not execute the fixture because the checkout must remain read-only. Is this the best way to solve the issue? Yes. Separating an explicitly allowlisted, topology-validated leaf cleanup from ordinary synchronization is a narrower and safer repair than broad symlink-graph rewriting. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against efa3b2f0f2b4. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Summary
Fix skill mirror synchronization creating nested ancestor loops when a Claude skill is a real directory and its Codex registration points back to that directory. Passing that real directory to
ln -sfncreates a link inside it rather than replacing the destination; the prior top-level audit missed the resulting loop because it still resolved successfully.--repair-nested-self-linksmode with dry-run, whole-batch topology validation, per-unlink revalidation, and no ordinary sync/pruning/instruction-pointer work.Verification
The repair is intentionally limited to the documented nested-self-link topology, not a general symlink graph repair. Filesystem rechecks detect drift but are not an atomic guarantee against concurrent writers.