Repository navigation
docs: review-round limits and move-skill proposal (#510) - #516
Conversation
… 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.
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.
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: e78bc28cc6
ℹ️ 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".
|
|
||
| `Plan(discovered, names, dest, Options) []Planned` resolves and refuses without touching disk. `Run([]Planned, Options) Outcome` applies, with per-item results like `uninstall.Run`. | ||
|
|
||
| A name that resolves to a skill moves that skill. A name that is a folder under the source (and not itself a skill) moves the folder with every skill under it, keeping its base name: `move frontend archive` gives `archive/frontend/...`. `Plan` expands a folder into one `Planned` per skill below it and refuses every one of them before any rename; a single refusal aborts the whole folder, so a folder never ends half-moved. The folder is then renamed once (`Root.Rename`), so empty subfolders and non-skill files move along; the per-skill steps below (store, lock, `.skillignore`, `.gitignore`) run for each skill. |
There was a problem hiding this comment.
Include nested skills in skill-directory moves
When a source contains both foo/SKILL.md and foo/sub/SKILL.md, current discovery reports both because it continues walking after finding a SKILL.md. This design resolves foo as a skill rather than a folder, then renames the entire foo directory while applying metadata, audit-acceptance, lock, and ignore updates only to foo; the descendant skill moves physically but retains its old records and may subsequently lose its pin or audit state during reconciliation. Expand descendant discovered skills for any directory move, or explicitly refuse such a source.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 70ae30b. Plan now expands nested skills below a skill directory (re-keyed with pins and acceptances); added a test case to the Test Plan.
|
|
||
| `Plan(discovered, names, dest, Options) []Planned` resolves and refuses without touching disk. `Run([]Planned, Options) Outcome` applies, with per-item results like `uninstall.Run`. | ||
|
|
||
| A name that resolves to a skill moves that skill. A name that is a folder under the source (and not itself a skill) moves the folder with every skill under it, keeping its base name: `move frontend archive` gives `archive/frontend/...`. `Plan` expands a folder into one `Planned` per skill below it and refuses every one of them before any rename; a single refusal aborts the whole folder, so a folder never ends half-moved. The folder is then renamed once (`Root.Rename`), so empty subfolders and non-skill files move along; the per-skill steps below (store, lock, `.skillignore`, `.gitignore`) run for each skill. |
There was a problem hiding this comment.
Scan folder descendants before renaming
For a folder such as org that contains a normal skill plus org/_team, a tracked checkout whose current revision has no discoverable skills, expanding only the discovered skills creates no planned item for _team. The subsequent single Root.Rename moves that checkout with the folder even though the proposal promises that any folder containing a tracked checkout is refused; the per-skill ancestor check cannot detect descendants. Preflight must inspect the full folder tree for tracked checkouts and protected links before renaming it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 70ae30b. Preflight walks the whole directory tree for tracked checkouts and followed links, not only discovered skills; added a test case for a checkout with no discoverable skill.
|
|
||
| Extract the tracked-repo ancestor loop from `uninstall.checkMoveOut` into an exported helper in `internal/install` (next to `IsTrackedCheckout`) so both packages share it. | ||
|
|
||
| Name collisions: target names are `FlatName` (`grp__demo`) or SKILL.md names, depending on `target_naming`. For each target run `sync.ResolveTargetSkillsForTarget` on the discovered list with the moved skills rewritten, and report `Collisions` that include a moved path. The `flat` branch of that function returns before collision detection (verified, `internal/sync/target_naming.go`), so also compare `FlatName` duplicates directly. A collision does not lose data (sync skips both entries), so `--force` accepts it. That is the only thing `--force` does. |
There was a problem hiding this comment.
Reject converging move destinations even with force
With two supported inputs such as frontend/foo and backend/foo moved to archive, both planned filesystem destinations are archive/foo. Rewriting the discovered list classifies this as a flat-name collision, and this rule lets --force accept it, but it is not merely a target-link collision: after the first rename, the second destination exists and the batch is left partially moved. Detect duplicate planned destination paths separately and make that refusal non-forceable.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 70ae30b. Added a non-forceable duplicate_dest refusal, checked before any rename; flat-name collisions remain the only forceable case.
…cate 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.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70ae30be74
ℹ️ 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".
| Per skill, in this order: | ||
|
|
||
| 1. `sourcefs.MkdirAllIn(source, dest, follow)` (as `handler_install.go` does for `--into`), then `Root.Rename(from, to)` (`internal/sourcefs/sourcefs.go`), with `from` the skill or the folder. Rename already refuses a link component and a rename across a followed link. | ||
| 2. If the skill has a record: `store.MoveEntry(oldKey, to)` from PR #513. `MoveEntry` re-keys the entry and its `AuditAccepted` list but leaves `Group` to the caller. Do not copy reconcile's group snippet: save the store, then run the existing reconcile (`config.ReconcileGlobalSkills` / `ReconcileProjectSkills`), which sets `Group`, prunes, and in project mode rewrites `config.yaml` skills and calls `WriteProjectLock`. |
There was a problem hiding this comment.
Avoid pruning nested records during reconciliation
Fresh evidence after the stated fix is that reconcileSkillsWalk stops descending as soon as it finds an installed parent (internal/config/reconcile_core.go:132-134), while both global and project reconciliation subsequently prune every entry absent from that walk's live set (reconcile_core.go:147-153). Thus after moving foo/SKILL.md with an installed foo/sub/SKILL.md, this proposed reconciliation sees only the re-keyed parent and deletes the descendant record and its audit acceptances despite Plan expanding it. Either teach reconciliation to retain nested moved entries or update the groups/config without invoking this pruning path.
AGENTS.md reference: AGENTS.md:L15-L15
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed against reconcile_core.go (SkipDir at an installed parent, then pruneStaleEntries). Fixed in 951c2ba: step 2 now also changes reconcile to keep records below a live installed record, with its own test.
|
|
||
| Name collisions: target names are `FlatName` (`grp__demo`) or SKILL.md names, depending on `target_naming`. For each target run `sync.ResolveTargetSkillsForTarget` on the discovered list with the moved skills rewritten, and report `Collisions` that include a moved path. Identical destination paths are `duplicate_dest`, checked first, and never reach this step. The `flat` branch of that function returns before collision detection (verified, `internal/sync/target_naming.go`), so also compare `FlatName` duplicates directly. A collision does not lose data (sync skips both entries), so `--force` accepts it. That is the only thing `--force` does. | ||
|
|
||
| Target filters are not rewritten. `include`/`exclude` match flat names (`internal/sync/filter.go`), so a rule naming `demo` stops matching `grp__demo`. Preflight lists target rules matching the old flat name and not the new one as warnings; `sync` already warns on unmatched includes (`UnmatchedInclude.Warning`). |
There was a problem hiding this comment.
Warn when moves newly match target filters
When a target excludes archive__* and demo is moved into archive, no rule matches the old flat name, so this one-directional warning check emits nothing even though the next sync excludes and removes archive__demo from that target. The inverse can also unexpectedly add a skill through an include rule. Compare the effective filter result before and after the move, or check both old→new and new→old matches, so every behavior-changing filter is surfaced.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 951c2ba. Preflight compares each target's effective filter result for the old and new flat name and warns on any difference, in either direction.
|
|
||
| `Plan(discovered, names, dest, Options) []Planned` resolves and refuses without touching disk. `Run([]Planned, Options) Outcome` applies, with per-item results like `uninstall.Run`. | ||
|
|
||
| A name that resolves to a skill moves that skill, plus any skills nested below its directory (discovery keeps walking after a `SKILL.md`, so `foo/SKILL.md` and `foo/sub/SKILL.md` are both discovered; the rename carries both, so both need their records moved). A name that is a folder under the source moves the folder with every skill under it, keeping its base name: `move frontend archive` gives `archive/frontend/...`. `Plan` expands either into one `Planned` per discovered skill below it and refuses every one of them before any rename; a single refusal aborts the whole folder, so a folder never ends half-moved. Because discovery only sees skills, `Plan` also walks the whole directory tree of a skill or folder for `_`-prefixed tracked checkouts (even one with no discoverable skill) and followed links, and refuses on the first. The folder is then renamed once (`Root.Rename`), so empty subfolders and non-skill files move along; the per-skill steps below (store, lock, `.skillignore`, `.gitignore`) run for each skill, and the rename happens once per requested name. |
There was a problem hiding this comment.
Reject overlapping source arguments before execution
For a supported batch such as skillshare move foo foo/sub archive, planning foo already expands and carries foo/sub, while the second argument creates another rename plan for that same subtree. If foo runs first, the second rename fails because its source has moved; if the child runs first, the parent's precomputed descendant metadata and ignore rewrites refer to a destination it no longer creates. duplicate_dest does not catch this because the roots map to archive/foo and archive/sub, so preflight should reject source roots that are equal to or descend from another requested root before any rename.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 951c2ba. Added an overlapping_sources refusal checked before any rename, plus a Test Plan case.
…er 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.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 951c2badb8
ℹ️ 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".
| 4. `.skillignore`: if a literal line equals the old relPath, `skillignore.RemovePattern` + `AddPattern` (`internal/skillignore/write.go`) with the new one. Glob rules are left alone; re-run `sync.DiscoverSourceSkillsAll` and warn when `Disabled` flipped (as `toggleOverrideError` does). | ||
| 5. Project `.gitignore`: swap the old entry for the new one via `config.ProjectGitignoreTarget` + `install.RemoveFromGitIgnoreBatch` (reconcile's `onFound` only adds). Whether project uninstall removes skill lines today is unverified; check before coding. | ||
|
|
||
| The reconcile walk stops at an installed parent (`reconcile_core.go`: `existing.Source != ""` returns `SkipDir`) and `pruneStaleEntries` then drops every record absent from that walk, so a re-keyed nested record under an installed parent would be pruned with its audit acceptances. Step 2 therefore also changes reconcile to keep records whose key lies below a live installed record (own test in `internal/config`), rather than bypassing the prune. |
There was a problem hiding this comment.
Preserve pruning for deleted nested records
Fresh evidence beyond the earlier fix is that this rule keeps every record below a live installed parent without requiring the descendant to still exist. Because reconcileSkillsWalk skips the parent's subtree and pruneStaleEntries trusts only the resulting live set (internal/config/reconcile_core.go:132-153), deleting or updating away a nested installed skill such as foo/sub would now retain its metadata indefinitely; project reconciliation would consequently retain its config.yaml entry and lock pin as well. Mark a descendant live only when its on-disk directory still exists, and add the inverse regression test alongside the retention test.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Valid, and the finding holds: 'keep nested records' must only keep a descendant whose directory still exists, with an inverse test (deleted nested skill is pruned). Three review rounds are done on this docs-only PR, so I am not pushing another fix round; the requirement is recorded in the PR's 'Not covered' section to fold in when the core step is implemented.
Type
proposals/only — see CONTRIBUTING.md)Linked Issue
Refs #510 (the proposal does not close it; implementation PRs will).
What
wiki/pull-requests.md: new "Review Rounds" section. State matrix and consumer sweep before the first Codex review, rule for findings that need unrealistic combinations, stop after three rounds. Motivated by fix(install): keep a moved skill's record instead of reinstalling it #513 reaching 7+ rounds.proposals/510-move-installed-skill.md: proposal forskillshare move(skills and whole folders),POST /api/resources/batch/moveand dashboard entry points, with the maintainer decisions recorded under "Decisions".Checklist
make check) — not applicable, docs onlyVerification
python3 scripts/ai-context.py check: okmake check, website build (no code or website files changed)Not covered
moveitself; this PR is the proposal only.