Skip to content

feat(skills): backport tree-first import (#5753), reconciled with directory picker + batch - #13

Merged
wujunyi792 merged 1 commit into
mainfrom
feat/backport-tree-first-skill-import
Jul 22, 2026
Merged

wujunyi792 merged 1 commit into
mainfrom
feat/backport-tree-first-skill-import

Conversation

@wujunyi792

Copy link
Copy Markdown
Member

Backports upstream #5753 (fix(skills): tree-first skill import to stop 504 on large repos, MUL-5136) and reconciles it with the fork's directory-of-skills picker (#9) + batch endpoint (#10).

What #5753 does

Rewrites the GitHub skill importer to be tree-first: one recursive git/trees request resolves the skill dir and enumerates supporting files, which are then downloaded with bounded concurrency — instead of an N-request per-directory contents crawl that 504'd on large repos. It also threads ctx through every GitHub helper (fetchFromGitHub, fetchFromClawHub, fetchFromSkillsSh, doGitHubAPIGet, resolveGitHubRefAndPath, fetchGitHubDefaultBranch, fetchRawFile, …) and bounds the whole import under importFetchTimeout (45s) so a slow source surfaces a readable error, not a proxy 504.

Reconciliation with the fork's skill work

  • Directory picker (discoverGitHubDirectorySkills): now takes ctx and reuses #5753's fetchGitHubTree (the same one-request tree fetch) instead of its own hand-rolled tree call. The ImportSkill GitHub branch keeps the "container dir → return candidates for the user to pick" fallback, now ctx-threaded.
  • Batch endpoint (skill_import_batch.go): fetchImportedSkillWithRetry threads ctx into the fetchers.
  • Hourly remote-skill sync (skill_sync.go): importSkillFromSource threads ctx into the fetchers.

Verification

  • go build/vet clean; full handler skill/import/sync/batch test suite passes.
  • Live: discovery returns 27 lark sub-skills through the tree-first engine, and a single import of lark-base fetches cleanly (25 files) — i.e. the picker + batch still work end-to-end on top of the new engine.

🤖 Generated with Claude Code

…5136) (#5753)

Rework skills.sh and github.com skill imports around a single recursive
git-tree fetch to stop the 504 on large mono-repos (e.g. api-gateway-skill):

- One tree call replaces the per-directory contents crawl.
- Import caps checked arithmetically from tree metadata before any download
  (fail fast with 413 instead of timing out).
- Most-specific skill-dir resolution; repo root only as a last resort, which
  fixes the root SKILL.md name collision.
- Concurrent downloads (errgroup, limit 8).
- Overall 45s fetch deadline; cancellation is fatal on every supporting-file
  path (tree downloader, crawl listing/recursion/download, ClawHub) so a
  mid-download abort never persists a half-populated bundle.
- A skills.sh tree-fetch failure returns a retryable 503 instead of an unsafe
  root-directory fallback.
- Lenient conventional-path acceptance restored for both complete and truncated
  trees.
- maxImportFileCount 128 -> 256 (aligned daemon cap); 8 MiB bundle cap remains
  the real guard.

(cherry picked from commit 4233e82)
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@wujunyi792, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 321407f4-528f-4319-a359-f88fb2176eec

📥 Commits

Reviewing files that changed from the base of the PR and between c88d0f4 and cbe4036.

📒 Files selected for processing (7)
  • server/internal/daemon/local_skills.go
  • server/internal/handler/agent_template.go
  • server/internal/handler/skill.go
  • server/internal/handler/skill_import_batch.go
  • server/internal/handler/skill_sync.go
  • server/internal/handler/skill_test.go
  • server/internal/service/builtin_skills/multica-skill-importing/SKILL.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/backport-tree-first-skill-import

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@wujunyi792
wujunyi792 merged commit 7d39ca5 into main Jul 22, 2026
6 checks passed
@wujunyi792
wujunyi792 deleted the feat/backport-tree-first-skill-import branch July 22, 2026 12: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.

2 participants