Skip to content

fix(opencode): avoid symlink-loop recursion during skill discovery#18670

Closed
coffeepenbit wants to merge 8 commits into
anomalyco:devfrom
coffeepenbit:fix-skill-symlink-loop
Closed

fix(opencode): avoid symlink-loop recursion during skill discovery#18670
coffeepenbit wants to merge 8 commits into
anomalyco:devfrom
coffeepenbit:fix-skill-symlink-loop

Conversation

@coffeepenbit

@coffeepenbit coffeepenbit commented Mar 22, 2026

Copy link
Copy Markdown

Issue for this PR

Fixes #16188

Type of change

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

What does this PR do?

Skill discovery could recurse indefinitely through symlink loops in external skill directories, which could stall startup and drive runaway memory use. This PR makes the scan cycle-safe by deduplicating visited directories by real path while still allowing symlinked skill roots such as .agents/skills. The fix still allows for skills via symlink.

This may also resolve some startup blank-screen or runaway-RAM reports. I think these also may have been related. I ran into these issues on M4 Pro macOS 15.7.4, causing my laptop to "hard" crash.

How did you verify your code works?

  • Ran bun test test/skill/skill.test.ts in packages/opencode
  • Added a regression test that hangs on the old implementation and passes with this fix
  • Verified the bug is present without the fix: the new regression test times out/hangs on the unfixed code under a guarded timeout
  • Ran a local bun run dev startup check and no longer saw the runaway skill scan behavior

Screenshots / recordings

N/A

Checklist

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

atharvau

This comment was marked as spam.

atharvau

This comment was marked as spam.

atharvau

This comment was marked as spam.

atharvau

This comment was marked as spam.

atharvau

This comment was marked as spam.

@rekram1-node

Copy link
Copy Markdown
Collaborator

@atharvau STOP AI SPAMMING PRs it's incredibly annoying and it helps absolutely no one.

@rekram1-node

Copy link
Copy Markdown
Collaborator

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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.

TUI startup hang/high CPU on macOS when external skills contain symlink cycle

3 participants