Repository navigation
fix(push): send kept skill edits back and place new resources by active projects (#1020, #1021) - #1022
Merged
Conversation
…warn only for an edited ambiguous copy
…ave unedited copies out
…he first directory holding its name The force-constructed item took the first namespace directory, in directory order, that held the skill's name, so an unchanged svc-a copy pushed with --skill overwrote skills/archive/<name>. It now uses the same recorded-origin rule as the scan, and asks for --role when several namespaces hold a name it never delivered.
|
Findings
Testing
|
…hout the projects manifest - Compare a delivered copy with every inactive namespace holding its name, also when an active namespace has one too, so an edit made before a switch goes back to the namespace it came from. - Resolve a recorded copy only when its recorded version matches exactly one team skill; a lone same-named skill that replaced a deleted one is skipped with a warning, and `push --skill` asks for --role. - Look up the delivery record of `push --skill` under the real path pull records it by. - Stop placing a new resource when projects are active but the team repo has no manifest/projects.yaml, instead of sending it to the shared root.
|
Findings
Resolved
Testing
|
A delivered skill whose record matches no single same-named team skill is skipped wherever those skills are, an open PR is reused only for the same destination, push --skill ties a never-delivered copy only to a skill this directory receives, and unresolved active projects stop a push without --role or --project before anything is scanned.
|
Findings
Resolved
Testing
|
|
Findings
Resolved
Testing
|
|
Findings
Resolved
Testing
|
|
Findings
Resolved
Testing
|
A scan can carry same-named skills for two namespaces. Open-PR bookkeeping keyed records by type and name, so an open PR for one destination claimed the other's edit (dropping it) or the conflict check opened a duplicate PR. Records are now matched by their recorded destination, and a new resource by name. Pruning keeps a record while its name is still scanned. The skip warning for an undelivered copy of a name several namespaces hold now names the `push --skill <path> --role <ns>` run that sends it; the scan never sees --role. The mtime-order scanner test sets the file mtime, which is what decides the newest copy.
|
Findings
Resolved
Testing
|
A new skill awaiting review kept its open PR only while the scan called it new. Once a teammate added a same-named shared-root skill, the scan resolved the copy to that skill as an edit, the open-PR record no longer matched, and a new PR overwrote the shared skill. The copy now takes the destination its open PR recorded, once, before flags and every later step read it. Edits of one team skill from several tools were one candidate only when each copy had a delivery record; otherwise both were written in tool order. Every edit is now keyed by the destination it resolves to, so the newest copy wins and the other is named. A destination one copy proves stays proven whichever copy wins, so --role or --project cannot move it.
|
Findings
Resolved
Testing
|
A record written before the namespace field existed carries only its path. Reusing its branch fell through to placement, which force-pushed the PR to whatever namespace the active project now resolves. Every reader derives the recorded namespace from relativePath, and a resource whose open PR decided its destination, the shared root included, is no longer placed again.
|
Findings
Resolved
Testing
|
An open PR's destination was applied after the scan had already merged copies from several tools by the destination the team tree gave them. A new skill awaiting review in one tool and another tool's edit of a newly shared skill of the same name both resolved to the shared skill, and one was dropped: push either lost the pending edit or sent it over the shared skill. The skills scan now decides each copy's destination once, before any merge, in order of proof: delivery record, open-PR record, team tree. Records whose branch is gone are dropped before the scan; the scan-presence rule still runs after it.
|
Findings
Resolved
Testing
|
Lift resolveDestination to module level so the skills scan and push --skill share one order of proof: delivery record, open-PR record, team tree. A new skill whose name awaits review at several destinations is held back with a warning instead of joining the newest PR; --skill <path> --role <ns> picks one. --skill follows a symlink before naming the skill.
|
Findings
Resolved
Testing
|
|
Findings
Resolved
Testing
|
…paces # Conflicts: # src/resources/base.ts
|
Findings
Resolved
Testing
|
jeff-r2026
approved these changes
Oct 12, 2026
Walternater
pushed a commit
to Walternater/teamai-cli
that referenced
this pull request
Nov 2, 2026
…ve projects (Tencent#1020, Tencent#1021) (Tencent#1022) * fix(push): send kept skill edits back and place new resources by active projects (Tencent#1020, Tencent#1021) * fix(push): keep a kept skill's namespace under --role/--project, and warn only for an edited ambiguous copy * fix(push): tell a kept skill's origin by its recorded version, and leave unedited copies out * fix(push): resolve a --skill copy by its recorded origin instead of the first directory holding its name The force-constructed item took the first namespace directory, in directory order, that held the skill's name, so an unchanged svc-a copy pushed with --skill overwrote skills/archive/<name>. It now uses the same recorded-origin rule as the scan, and asks for --role when several namespaces hold a name it never delivered. * fix(push): trust only a recorded match for a kept skill, and stop without the projects manifest - Compare a delivered copy with every inactive namespace holding its name, also when an active namespace has one too, so an edit made before a switch goes back to the namespace it came from. - Resolve a recorded copy only when its recorded version matches exactly one team skill; a lone same-named skill that replaced a deleted one is skipped with a warning, and `push --skill` asks for --role. - Look up the delivery record of `push --skill` under the real path pull records it by. - Stop placing a new resource when projects are active but the team repo has no manifest/projects.yaml, instead of sending it to the shared root. * fix(push): send a resource only where its origin or namespace is proven A delivered skill whose record matches no single same-named team skill is skipped wherever those skills are, an open PR is reused only for the same destination, push --skill ties a never-delivered copy only to a skill this directory receives, and unresolved active projects stop a push without --role or --project before anything is scanned. * fix(push): constrain unproven namespace selection * fix(push): preserve recorded skill origins across push paths * fix(push): reject delivered skills without a live origin * test(push): cover merge-based skill lifetimes * fix(push): honor exact --skill path selection * fix(push): retain edits by proven skill origin * fix(push): match open PRs by destination, not by skill name A scan can carry same-named skills for two namespaces. Open-PR bookkeeping keyed records by type and name, so an open PR for one destination claimed the other's edit (dropping it) or the conflict check opened a duplicate PR. Records are now matched by their recorded destination, and a new resource by name. Pruning keeps a record while its name is still scanned. The skip warning for an undelivered copy of a name several namespaces hold now names the `push --skill <path> --role <ns>` run that sends it; the scan never sees --role. The mtime-order scanner test sets the file mtime, which is what decides the newest copy. * fix(push): keep one team destination per local skill copy A new skill awaiting review kept its open PR only while the scan called it new. Once a teammate added a same-named shared-root skill, the scan resolved the copy to that skill as an edit, the open-PR record no longer matched, and a new PR overwrote the shared skill. The copy now takes the destination its open PR recorded, once, before flags and every later step read it. Edits of one team skill from several tools were one candidate only when each copy had a delivery record; otherwise both were written in tool order. Every edit is now keyed by the destination it resolves to, so the newest copy wins and the other is named. A destination one copy proves stays proven whichever copy wins, so --role or --project cannot move it. * fix(push): read an open PR's destination from its recorded path A record written before the namespace field existed carries only its path. Reusing its branch fell through to placement, which force-pushed the PR to whatever namespace the active project now resolves. Every reader derives the recorded namespace from relativePath, and a resource whose open PR decided its destination, the shared root included, is no longer placed again. * fix(push): decide each skill copy's destination before merging copies An open PR's destination was applied after the scan had already merged copies from several tools by the destination the team tree gave them. A new skill awaiting review in one tool and another tool's edit of a newly shared skill of the same name both resolved to the shared skill, and one was dropped: push either lost the pending edit or sent it over the shared skill. The skills scan now decides each copy's destination once, before any merge, in order of proof: delivery record, open-PR record, team tree. Records whose branch is gone are dropped before the scan; the scan-presence rule still runs after it. * fix(push): decide a skill copy's destination in one place Lift resolveDestination to module level so the skills scan and push --skill share one order of proof: delivery record, open-PR record, team tree. A new skill whose name awaits review at several destinations is held back with a warning instead of joining the newest PR; --skill <path> --role <ns> picks one. --skill follows a symlink before naming the skill. * fix(push): preserve skill origin through linked paths * docs(push): clarify open-PR namespace selection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1020. Closes #1021.
Summary
Rule: A delivered local copy is resolved against every current same-named team skill: the shared root, all active namespaces, and shadowed or inactive copies. Each local copy remains its own candidate until its recorded origin is proven. Push candidates are keyed by that destination, so edits with different proven destinations are both retained. Flags never prove origin.
--skill <path>selects the exact local copy after resolving~and symlinks; the skill is named after the directory a symlink points to, and messages name the path as given. New, never-delivered skills keep the current name-based deduplication and placement behavior.When multiple edited copies prove the same destination, the newest mtime remains the selected copy; on equal mtimes the tool listed first in
toolPathskeeps it. A different-content copy left out is named with its path; identical content produces no warning.statusscanpush --all--skillresultSKILL.mdSKILL.mdSKILL.mdR8 — open-PR identity. After the scan, a push item is identified by its type plus its team destination (
relativePath). A new, never-delivered resource has no destination until placement, and the scan keeps one per name, so it is identified by name. Every pending record has storedrelativePathsince records were introduced, so records written by earlier versions match the same way. No migration is needed.svc-b/foosvc-a/foo/svc-b/foo/ bothsvc-a/foosvc-a/foo; thesvc-b/fooPR is untouched and stays recordedsvc-b/foosvc-b/fooPR in placesvc-b/fooPR; new PR forsvc-a/fooR9 — one copy, one team destination, decided once. A copy's destination comes from its proof: a delivery record, or an open-PR record. Without proof, it is the destination the team tree gives it. The decision is made in one place:
resolveDestination(src/resources/skills.ts). The skills scan calls it once per local copy, before copies from several tools are merged, andpush --skill <path>calls it for a copy the scan did not return. Both read the team tree through the samereadTeamSkillIndex. Its order is delivery record (R1–R7), then open-PR records (openPrDestinations), then team tree. Callers only word why a copy with no destination is left out;--skillalso refuses a name it would otherwise pick among several team skills, and asks for--role. Every later step reads that destination and none re-derives it: cross-tool candidate dedup, open-PR matching, pruning, the conflict check, grouping, and the namespace for the write.--role/--projectcannot move itskills/platform/foo; another tool holds an edited, delivered copy of a newly sharedskills/fooskills/platform/foo, and the shared-skill edit goes to its own PR. Neither is dropped, whichever is newerSeveral open PRs for one name. An open-PR record proves a destination only when it is the only one: a copy teamai never delivered, whose name open PRs hold at more than one destination absent from the team repo, has no proven destination. It fails closed, like an unproven origin.
push --allpush --skill <path>teamai push --skill <path> --role <ns>run that picks one. The records stay, so the next run holds it back againThe existing selectors name namespaces only; they cannot select a shared-root PR when another same-name destination is open. An open-PR record's destination is read from its
relativePath, which every record has. The optionalnamespacefield is never the only source; records written by earlier versions lack it, and where the two disagree the path wins, because the path is what the PR's branch holds. Every reader derives it the same way, throughrecordedNamespace. A record at the shared root is a destination like any namespace: reusing its PR keeps the resource there, and placement does not move it.skills/svc-a/foo, with or withoutnamespaceplatformskills/svc-a/foorules/foo.md(shared root)platformrules/foo.mdPaths:
SkillsHandler.scanLocalForPushkeeps all current same-named paths for origin proof and emits delivered candidates under their proven team destination.statusandpush --alluse that scanner. Pending-push retention reads the full scan output.--skillselects by canonical local path. Its force-construction path checks the requested copy against all current team counterparts;createSkillPushItemexcludes any recorded copy without a proven origin.Open-PR readers:
planPushGroups(reuse grouping),partiallySelectedEntries,findPendingForItem(the preview's "awaiting review" line),pendingNamespaceFor(reuseRecordedDestinations), and the conflict check all match viaisRecordedItem.Readers of a record's destination namespace all call
recordedNamespace(recorded):pendingNamespaceFor,resolveDestinationand the--skillpath, the conflict check, the shared-root guard for placed rules and agents, and the rule and agent scans that recognise a pending placement.reuseRecordedDestinationsreturns the resources it settled, shared root included, andplaceNewResourcesskips them in both the real run and--dry-run.prunePendingPusheskeeps a record while any item of its name is scanned. That is a superset of destination matches. A record kept longer is used only throughisRecordedItem, while one dropped early would open a duplicate PR, for example after--rolemoves the scanned path.New-skill deduplication in the scan stays by name (R7). Every edit candidate is keyed by its resolved team destination, whether or not that copy has a delivery record (R9). A proven copy that loses on mtime passes its proof to the winner.
resolveDestinationgives a copy with no delivery record, and with an open-PR record of its name whose destination is absent from the team repo, that record's destination; the copy is new there. This runs before the team tree is consulted, so a same-named team skill elsewhere, at the shared root or in an inactive namespace, cannot take the copy over. The merge of copies from several tools is keyed by that destination. From then onisRecordedItemmatches the copy by name, as it does for any new item. The conflict check, the preview, grouping, partial selection andreuseRecordedDestinationsall read that one destination. A record whose destination exists on the team repo is an edit and still matches by path only (R8).--skillon a copy the scan did not return callsresolveDestination, passing the namespace from--roleor--project. It resolves the path withrealpathfirst for the skill name, validation and pushed files. Delivery records are found by comparing real paths, then the lexical path pull wrote is passed toresolveDestination; scan-item matching also compares canonical paths.Pending records are pruned in two steps around the scan, because the scan reads them and the presence rule reads the scan. Before the scan,
dropClosedPendingPushesdrops records whose branch is gone from origin. After it,prunePendingPushesapplies the unchanged name-keyed presence rule (see above). Together they keep exactly the records the single prune kept. A copy that takes a record's destination keeps its name, so its record survives. A copy left out for several open PRs stays in the scan with askipReason, as blocked agents already do, and push drops it before selection with that warning, so both records survive too.teamai statusscans without open-PR records, so its listing is unchanged.Rule and agent scans read pending placements by name. That is their proof: a root copy and its namespaced placement share only a name. The shared-root guard for a placed rule or agent keeps its outcome, which is to leave the copy out and leave the open PR untouched. It never writes to another destination.
A never-delivered copy whose name has several open-PR destinations is skipped when no selector resolves it. The skills scan receives
--role, or the namespace resolved from--project, so it updates a matching PR without warning. If the explicit namespace matches none of the open records, it places the copy in that namespace and leaves the open PRs untouched.Limits:
resolveDestinationreads the clone push has just pulled. When that pull fails, every step of the scan reads the previous pull's tree, so they still agree with each other.teamai statusdoes not read open-PR records and still lists such a copy as an edit of the shared skill. It writes nothing.History proof uses
git log --first-parentfor the current path lifetime. Git's first-parent mode includes each merge's diff against its first parent, and--no-renamestreats renamed paths as separate lifetimes. A shallow clone may prove less history, never more.Evidence
push --all; both team paths appear on the pushed branch.src/__tests__/e2e/push-active-namespaces.test.tsverifies both destinations from two tools in the real CLI.push-active-namespaces.test.ts, "updates the open PR of one destination and opens another"): push thesvc-bedit (branch 1 is recorded), then edit both copies andpush --all.Before (built at the previous head): the preview lists
svc-a/a-skillasawaiting reviewon branch 1, and only one push branch exists afterwards, so thesvc-aedit is dropped.After: branch 1 holds only
skills/svc-b/a-skill/SKILL.md, including the second edit, and a new branch holds onlyskills/svc-a/a-skill/SKILL.md.foois pushed toplatform, a teammate adds a shared-rootskills/foo, then the member editsfooand runspush --all.Before (built at 2cfbd95):
namespacefield, real CLI: a newfoois pushed whileplatformis active, the record is rewritten as an earlier version stored it ({"type":"skills","name":"foo","relativePath":"skills/platform/foo"}), the member switches tosvc-a, editsfoo, and runspush --all.Before (built at 9265e84):
foois pushed from Claude toplatform, and a teammate adds a shared-rootskills/foo. Codex holds a delivered copy of it (written with its delivery record, as pull records one) and edits it; Claude'sfoogets a second edit, and the Codex edit is newer. Thenpush --all.Before (built at 4c55090):
foois pushed from Claude toplatform, edited and pushed with--role svc-a(a second PR). Codex gets its ownfoo, and Claude's gets a third edit. Thenpush --all.Before (built at 941e47a):
f91d0516): the no-selector run still exits 2 naming both PRs. With--skill <path> --role svc-a, the scan emits no ambiguity warning and updates only thesvc-aPR. With--skill <path> --role svc-b, it creates a new branch atskills/svc-b/fooand leaves both existing PR tips unchanged.--skillthrough a symlink, real CLI:alias→elsewhere/my-skill, outside every tool directory, withplatformactive. At951b0bce, the alias name failed validation. Atf91d0516,push --all --skill <alias>pushedskills/platform/my-skill; the alias was not used as the skill name..claude/skills/a-skill, which resolves toskills-store/a-skill. After switching fromsvc-atosvc-b,951b0bcepreviewedskills/svc-b/a-skill;f91d0516previews and pushesskills/svc-a/a-skill, leaving thesvc-bskill untouched. The fixture remote accepts the branch push but uses an invalid example URL for PR creation, so that final API step reports an error.--skillon a copy the scan left out, real CLI: Claude'sfooawaits review atskills/platform/foo, and Codex holds an older copy of its own.push --all --skill .codex/skills/foowarns that the scan skipped that copy for the newer one, then liststo: skills/platform/foo, updates the open PR, and the branch holds the Codex copy. The result is the same at 941e47a and at 951b0bc; this round moved that path ontoresolveDestinationwithout changing its result.push-active-namespaces.test.ts, "push gives each local copy one team destination, whatever its scan status". Each row targets one site and runs through the built CLI and a real git remote:--role platformwith the newer copy unrecorded, in each tool order: newest content lands at the provenskills/svc-a/a-skillskills/platform/a-skillfooawaits review atskills/platform/foo; Codex's delivered copy of a new sharedskills/foois edited; Codex newer, then Claude newer: the open branch holds onlyskills/platform/foowith Claude's edit, and one new branch holds onlyskills/foowith Codex'sskills/platform/foo;skills/foountouchedskills/foofindPendingForItem)--dry-runliststo: skills/platform/fooandawaiting review--role svc-areports the collision withskills/platform/foo, opensskills/svc-a/foo, and leaves the open PR as it was--skillon one of the open PR's two skills warnsOnly part of …and pushesskills/platform/fooskills/fooskills/platform/foo, and the teammate's files on it are untouched--skillforce path, open PR--skillon the older Codex copy the scan left out: the open branch is updated atskills/platform/foowith the Codex copy, aspush --alllists itresolveDestinationpush --allskills/platform/fooandskills/svc-a/foo, copies in Claude and Codex: both branch tips unchanged, one warning per copy naming both PRs, same again on a second run--skillno selector--skill --role svc-aupdates only that PR with no ambiguity warning--skill --role svc-bandpush --all --role svc-bcreate a new branch atskills/svc-b/foo; both existing tips unchanged--skill --role--role svc-a, and--role platform: only that PR is updated, the other tip unchanged--skillsymlink (in "push --skill sends a skill…")my-skillpushesskills/platform/my-skill, nothing namedaliasskills/platform/aliaspendingNamespaceFor)--role svc-a, record withoutnamespace, active project switched toplatform: the open branch is updated in place atskills/svc-a/fooskills/platform/foorules/foo.mdwith no active project, record withoutnamespace, active project switched toplatform: the open branch is updated in place atrules/foo.mdrules/platform/foo.mdpush-pending-pr.test.tsruns {open PR none / exists} × {scansvc-a,svc-b, both in each order} × {current record, record with onlytype/name/relativePath} throughpush(). It asserts the branch each destination lands on and the saved records.Merge Danger
Door: two-way
No delivery-record or pending-record format changes; existing pending records are read as they are. An open-PR record without
namespacegives its namespace through its path.Blast Radius: push
For two edited copies of one proven destination, newest mtime remains the existing choice; a different-content copy left out is now warned about. New, never-delivered skills keep name-based deduplication and placement.
Tests: At merge head
6a0ee5a0c32dbfe178bef04f4643efa991ee92b9,npx tsc --noEmit,npm run lint,npx vitest run(401 files passed, 1 skipped; 8,656 passed, 19 skipped),npm run build, andnpm run test:e2e -- src/__tests__/e2e/push-active-namespaces.test.ts(87 passed) passed.npx vitest run commands-reference -upassed (1 test; no generated diff). A built-CLI temp-HOME run pulled a delivered skill, kept its edit after switching fromsvc-atosvc-b, thenpush --allshowed the edit targetingskills/svc-a/kept-skilland a new skill targetingskills/svc-b/new-skill; the pushed branch contained both. The CLI exited 1 after successfully pushing because the local-path remote in this fixture is not a valid hosted PR URL; the branch contents were verified directly.