Repository navigation
fix(install): keep a moved skill's record instead of reinstalling it - #513
Conversation
Install records are keyed by path, so a skill moved with mv shows up as missing. "Install missing" (and bare `skillshare install`) then cloned it again at the old path, leaving two copies that both sync to targets, and reconcile could hand the new copy's record to the moved one. A gone record now follows an unrecorded directory of the same name whose files match the recorded hashes, when exactly one such directory exists. Install-from-config skips such entries and reconcile re-keys the record, so the moved copy keeps its source. Same-name skills with other files are left alone, so an update can never overwrite them from that source. Refs: #510
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1116583918
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if _, err := os.Lstat(filepath.Join(sourcePath, filepath.FromSlash(old))); !os.IsNotExist(err) { | ||
| continue |
There was a problem hiding this comment.
Exclude unavailable linked paths from move detection
When the recorded path is beneath a followed source link whose target is temporarily unavailable, Lstat reports IsNotExist even though the reconciliation inventory is marked incomplete. If an identical same-name directory exists elsewhere, this method treats it as the move destination and reconciliation transfers the source metadata; when the link returns, the original skill has lost its record and the duplicate owns it. Defer move matching for entries beneath unavailable links.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 7cef93d. A record whose first-level path component exists but cannot be read (an unavailable source link) is no longer matched as moved; covered by TestMovedEntryKey_IgnoresRecordUnderUnavailableLink.
| existing = store.Get(key) | ||
| store.Remove(key) | ||
| store.Set(fullPath, existing) |
There was a problem hiding this comment.
Preserve audit acknowledgements when re-keying a moved skill
If this skill was previously installed with --force, its accepted audit finding keys are stored in AuditAccepted under the old relative path. Remove(key) deletes those acknowledgements, while the subsequent Set only transfers the entry, so the unchanged skill at its new path is treated as unacknowledged and can block or prompt again on its next audited update. Re-key the associated acknowledgements from the old path to fullPath instead of deleting them.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 7cef93d. Re-keying now goes through MetadataStore.MoveEntry, which carries the accepted audit findings to the new path; TestReconcileGlobalSkills_FollowsMovedSkill asserts it.
Re-keying a moved skill went through Remove, which also drops the audit findings accepted for the old path, so an unchanged skill could block or prompt again on its next update. MoveEntry now carries them to the new key. A record below a first-level source link that cannot be read looks gone to Lstat, so an identical copy elsewhere could take its record while the link was down. Such records are no longer matched as moved.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7cef93da78
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| func (s *MetadataStore) MoveEntry(oldKey, newKey string) { | ||
| entry := s.Entries[oldKey] | ||
| accepted, ok := s.AuditAccepted[filepath.ToSlash(KeyToRelPath(oldKey, entry))] | ||
| s.Remove(oldKey) |
There was a problem hiding this comment.
Delete the legacy-path audit acceptance when moving
For a legacy grouped entry such as key demo with Group: "old", accepted findings are stored under old/demo; line 194 reads that effective path, but Remove(oldKey) deletes only AuditAccepted["demo"], leaving old/demo behind while also adding the new key. If another skill later occupies old/demo, ApplyAcceptedFindings can acknowledge matching audit findings without a new --force. Fresh evidence beyond the prior full-path test is this supported basename-key representation, so delete the effective old path explicitly when re-keying.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in a249b20. MoveEntry now also deletes the accepted findings stored under the old effective path, so a legacy basename key with a group leaves nothing behind; covered by TestMoveEntry_DropsLegacyPathAuditAcceptance.
| continue | ||
| } | ||
| relock = true | ||
| } else if to := movedCopyOf(store, sourcePath, displayName, opts.SourceFollow); to != "" { |
There was a problem hiding this comment.
Apply a newer lock commit at the moved destination
In project mode, when the skill was moved locally but the lockfile has advanced to a newer commit, this branch ignores the nonempty locked value and skips the skill merely because the moved copy matches its old recorded hashes. Reconciliation then re-keys the stale metadata/config entry, and WriteProjectLock sees no pin at the new path and writes the old installed commit there, silently discarding the teammate's newer lock instead of updating the moved copy. Handle the locked-commit mismatch at to before treating the move as a skip.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in a249b20. movedCopyOf now rejects a copy whose installed commit differs from the locked one, so InstallFromConfig falls back to installing the pinned commit and the lock is not rewritten with the older commit; covered by TestMovedCopyOf_IgnoresCopyBehindLock.
A legacy basename key such as `demo` with group `old` keeps its accepted audit findings under `old/demo`. MoveEntry removed only the key's own acceptances, so the old path kept them and a later skill placed there would inherit them without a new --force. It now deletes the old path. When the lockfile pins another commit than the moved copy holds, treating the copy as the moved skill re-keyed its stale record and let the project lock be rewritten with the older commit. Such copies no longer count as a move, so the pinned commit is installed as before.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a249b208d6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return "" | ||
| } | ||
| found := "" | ||
| _ = sourcewalk.WalkDir(sourcePath, sourcewalk.Options{Follow: follow}, func(p string, d os.DirEntry, err error) error { |
There was a problem hiding this comment.
Stop move search at installed skill boundaries
When a missing skill is moved byte-for-byte beneath another installed skill or into a tracked checkout (for example, demo to parent/demo), this unrestricted walk descends into that parent and treats the nested directory as the moved copy. Installation is skipped, but reconcileSkillsWalk stops at the installed parent and never discovers the nested copy, so stale-entry pruning deletes the original metadata and, in project mode, removes the config entry. Apply the same installed-skill/tracked-checkout traversal boundaries here as reconciliation uses before accepting a move.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 90770ca. movedCopyOf now skips installed skills and tracked checkouts, the same boundaries reconcileSkillsWalk stops at, so a copy reconcile cannot see is never taken as the move; covered by TestMovedCopyOf_StopsAtInstalledSkill.
The search for a moved copy walked into installed skills and tracked checkouts, which reconcile skips. A copy found there made install skip the skill, then reconcile never saw the copy and pruned the record, and in project mode the config entry with it. The search now stops at the same boundaries.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 90770ca265
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if d.Name() == path.Base(displayName) { | ||
| if key := store.MovedEntryKey(sourcePath, rel, p, follow); key != "" && store.Entries[key] == entry { | ||
| found = filepath.ToSlash(rel) | ||
| return filepath.SkipAll |
There was a problem hiding this comment.
Check destination ownership before accepting a move
When a missing old/demo has the same hashes as an already-recorded new/demo, this match runs before the installed-skill boundary below, so movedCopyOf incorrectly reports new/demo as the move destination. InstallFromConfig then skips restoring old/demo, while reconciliation retains new/demo's existing record and prunes the old entry, silently dropping the configured skill. Fresh evidence beyond the previous nested-child case is that the store.GetByPath(rel) ownership guard at line 426 is reached only after this candidate has already returned SkipAll; apply that guard before calling MovedEntryKey.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 2428612. MovedEntryKey now rejects a directory that has a record of its own (other than the gone record reached through GetByPath's basename lookup), so both InstallFromConfig and reconcile leave an identical recorded skill alone; covered by TestMovedCopyOf_IgnoresRecordedSkill.
Two identical skills can be recorded at different paths. When one of them went missing, the other matched its hashes and was taken as its moved copy, so install skipped the missing skill and reconcile pruned its record. A directory with a record of its own is now never a move destination.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2428612797
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| _ = sourcewalk.WalkDir(sourcePath, sourcewalk.Options{Follow: follow}, func(p string, d os.DirEntry, err error) error { | ||
| if err != nil || !d.IsDir() || p == sourcePath { | ||
| return nil | ||
| } | ||
| if utils.IsHidden(d.Name()) { | ||
| return filepath.SkipDir | ||
| } | ||
| rel, relErr := filepath.Rel(sourcePath, p) |
There was a problem hiding this comment.
Resolve the source root before deriving relative paths
When the configured skills source is itself a symlink, sourcewalk.WalkDir invokes the callback with paths under the resolved root, but this function compares them and calls filepath.Rel against the unresolved sourcePath. The resulting paths look like ../real-source/..., so the ownership check below can fail to recognize a grouped installed parent and descend into it. An identical nested copy can then be accepted as the move destination; installation is skipped, while reconciliation stops at that parent and subsequently prunes the missing skill's record. Use the same resolved root for the root comparison and relative-path calculation.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 2993340. movedCopyOf now resolves the source root with utils.ResolveSymlink, as reconcileSkillsWalk does, and uses it for the root comparison, Rel and MovedEntryKey. This also fixes the Windows failure in TestMovedCopyOf_IgnoresRecordedSkill, where the runner's short temp path resolved differently; TestMovedCopyOf_StopsAtInstalledSkillUnderLinkedSource covers the linked-source case.
sourcewalk.WalkDir reports paths under the resolved source root, but the moved-copy search took them relative to the unresolved one. With a linked source (or Windows short temp paths) every path came out as ../..., so the installed-skill boundary never matched and a copy inside an installed parent could be taken as the move, after which reconcile pruned the record. The search now resolves the root first, as reconcile does.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2993340155
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| continue | ||
| } | ||
| relock = true | ||
| } else if to := movedCopyOf(store, sourcePath, displayName, opts.SourceFollow, locked); to != "" { |
There was a problem hiding this comment.
Reject moves when the configured source changed
In project mode, the manifest is independent of .metadata.json. If old/demo was recorded from source A, the manifest is changed to source B, and an unchanged copy of A exists at another */demo, this branch accepts that copy because movedCopyOf never checks skill.Source. Installation of B is skipped, and reconciliation then carries source A to the new path and can replace the declarative manifest entry with A. Only treat the directory as a move when the recorded source and other install-defining fields still match the current config entry.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 76c37b6. movedCopyOf now takes the config entry and only accepts a move when the record's source and branch still match it, so a changed manifest source installs as before; covered by TestMovedCopyOf_IgnoresChangedSource.
| if d.Name() == path.Base(displayName) { | ||
| if key := store.MovedEntryKey(root, rel, p, follow); key != "" && store.Entries[key] == entry { | ||
| found = filepath.ToSlash(rel) | ||
| return filepath.SkipAll |
There was a problem hiding this comment.
Check tracked candidates before accepting the move
When the hash-matching destination is itself an unrecorded Git checkout, ComputeFileHashes ignores .git, so this call can accept it as the moved plain skill before the IsTrackedCheckout(p) boundary is evaluated. Reconciliation classifies that directory as tracked and deliberately does not move the old record, causing the skipped plain skill's record—and in project mode its config entry—to be pruned. Fresh evidence after the prior thread is that the current callback still invokes MovedEntryKey before the tracked-checkout check; move that boundary check ahead of candidate acceptance.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 76c37b6. The installed-skill and tracked-checkout boundary now runs before a candidate is considered; covered by TestMovedCopyOf_IgnoresTrackedCheckout.
| if key := store.MovedEntryKey(walkRoot, fullPath, path, walk.Follow); key != "" { | ||
| existing = store.Get(key) | ||
| store.MoveEntry(key, fullPath) | ||
| result.changed = true |
There was a problem hiding this comment.
Require a unique destination before re-keying
If the old path is gone but two unrecorded directories with the same basename and identical hashes exist, the walk immediately assigns the record to whichever candidate is encountered first. After MoveEntry, the old effective path now exists at that first candidate, so the second candidate cannot make the match ambiguous; project reconciliation consequently rewrites the manifest to an arbitrary directory and later updates can overwrite the wrong copy. Confirm that exactly one destination matches before mutating the store.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 76c37b6. reconcileSkillsWalk now collects move candidates during the walk and re-keys only records with exactly one destination after it; movedCopyOf likewise requires a single copy. Covered by TestReconcileGlobalSkills_LeavesAmbiguousMove and TestMovedCopyOf_RequiresSingleCopy.
Three cases still let a move drop or misplace a record: - In project mode the manifest can point a skill at a new source while a copy of the old one exists elsewhere; that copy was taken as the skill, so the new source was never installed. The record's source and branch must now match the config entry. - A git checkout reconcile treats as tracked could be accepted before the tracked boundary was checked; the boundaries now run first. - With two identical copies, reconcile re-keyed the record to whichever it walked first. Both reconcile and the install-from-config search now require exactly one destination, and reconcile decides after the walk.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 76c37b6f33
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| s.Set(newKey, entry) | ||
| if ok { | ||
| s.AuditAccepted[newKey] = accepted |
There was a problem hiding this comment.
Clear stale acknowledgements at the move destination
When newKey already has an AuditAccepted value and the moved entry has no accepted findings, this method leaves the destination value untouched because it only assigns when ok is true. This can occur after a legacy grouped entry is removed but leaves its effective-path acknowledgement behind; moving another skill into that path then causes ApplyAcceptedFindings to acknowledge matching findings that were never accepted for the moved skill. Delete AuditAccepted[newKey] before conditionally transferring the old value.
AGENTS.md reference: AGENTS.md:L25-L28
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 4029c98. MoveEntry now deletes AuditAccepted[newKey] before transferring the moved skill's own acceptances; covered by TestMoveEntry_ClearsStaleAuditAcceptanceAtDestination.
A removed legacy grouped entry can leave findings accepted for its path behind. MoveEntry only wrote the destination when the moved skill had its own acceptances, so a skill moved into that path inherited findings it never accepted. The destination is now cleared before the transfer.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4029c98a26
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if entry == nil || entry.Tracked || len(entry.FileHashes) == 0 || entry.Source != skill.Source || entry.Branch != skill.Branch { | ||
| return "" |
There was a problem hiding this comment.
Require the configured tracking mode to match
When a project entry is changed from a plain install to tracked: true while its old destination is missing and an unchanged plain copy exists elsewhere, this guard still accepts the copy because it checks only entry.Tracked and never skill.Tracked. InstallFromConfig consequently skips installTrackedFromConfig, and reconciliation moves the plain record and rewrites the project entry as untracked. Fresh evidence beyond the earlier source/branch thread is the omitted SkillEntryDTO.Tracked comparison; require the recorded and configured tracking modes to match before accepting a move.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in cb7c43e. The guard is now MetadataEntry.MatchesDeclaration, which also requires neither the record nor the config entry to be tracked; covered by TestMovedCopyOf_IgnoresSkillNowTracked.
| if existing == nil && !tracked { | ||
| if key := store.MovedEntryKey(walkRoot, fullPath, path, walk.Follow); key != "" { | ||
| moves[key] = append(moves[key], fullPath) |
There was a problem hiding this comment.
Respect project declarations during direct reconciliation
In project mode, if old/demo was recorded from source A, its declaration is edited to source B, and an unchanged copy of A exists at new/demo, any unrelated project install that invokes ReconcileProjectSkills directly can enter this source-agnostic move branch. The record from A is moved to new/demo, after which reconcileProjectConfigSkills adds that A entry and removes the user's B declaration. Fresh evidence beyond the prior movedCopyOf thread is that this direct reconciliation path bypasses its source/branch guard entirely; move inference here must also account for the project declaration.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in cb7c43e. reconcileSkillsWalk takes a canMove filter; ReconcileProjectSkills only lets a gone record follow a copy when the manifest still declares it with a matching MatchesDeclaration. Covered by TestReconcileProjectSkills_KeepsChangedDeclarationOnMove, with TestReconcileProjectSkills_FollowsMovedSkill for the matching case.
…atches The install-from-config search compared source and branch but not the tracking mode, so a skill switched to tracked was satisfied by an old plain copy and never cloned. Project reconciliation, which other installs also run, inferred moves without looking at the manifest at all. A record whose declaration now names another source could follow a copy of the old source, after which the manifest entry was rewritten to that old source. Moves in project mode now require the declaration to still match the record, through the same MatchesDeclaration check the install path uses.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb7c43ef2f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if len(dests) != 1 { | ||
| continue | ||
| } | ||
| entry := store.Get(key) | ||
| store.MoveEntry(key, dests[0]) |
There was a problem hiding this comment.
Defer move inference when the source inventory is incomplete
When follow_source_links is enabled and an unrelated followed source link is temporarily unavailable, that link may hide a second identical destination, but this loop still treats the single visible candidate as unique and re-keys the record before walk.Follow.Unavailable() marks the scan incomplete. When the link returns, the record may have been assigned arbitrarily to the visible copy; movedCopyOf has the same incomplete-scan issue during config installation. Fresh evidence beyond the prior unavailable-source-path case is that the unavailable link can conceal another destination rather than the recorded old path itself, so move inference should be deferred whenever the inventory is incomplete.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 368a988. Reconcile applies collected moves only when walk.Follow.Incomplete() is false (pruning already keeps the gone record then), and movedCopyOf returns no match when its walk was incomplete. Covered by TestReconcileGlobalSkills_DefersMoveWhileSourceLinkUnavailable.
An unreadable followed source link can hide a second identical copy, so a copy that looked unique could take the record arbitrarily. Reconcile and the install-from-config search now infer a move only from a complete inventory; reconcile already keeps the gone record in that case.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 368a9885bb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| _ = sourcewalk.WalkDir(root, sourcewalk.Options{Follow: follow}, func(p string, d os.DirEntry, err error) error { | ||
| if err != nil || !d.IsDir() || p == root { | ||
| return nil |
There was a problem hiding this comment.
Treat walk failures as an incomplete move search
When an ordinary directory in the skills source is unreadable or encounters an I/O error, this callback discards the error, while follow.Incomplete() only records failures from followed source links. If one visible directory matches the recorded hashes and the unreadable subtree hides another match, movedCopyOf accepts the visible copy as unique, skips reinstalling the declared path, and reconciliation can re-key the record arbitrarily; reconcileSkillsWalk suppresses the same errors before applying its collected moves. Track any traversal error as an incomplete inventory and reject move inference for that scan.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 9789ea0. reconcileSkillsWalk and movedCopyOf now record any traversal error and infer no move from that scan. TestReconcileGlobalSkills_DefersMoveWhenWalkFails covers it (skipped as root, since root reads mode-000 directories; verified failing before the fix as a non-root user).
Both walks dropped traversal errors, so an unreadable directory that hid a second identical copy left the visible one looking unique and it could take the record. Any walk error now counts as an incomplete inventory, like an unreadable source link, and no move is inferred from it.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9789ea0236
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if len(dests) != 1 || walkFailed || walk.Follow.Incomplete() { | ||
| continue |
There was a problem hiding this comment.
Keep records live when deferring move inference
When two matching destinations are found, or an ordinary traversal error sets walkFailed, this branch skips the move without adding the old key to result.live; because neither condition sets result.incomplete, the caller then prunes the old metadata, and project reconciliation can also remove its manifest entry. The next clean or unambiguous scan can no longer recover the move. Fresh evidence beyond the prior ambiguity/error threads is that their regression tests only assert that no destination received the record and never assert that the original record survives.
Useful? React with 👍 / 👎.
| skill, ok := declared[filepath.ToSlash(install.KeyToRelPath(key, entry))] | ||
| return ok && entry.MatchesDeclaration(skill) |
There was a problem hiding this comment.
Preserve declarations when rejecting stale move records
When a project declaration changes source, branch, or tracking mode while its old directory is missing, this guard correctly rejects a matching copy of the stale record, but the rejected declaration is not marked live; pruneStaleEntries removes the record and reconcileProjectConfigSkills then deletes the user's edited declaration during any direct reconciliation. Fresh evidence beyond the prior thread is that TestReconcileProjectSkills_KeepsChangedDeclarationOnMove checks only that the stale record was not moved and never verifies that the changed declaration remains in cfg.Skills.
Useful? React with 👍 / 👎.
When a walk error deferred a move, the walk still counted as complete, so pruning dropped the gone record along with its accepted audit findings and it could never follow the copy. A failed walk that deferred a move now marks the inventory incomplete, as an unreadable source link does; a failed walk with no move candidate keeps the old behavior. Also correct InstallFromConfig's comments, which still said reconcile runs only after an install.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e24b20fd2d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if onFound != nil { | ||
| onFound(dests[0]) |
There was a problem hiding this comment.
Remove the old gitignore rule when moving a skill
In project mode, when old/demo moves to new/demo, this callback adds the new managed ignore rule, but nothing removes the existing rule for old/demo; ReconcileProjectSkills later calls UpdateGitIgnoreBatch, which only adds entries. If the old path is subsequently reused for source-controlled content, Git continues to ignore it silently. Transfer or remove the old managed rule when re-keying the skill.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in e6024ee. reconcileSkillsWalk now reports the paths records moved away from, and ReconcileProjectSkills removes their managed ignore rules (RemoveFromGitIgnoreBatch, as uninstall does) before adding the new ones; covered by TestReconcileProjectSkills_MovesGitignoreRule.
Project reconcile added the managed ignore rule for a moved skill's new path but left the old one, and the gitignore update only ever adds. If the old path later held source-controlled files, Git kept ignoring them without a word. Reconcile now reports the paths records moved away from, and project reconcile removes their managed rules before adding the new.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6024ee9dc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if hashes, err = ComputeFileHashes(dir, follow); err != nil { | ||
| return "" |
There was a problem hiding this comment.
Treat candidate hash failures as an incomplete search
If one same-name candidate contains an unreadable file or encounters a transient hash I/O error while another candidate is readable and matches, this return silently discards the first candidate without marking the scan incomplete. movedCopyOf and reconcileSkillsWalk can then regard the readable directory as the unique destination, re-key the record, and rewrite the project declaration even though the unreadable directory may be an identical second copy. Unlike traversal errors handled by walkFailed, propagate this hash failure so move inference is deferred for the entire scan.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in fd5a92b. MovedEntryKey now returns the hash error, and both reconcileSkillsWalk and movedCopyOf treat it like a walk error: no move is inferred from that scan, and reconcile keeps the gone record instead of pruning it. Covered by TestMovedEntryKey_ReportsHashFailure.
Windows does not stop reading a directory created with mode 0, and os.Geteuid reports -1 there, so the root-only skip let the test run and fail on the Windows runner.
…e search MovedEntryKey dropped a same-name candidate whose files could not be hashed, so a readable identical copy beside it looked unique and could take the record. It now returns the hash error, and reconcile and the install-from-config search treat it like a walk error: no move is inferred from that scan, and reconcile keeps the record waiting.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fd5a92b7cc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // A record left waiting on a failed walk must not be pruned as gone. | ||
| if walkFailed && len(moves) > 0 { | ||
| result.incomplete = true |
There was a problem hiding this comment.
Mark lone candidate hash failures as incomplete
When the only same-name destination contains an unreadable file, MovedEntryKey sets walkFailed but adds nothing to moves, so this condition leaves result.incomplete false and the caller prunes the missing source record—and, in project mode, its declaration—even though the candidate could not be classified. Fresh evidence after the prior hash-failure thread is this single-candidate case: the added test checks only that MovedEntryKey returns an error, while record preservation still requires a separate readable match to populate moves; mark the scan incomplete whenever candidate hashing fails.
Useful? React with 👍 / 👎.
* chore(main): release 0.25.4 * chore(release): synchronize release metadata * docs(changelog): restore the curated 0.25.4 entry and add #511, #513, #515 Release Please regenerated the entry when #513 landed on main. Restore the user-facing version and describe the three fixes merged since: the skills source named like a tool folder (#511, via #514), the hidden agents source folder (#515) and moved installed skills (#513). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Willie <[email protected]>
* docs(wiki): cap Codex review rounds and require a state matrix before review PR #513 reached 7+ Codex rounds because each round surfaced one more state dimension (project mode, tracked installs, followed links, legacy keys, lock pins) that the change had never listed. Every round costs the maintainer a review cycle. Require a state matrix and a consumer sweep before the first review, separate findings worth code from unrealistic combinations, and stop at three rounds unless a finding shows data loss or a broken supported workflow. * docs(proposals): add move installed skill proposal for #510 Moving an installed skill with mv strands its install record, and the documented workaround (uninstall + install --into) re-downloads and drops audit acceptances and lock pins. Propose one explicit move operation shared by the CLI, the Web API and the dashboard. Records the maintainer decisions: no auto-sync, followed links refused, target filters warn only, whole-folder move in v1, --force limited to name collisions. * fix(proposals): cover nested skills, bare tracked checkouts and duplicate destinations Codex review of the move proposal found three gaps in the folder-move design: - A skill directory that contains nested skills was planned as one skill, so descendants would move on disk but keep their old records, pins and audit acceptances. Plan now expands descendants too. - Refusals were derived from discovered skills only, so a tracked checkout with no discoverable skill would move along with its folder. Preflight now walks the whole tree for checkouts and links. - Two inputs converging on one destination path were treated as a forceable flat-name collision and left the batch half-moved. They are now a separate, non-forceable duplicate_dest refusal. * fix(proposals): keep nested records through reconcile, warn both filter directions, refuse overlapping roots Second Codex round on the move proposal found three more gaps: - The reconcile walk stops at an installed parent and then prunes every record it did not see, so a moved nested skill would lose its record and audit acceptances. Reconcile must keep records below a live installed record. - Target filter warnings only covered rules that stop matching. A move into a folder that an exclude pattern covers (or an include newly adds) changes sync output too, so compare the effective filter result before and after. - Batches such as `move foo foo/sub archive` planned the same subtree twice. Overlapping source roots are now refused before any rename.
Type
proposals/only — see CONTRIBUTING.md)Linked Issue
Refs #510 — fixes the duplicate-copy bug found while triaging it. The issue stays open for the requested
movecommand and folder picker.What was wrong
After moving an installed skill with
mv(e.g.demo→grp/demo):skillshare install) installed the skill again atdemo/. Both copies synced to targets (demoandgrp__demo).grp/demothrough the basename fallback, so the freshdemo/showed up aslocalwith no source.Fix
MetadataStore.MovedEntryKeyfinds the record a directory was moved from: a non-tracked entry with the same name, whose recorded path is gone and whose recorded file hashes match the directory, when exactly one entry matches.InstallFromConfigskips an entry whose skill was moved, and runs reconcile so the record follows.A same-name skill with different files never takes the record, so
updatecannot overwrite the user's own skill from that source.Verification
TestInstallFromConfig_SkipsMovedSkill,TestReconcileGlobalSkills_FollowsMovedSkill,TestReconcileGlobalSkills_IgnoresSameNameSkillWithOtherFiles(the first two failed before the fix).make checkpasses in the devcontainer.a/demo→b/demo, thenPOST /api/install/from-configinstalled nothing, the record moved tob/demowith groupb, andGET /api/install/missingreturned no entries.Not covered
Checklist
make check) — for code changes