anomalyco / anomalyco/opencode

[BUG] Cyclic symlinks in global skills cause blank TUI and unbounded memory growth

Open
#42,216 2 comments 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Aug 13, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

A cyclic directory symlink inside a global skill causes OpenCode to remain on a completely blank TUI while skill discovery recursively follows the loop.

On macOS, the process stayed alive, logs stopped at message=init, and memory grew to approximately 7.3 GB. Sampling showed a Bun worker repeatedly performing openat calls.

Moving the cyclic symlinks out of ~/.agents/skills fixed the issue immediately. With the same OpenCode binary and project, skill initialization then completed in about one second and the TUI rendered normally.

This appears to be a more severe form of #27027. That report covers large symlink targets and slow startup; this case uses an actual symlink cycle and results in effectively unbounded traversal and memory growth. #27072 has a similar blank-TUI symptom but concerns project file scanning rather than skill discovery.

Expected behavior

OpenCode should detect an already visited directory by real path or filesystem identity, skip the cyclic edge, emit a warning containing the offending path, and continue rendering the TUI.

Actual behavior
  • TUI remains completely blank
  • logs stop at message=init
  • the process continuously traverses files
  • memory usage keeps growing
  • no actionable error identifies the cyclic skill path
Diagnostic result

Following the affected skill tree reproduced recursive path expansion. After removing 16 nested symlinks that formed self and cross-directory cycles, the followed traversal contained only 177 entries and OpenCode logged init count=10 before rendering the full welcome screen.

Plugins

None

OpenCode version

1.18.16, installed with Homebrew

Steps to reproduce

Warning: this can cause rapid memory growth. Run only in a disposable HOME and stop the process promptly.

TEST_HOME=$(mktemp -d)
mkdir -p "$TEST_HOME/.agents/skills/loop-skill"

cat > "$TEST_HOME/.agents/skills/loop-skill/SKILL.md" <<EOF
---
name: loop-skill
description: Reproduce cyclic skill symlink scanning
---
EOF

ln -s "$TEST_HOME/.agents/skills/loop-skill" \
  "$TEST_HOME/.agents/skills/loop-skill/self"

HOME="$TEST_HOME" opencode

The TUI remains blank while the process recursively follows self.

Remove the cyclic link and rerun:

unlink "$TEST_HOME/.agents/skills/loop-skill/self"
HOME="$TEST_HOME" opencode

The TUI renders normally.

Screenshot and/or share link

No screenshot. The blank screen contains no diagnostic text.

Operating System

macOS 26.5.2, Apple Silicon arm64

Terminal

iTerm2 3.6.11, also reproduced in an isolated PTY

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.