Skip to content

fix(skill-discovery): scan repo-root skills/ directory for bundled skills - #6645

Closed
branben wants to merge 2 commits into
stablyai:mainfrom
branben:fix/bundled-repo-skills-discovery
Closed

branben wants to merge 2 commits into
stablyai:mainfrom
branben:fix/bundled-repo-skills-discovery

Conversation

@branben

@branben branben commented Jun 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Orca ships bundled skills in the repo-root skills/ directory (orchestration, orca-cli, orca-linear, orca-emulator, computer-use) but skill discovery only scanned .claude/skills and .agents/skills at the repo level. The bundled skills were invisible to agents and the Skills settings page, even though onboarding confirmed them — a silent failure where the user thinks skills are installed but the agent never receives them.

Fixes #6639.

Root cause

buildSkillDiscoverySources() in src/main/skills/skill-discovery-sources.ts built the list of scan roots but never included <repo>/skills — the directory where Orca's own bundled skills actually live.

Changes

  • src/main/skills/skill-discovery-sources.ts: Added a repo-level discovery source for <repo>/skills with claude, codex, and agent-skills provider metadata.
  • src/main/skills/discovery.test.ts: Added a test that verifies bundled skills in skills/<name>/SKILL.md are discovered with the correct source kind and provider metadata.

Verification

  • node_modules/.bin/vitest run src/main/skills/discovery.test.ts → 8/8 tests pass (6 existing + 1 new + 1 pre-existing)
  • pnpm typecheck → passes
  • oxlint on changed files → clean

Cross-platform / compatibility notes

  • Uses path.join for the scan root path (cross-platform safe).
  • No SSH/remote-specific behavior — discovery runs locally against registered repo paths, same as the existing .claude/skills and .agents/skills sources.
  • No agent-specific or git-provider-specific behavior. Provider list (claude, codex, agent-skills) matches the union of providers that can consume these bundled skills.
  • No UI changes. No visual change to document.

Code review summary

  • Cross-platform: Safe — uses path.join, no platform-specific logic.
  • SSH/remote/local: No change in behavior across these surfaces; discovery already filters out SSH-backed repos before scanning.
  • Agent/integration compatibility: Provider metadata is additive — existing skills keep their current providers, newly-discovered skills gain the standard set.
  • Performance: Negligible — one additional directory scan per repo, same depth-limited walk as existing sources.
  • Security: No new attack surface; the skills/ directory is part of the trusted repo tree, and the existing depth/symlink guards in discovery.ts apply.

Contributor

X handle: @branben_

ELI5

Bundled skills under the repo-root skills/ folder were never discovered, so agents and Settings thought they were missing. Discovery now scans that directory too.

@coderabbitai

coderabbitai Bot commented Jun 28, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

buildSkillDiscoverySources in skill-discovery-sources.ts now adds a per-repo scan root for repoPath/skills/, using repo-bundled-${stablePathId(repoPath)} and providers ['claude', 'codex', 'agent-skills']. discovery.test.ts adds a case that creates a bundled skills/orchestration directory, runs discoverSkills, and checks that the skill is found with sourceKind: 'repo' and the expected directoryPath.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main skill-discovery change.
Linked Issues check ✅ Passed The PR adds the missing <repo>/skills scan root and a regression test, matching issue #6639's requirements.
Out of Scope Changes check ✅ Passed The changes are limited to skill discovery and its test, with no unrelated code paths added.
Description check ✅ Passed Mostly matches the template with solid summary, testing, review, and compatibility notes; screenshots and a dedicated Security Audit section are the only gaps.

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.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (2)
src/main/skills/skill-discovery-sources.ts (1)

73-76: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Trim this rationale comment to the guideline limit.

Lines 73-76 explain the right constraint, but they are longer than needed here. Keep only the non-obvious why in one or two lines and drop the extra detail/issue link from the inline comment.

Suggested edit
-      // Why: Orca ships bundled skills in the repo-root `skills/` directory
-      // (e.g. skills/orchestration, skills/orca-cli). Without this source,
-      // those skills are invisible to discovery even though onboarding
-      // confirms them. See https://github.com/stablyai/orca/issues/6638.
+      // Why: Orca bundles built-in skills in `<repo>/skills`, so discovery
+      // must scan that root for agents and Settings to see them.

As per coding guidelines, "When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does. Keep comments short — one or two lines, capturing only the non-obvious reason."

Source: Coding guidelines

src/main/skills/discovery.test.ts (1)

148-170: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the duplicated bundled-skill test.

Lines 148-170 repeat Lines 124-146 verbatim, including the test name. That only adds maintenance cost and extra test runtime without increasing coverage.

