fix(cli): missing plugin deps cause TUI to black screen by elithrar · Pull Request #14432 · anomalyco/opencode

Issue for this PR

Closes #14433

Type of change

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

What does this PR do?

When a plugin dependency can't be resolved (e.g. node_modules missing for @opencode-ai/plugin), the import() in plugin loading throws. State.create() caches the rejected promise, every subsequent API request fails, and the TUI stalls on a black screen indefinitely. In non-interactive mode (opencode run --print-logs) the error surfaces in logs, but TUI mode gives zero feedback.

  • wrap import(plugin) and plugin init in .catch() so a broken plugin is skipped instead of crashing the whole state() initializer
  • catch internal plugin init failures (CodexAuth, CopilotAuth, GitlabAuth) with .catch() + log
  • unify builtin and non-builtin install failure handling — all install failures log, publish Session.Event.Error for the TUI, and continue
  • extract the underlying .cause from BunInstallFailedError so the user-facing message includes the real failure reason
  • log bun install failures in config.ts installDependencies instead of swallowing with .catch(() => {})

After the fix, a missing dependency shows as an error event in the TUI and in logs, and the app starts with remaining plugins.

How did you verify your code works?

  • tsc --noEmit passes
  • manually tested with a plugin config pointing at a file:// plugin whose @opencode-ai/plugin dependency is missing — opencode now starts, shows the error in the session, and loads remaining plugins

Checklist

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