Skip to content

fix: detect remote changes by checking repo's default branch first#660

Open
elliotllliu wants to merge 1 commit intovercel-labs:mainfrom
elliotllliu:fix/update-hash-comparison
Open

fix: detect remote changes by checking repo's default branch first#660
elliotllliu wants to merge 1 commit intovercel-labs:mainfrom
elliotllliu:fix/update-hash-comparison

Conversation

@elliotllliu
Copy link
Contributor

Summary

Fixes #484skills update always reported "All skills are up to date" even when the remote had changed.

Root Cause

fetchSkillFolderHash() hardcoded branch order as ['main', 'master']. When a repo uses master as its default branch but also has a main branch, the function returns the stale hash from main instead of checking master where the actual changes were pushed.

Fix

  1. Query the repo's default branch via GitHub API (GET /repos/{owner}/{repo}) and check that branch first
  2. Normalize paths — strip leading ./ for API matching
  3. Truncated tree fallback — when the recursive tree API response is truncated (large repos), walk path segments individually via non-recursive tree lookups

Testing

  • Repos with master as default branch now correctly detect updates
  • Repos with main as default continue to work
  • Repos with non-standard default branches (e.g. develop) are also supported
  • Falls back gracefully if the repo API call fails

`skills update` always reported 'up to date' because
`fetchSkillFolderHash` hardcoded branch order as ['main', 'master'].
When a repo uses 'master' as default but also has a 'main' branch,
the function would return the stale hash from 'main' instead of the
updated hash from 'master'.

Fix: query the GitHub API for the repo's default branch and check
that first. Also adds:
- Leading './' normalization for path matching
- Truncated tree fallback (walk path segments individually)

Fixes vercel-labs#484
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]: npx skills update fails to detect remote changes (always reports 'up to date' for public GitHub repos)

1 participant