Suggested edit
-  it('discovers bundled skills in the repo-root skills/ directory', async () => {
-    const root = await mkdtemp(join(tmpdir(), 'orca-skills-'))
-    const home = join(root, 'home')
-    const repo = join(root, 'repo')
-    const bundledSkill = join(repo, 'skills', 'orchestration')
-    await mkdir(bundledSkill, { recursive: true })
-    await writeFile(
-      join(bundledSkill, 'SKILL.md'),
-      ['---', 'name: orchestration', 'description: Multi-agent coordination.', '---', ''].join('\n')
-    )
-
-    const result = await discoverSkills({
-      homeDir: home,
-      cwd: join(root, 'missing-cwd'),
-      repos: [makeRepo(repo)]
-    })
-
-    const skill = result.skills.find((entry) => entry.name === 'orchestration')
-    expect(skill).toBeDefined()
-    expect(skill?.sourceKind).toBe('repo')
-    expect(skill?.providers).toEqual(['claude', 'codex', 'agent-skills'])
-    expect(skill?.directoryPath).toBe(bundledSkill)
-  })

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: bf3c53c8-8917-4a74-9d99-bfd7aac33838

📥 Commits

Reviewing files that changed from the base of the PR and between a278a30 and 03121db2095d3d23dff0418965577ceebb9f937b.

📒 Files selected for processing (2)
  • src/main/skills/discovery.test.ts
  • src/main/skills/skill-discovery-sources.ts

@branben
branben force-pushed the fix/bundled-repo-skills-discovery branch from 03121db to d1726f4 Compare June 28, 2026 20:56
…ills

Orca ships bundled skills in the repo-root `skills/` directory
(orchestration, orca-cli, orca-linear, orca-emulator, computer-use) but
skill discovery only scanned `.claude/skills` and `.agents/skills` at the
repo level. The bundled skills were invisible to agents and the Skills
settings page, even though onboarding confirmed them.

Add a repo-level discovery source for `<repo>/skills` so bundled skills
are discovered with claude, codex, and agent-skills provider metadata.

Fixes stablyai#6639

Co-Authored-By: Claude <[email protected]>

Co-authored-by: Orca <[email protected]>
@branben
branben force-pushed the fix/bundled-repo-skills-discovery branch from d1726f4 to 8199a37 Compare June 28, 2026 20:56
- Trim rationale comment to the guideline limit (two lines, no issue link)
- Remove verbatim duplicate bundled-skill test

Co-Authored-By: Claude <[email protected]>

Co-authored-by: Orca <[email protected]>
@brennanb2025

Copy link
Copy Markdown
Contributor

Taking a look!

@nwparker nwparker added the bug Something isn't working label Jul 27, 2026
@brennanb2025

Copy link
Copy Markdown
Contributor

Thanks for this, and for the clear write-up on #6639 — the problem you reported is real. But I'm going to close this, because discovery isn't the lever that fixes it.

Orca's skill discovery is a display-only inventory: it drives badges, pickers and Settings. It never reaches a launched agent — no prompt injection, no config write, no --skill flag, no file copy. Agents read their own home directories (~/.agents/skills, ~/.claude/skills, …) and never consult Orca. So adding <repo>/skills as a scan root would make Orca display those 8 skills while agents still couldn't load them.

The clearest demonstration: an agent reviewing this branch was Claude Code running inside this repo. skills/ has 8 skills, and it could load only the 4 that also existed in ~/.agents/skills. The scan root wouldn't have changed that.

Worth knowing too — skills/ is where those skills are authored, not a runtime path. config/scripts/generate-skill-bundle-manifest.mjs publishes from it into the release bundle, and npx skills add fetches from GitHub rather than your checkout. The codebase already encodes this: isGlobalOrchestrationSkill returns false for sourceKind === 'repo'.

Two side effects also pushed against landing it. The native-chat $ picker would start offering tokens like $orca-emulator that the agent can't resolve — a new silent failure of the kind #6639 wants removed. And a contributor whose checkout drifts from the running build would get a permanent "needs attention" pill telling them to delete their own skills/ directory (confirmed by running the real freshness inventory, not just reading the code).

What would actually work is getting the repo's skills into a home root — e.g. symlinking ~/.agents/skills/orchestration → <repo>/skills/orchestration, or an install step. Home roots are already scanned, so agents would load them and Orca would show them. I've reframed #6639 around that.

Sorry to close after the work you put in — the diagnosis was sound, it's just that buildSkillDiscoverySources looks exactly like the right place for this and isn't. That distinction wasn't obvious from the code and took an empirical check to pin down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let a local Orca checkout's skills/ be loadable by agents (symlink or dev-install, not discovery)

3 participants