Skip to content

fix(core): bound watches for symlinked skill files - #55479

Closed
Dante-dan wants to merge 1 commit into
anomalyco:devfrom
Dante-dan:bounded-skill-watch
Closed

Dante-dan wants to merge 1 commit into
anomalyco:devfrom
Dante-dan:bounded-skill-watch

Conversation

@Dante-dan

@Dante-dan Dante-dan commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #55367

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

An individually symlinked SKILL.md can resolve directly into /nix/store. Watching its parent recursively then watches the entire store. Use the existing non-recursive file watcher for that target; keep directory watches when the skill lives inside a symlinked directory so new skills are still discovered.

How did you verify your code works?

  • Skill suite: 11 tests pass, covering target replacement, link retargeting, and directory-symlink discovery.
  • Core bun typecheck, root lint and SDK documentation checks pass. Full typecheck fails in unrelated changelog configuration because @tsconfig/node22/tsconfig.json is missing.
  • The broader watcher suite has native watcher readiness/timeouts on this macOS environment. Linux/Nix inotify counts were not measured locally.

Screenshots / recordings

Not applicable.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #52776

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@opencode-agent opencode-agent 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.

The fix works. I ran the reproduction from #55367 from source. On the base, a SKILL.md symlinked to a file at the top level of a 5,051-folder fake store makes the server watch the whole store recursively: 5,065 inotify watches. With this PR it adds a single file watch on the target, and the server holds 15 watches. The skill tests pass (11 of 11), and the new store test fails against the base code, so it does catch the bug. typecheck passes in packages/core.

Retargeted links are still followed: a file watch is a non-recursive watch on the target's folder, filtered to the file's name, and the skills root is still watched recursively, so it picks up the link being replaced. A skill folder that is itself a symlink to a folder still gets a directory watch, which stays limited to that folder.

Public API: unchanged.

No blocking concerns. This touches the same loop in skill.ts as #55234, which still uses watch(path.dirname(resolved), "directory"). Whichever of the two lands second will need a rebase so this fix isn't lost.

Related: #52776

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

Labels

None yet

Projects

None yet

2 participants