Skip to content

Fix copilot setup when skills install fails#1783

Merged
nathanjmcdougall merged 3 commits into
mainfrom
copilot/fix-copilot-setup-skills-install
Apr 3, 2026
Merged

Fix copilot setup when skills install fails#1783
nathanjmcdougall merged 3 commits into
mainfrom
copilot/fix-copilot-setup-skills-install

Conversation

Copilot AI commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

When skills-lock.json is out of date, npx skills experimental_install mutates the lockfile, and git diff --exit-code fails the entire setup step. This blocks Copilot from working at all, when it should degrade gracefully.

  • Graceful recovery on dirty worktree: Instead of failing, detect the dirty state, delete .agents/skills (stale external skills), revert all changes, and emit a ::warning:: annotation. Local skills (tracked in git) are restored by git checkout .; gitignored external skills stay removed.
  • Add GIT_CONFIG_* env vars: Set core.autocrlf=false per the usethis-skills-external-install skill docs to produce reproducible hashes, reducing false lockfile diffs from the skills CLI bug.
- name: Install external agent skills
  env:
      GIT_CONFIG_COUNT: "1"
      GIT_CONFIG_KEY_0: core.autocrlf
      GIT_CONFIG_VALUE_0: "false"
  run: |
      npx skills experimental_install
      if ! git diff --exit-code --quiet; then
          echo "::warning::skills-lock.json is out of date. Removing installed skills and reverting changes."
          rm -rf .agents/skills
          git checkout .
      fi

Copilot AI and others added 2 commits April 3, 2026 20:35
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/4eae6f6e-af38-472f-b7b4-671eda64b9b3

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
…kflow

Instead of failing the step when skills-lock.json is out of date:
- Emit a warning annotation
- Delete .agents/skills directory (stale external skills)
- Revert all working tree changes
- Continue without failing

Also add GIT_CONFIG_* env vars for reproducible hash computation.

Resolves #1779

Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/4eae6f6e-af38-472f-b7b4-671eda64b9b3

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix copilot setup when skills install fails Fix copilot setup when skills install fails Apr 3, 2026
Copilot AI requested a review from nathanjmcdougall April 3, 2026 20:39
@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review April 3, 2026 20:49
@codecov

codecov Bot commented Apr 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Apr 3, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing copilot/fix-copilot-setup-skills-install (e1dbc85) with main (5d670a6)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (4c9f67a) during the generation of this report, so 5d670a6 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@nathanjmcdougall nathanjmcdougall merged commit d6c172a into main Apr 3, 2026
12 checks passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/fix-copilot-setup-skills-install branch April 3, 2026 21:01
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.

Fix copilot setup when skills install fails

2 participants