Skip to content

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

@ckken

Description

@ckken

Description

opencode can hang on startup with very high CPU usage on macOS when external skills contain a symlink cycle.

In my environment, launching opencode in Terminal shows no usable UI (appears frozen) and process CPU stays very high (300%+ observed), while opencode web and non-TUI commands still work.

Root cause appears to be external skill discovery traversing a symlink loop:

  • /Users/bigo/.emp-agent/skills/empjs -> /Users/bigo/Desktop/Develop/emp-workspace/emp/skills/empjs
  • inside that folder, subpaths point back to ~/.emp-agent/skills/empjs:
    • .agent/skills/empjs -> /Users/bigo/.emp-agent/skills/empjs
    • .agents/skills/empjs -> /Users/bigo/.emp-agent/skills/empjs
    • .shared/skills/empjs -> /Users/bigo/.emp-agent/skills/empjs

With this structure, TUI startup hangs/high-CPU. If I disable external skills, it starts normally.

Plugins

None (user config plugin: []; only internal defaults)

OpenCode version

1.2.17

Steps to reproduce

  1. Ensure there is a symlink cycle in external skills paths (example pattern above).
  2. Run opencode (TUI) in Terminal.
  3. Observe startup appears stuck and .opencode process uses very high CPU for a long time.
  4. Run with workaround:
    • OPENCODE_DISABLE_EXTERNAL_SKILLS=1 opencode
  5. Observe TUI starts immediately and CPU usage is normal.

Screenshot and/or share link

No screenshot; command evidence from local debug:

  • lsof -p <opencode_pid> shows skill directories/symlinked paths being traversed.
  • sample <pid> during hang shows the process busy in repeated filesystem traversal/open calls.

Operating System

macOS 26.2 (arm64)

Terminal

Apple Terminal


Suggested fix ideas:

  • During skills discovery, avoid following symlinks recursively by default; or
  • Track visited inode/realpath to break cycles; and
  • Skip known transient skill helper directories like .agent, .agents, .shared if they are not intended as user skill roots.

Current workaround (works reliably):

  • OPENCODE_DISABLE_EXTERNAL_SKILLS=1 opencode

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions