fix(skills): address QA round 2

Widen botched-migration guard from "all copies failed" to "any
copies failed" (F2.1). If even one skill fails to copy, the marker
is removed so migration retries on the next launch. Previously,
a partial failure (e.g., 3 of 5 skills copied) would write the
marker, causing the 2 remaining skills to be silently dropped.
This commit is contained in:
Derek Pearson 2026-03-22 14:30:08 -04:00
parent 777c4d9018
commit b09ac9b24d

View file

@ -494,9 +494,10 @@ function migrateSkillsToEcosystemDir(agentDir: string): void {
}
}
// If there were skills to migrate but ALL copies failed, remove the marker
// so migration retries on the next launch. Keeps the legacy dir as fallback.
if (candidates > 0 && migrated === 0) {
// If any skills failed to copy, remove the marker so migration retries
// on the next launch. This keeps the legacy dir as fallback until every
// skill has been successfully migrated.
if (migrated < candidates) {
try { closeSync(markerFd); markerFd = -1 } catch { /* non-fatal */ }
try { unlinkSync(markerPath) } catch { /* non-fatal */ }
return