Skip to content

[0.38] fix(install): first upgrade adopts a migrated skill dir for a target sharing it (#4813) - #4868

Merged
Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
danielmeppiel-p2-4813-shared-skill-dir-adoption
Nov 23, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
danielmeppiel-p2-4813-shared-skill-dir-adoption

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The first upgraded apm install -g (from 0.37) skipped an edited user-root skill when the run switched between targets that share a skills directory. Copilot and Codex both deploy to ~/.agents/skills. #4684 adopts lockless 0.37 user-root receipts, but skill_dir_entry resolved the skill directory entry only for targets selected in the current run. A Copilot receipt therefore adopted its member file but not its directory under install -g --target codex, and the directory collision gate skipped the edited skill.

Fix at the owner, src/apm_cli/install/deployed_paths.py skill_dir_entry (called by DeploymentMaterializationSession.adopt_root_receipts):

  • The receipt's own target is resolved at user scope even when it is not selected (KNOWN_TARGETS[name].for_scope(user_scope=True)).
  • Its directory is adopted only for a selected target whose skills destination resolves to the same root, and the entry is attributed to that selected target.
  • A target with a different skills root (Claude, ~/.claude/skills) adopts nothing, and non-skill receipts are unchanged. core/deployment_ledger.py is untouched.

Issue and approved scope

Issue: Fixes #4813

Human scope-approval comment: the accepted record on #4813 (status/accepted, milestone 0.38.0).

This PR completes the issue.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

Local pytest is suspended for this team (rule 17); the evidence is PR CI and ci-integration. Failing-before is shown by reasoning: before this change skill_dir_entry returned no entry when Copilot was not selected. The directory gate then skipped the skill, so the regression's "no skipped", "Version two" and lock-entry assertions all fail. A direct call to the new helper returns ('.agents/skills/research',) for Copilot to Codex, and () for Copilot to Claude and for a non-skill member.

promise: P-INV-I1/I2 -- a first upgraded install -g updates an APM-owned user-root skill and records it, whichever target sharing its directory is selected (source: #4813 record)
cell: OP=install SRC=root-local PRIM=skill SCOPE=user LOCK=absent(0.37 receipt) TGT=copilot->codex   owner: install/deployed_paths.py skill_dir_entry
instrument: today test -> tests/integration/test_user_root_primitives_lockfile_lifecycle.py::test_first_upgrade_switching_to_a_target_sharing_the_skills_dir_updates_it (extends the #3772 module)
oracles: [no skip line, deployed SKILL.md holds the edited source, user lock records .agents/skills/research]
ledger: tests/fixtures/lifecycle_bug_ledger/bugs/4813.json

Lint mirror clean locally: ruff check/format (0.15.12), pylint R0801, lint-auth-signals, complexity ratchet, assertion-quality ratchet, tm006, architecture boundaries, lifecycle generator --check, Mode B (19 lines, under the threshold).

Changelog

  • One fragment per section, changelog.d/<pr>.<section>.md, holding
    one line: user-visible effect first, 25 words or fewer, ending with
    (#PR); breaking changes only under upgrade notes; no Highlights; no
    new lines under ## [Unreleased]. See changelog.d/README.md and
    .github/instructions/changelog.instructions.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • Spec edit
  • Manifest edit
  • Test edit
  • CONFORMANCE.{md,json} regenerated
  • N/A -- this PR does not change OpenAPM-observable behaviour.

apm-spec-waiver: bug fix restoring user-root skill receipt migration; no new OpenAPM behaviour

…tination (#4813)

skill_dir_entry resolved a 0.37 receipt's skill directory only for targets
selected this run, so a first install -g --target codex over a Copilot
receipt (both ~/.agents/skills) adopted the member but not its directory
and skipped the edited skill. The receipt's target is now resolved at user
scope even when unselected, and its directory is adopted, attributed to the
selected target, only when that target deploys skills to the same place.

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel Daniel Meppiel (danielmeppiel) added this to the 0.38.0 milestone Nov 23, 2026
Copilot AI balanced review requested due to automatic review settings November 23, 2026 00:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An uncaught PathTraversalError from a lockless Copilot receipt with a relative COPILOT_HOME can abort an otherwise valid Codex install even though Copilot is not selected.

1 open issue
What changed in this PR

This PR extends the user-root receipt migration from #4684 to address #4813: the first upgrade from 0.37 should update an edited skill when switching between targets that share its deployment directory.

Changes:

  • Resolve the receipt’s original target and adopt its skill directory for a selected target sharing that destination.
  • Add a Copilot-to-Codex lifecycle regression checking updated content, no skips, and lockfile ownership.
  • Record the regression in the lifecycle bug ledger.
File Description
tests/​integration/​test_user_root_primitives_lockfile_lifecycle.py Adds first-upgrade coverage for shared skill directories.
tests/​fixtures/​lifecycle_bug_ledger/​bugs/​4813.json Records the bug and links its regression test.
src/​apm_cli/​install/​deployed_paths.py Adopts migrated skill directories across targets sharing a destination.

Review effort: Balanced

Comment thread src/apm_cli/install/deployed_paths.py Resolved
…pting a skill dir (#4813)

A relative COPILOT_HOME made skill_dir_entry raise PathTraversalError
while resolving the unselected Copilot receipt target, aborting an
otherwise valid install -g --target codex. Resolve it through
scoped_profile_or_none so an inactive, unresolvable profile adopts
nothing.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The new tests leave cross-target receipt rejection and non-skill-member no-adoption behavior unprotected, allowing a destination-equality regression to pass unnoticed.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Add cross-root receipt and non-skill-member controls

tests/​unit/​integration/​test_skills_root_and_target_compat.py:234

The new tests do not exercise a valid receipt whose skills root differs from the selected target's root. Removing the destination-equality check would still pass them while allowing a Copilot receipt to claim a directory under Claude's skills root. Add a Copilot-to-Claude control asserting (), plus a non-skill-member control to protect the helper's no-adoption cases.

1 resolved since last review

Review effort: Balanced

…ill receipts (#4813)

A Copilot receipt adopts nothing under another target's skills root,
outside any skills root, or at a skills-root file; a mutation that
drops the destination-equality check now fails.

apm-spec-waiver: bug fix restoring user-root skill receipt migration; no new OpenAPM behaviour

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the shared-directory receipt migration fix.

No open issues 🎉

Review effort: Balanced

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit a398f69 into main Nov 23, 2026
72 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-p2-4813-shared-skill-dir-adoption branch November 23, 2026 06:50
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 23, 2026
Fold the changelog.d fragments for #4858, #4868, #4870, #4880 and #4908 into [0.38.1].

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] install -g first upgrade skips an edited user-root skill when switching between targets that share a skills dir

2 participants