forked from mosaicstack/stack
prune_stale_links_in_target compared "$resolved" == "$canonical_real/"* while length-checking only $resolved. If $canonical_real were ever empty the pattern collapses to == "/"* and matches every absolute path. The failure is precisely inverted, which is what makes it worth fixing rather than noting: is_mosaic_skill_name already `continue`s for names that ARE current mosaic skills, so an empty prefix would delete exactly the FOREIGN symlinks in every target directory and preserve the mosaic ones. On this host that is 4 base installs, including codex's own .system entry. Reported by mos-claude as #1087 after I introduced the same guard in the new legacy-cleanup path in the previous commit and walked past this instance thirty lines away. Same defect class, same file, one function apart. $canonical_real is populated by readlink -f after a mkdir -p, so an empty value requires readlink to fail — unlikely, but the consequence is deleting operator symlinks across every harness, which is not a risk worth carrying for one test.