Skip to content

tui: /btw crashes when rendering answer dialog #49777

Description

@stevoland

Stop letting @thdxr push :)

Summary

Running the built-in /btw slash command crashes the TUI after the generated answer is returned. The answer dialog attempts to access PluginProvider outside its context boundary.

Environment

  • opencode version: 2.0.8
  • OS: macOS 25.6.0 (arm64)
  • Terminal: Ghostty 1.3.1 (TERM=xterm-ghostty, COLORTERM=truecolor)
  • Shell: /bin/zsh
  • Install/channel: latest release
  • Active plugins: No user-configured plugins; crash occurs in the built-in opencode.btw plugin

Reproduction

  1. Open an existing session in the TUI.
  2. Enter /btw <question>.
  3. Wait for the generated answer.

The issue reproduces consistently.

Expected Behavior

The generated answer should appear in the /btw dialog without modifying the session history.

Actual Behavior

The TUI displays its crash screen with:

Error: PluginProvider is missing

The stack trace originates from Answer in the built-in /btw plugin.

Additional Context

The issue has been reproduced with a fixture-driven TUI test that invokes /btw, returns a generated answer, and observes the same crash screen.

The cause appears to be a provider-boundary mismatch:

  • PluginProvider is mounted beneath DialogProvider.
  • DialogProvider renders dialog elements alongside its children, outside the child PluginProvider subtree.
  • The /btw Answer component calls the host TUI's usePlugin() hook to obtain markdown renderers.
  • Consequently, rendering the answer dialog throws PluginProvider is missing.

A narrow fix is to read the markdown renderer while the plugin's app slot is mounted beneath PluginProvider, then pass that renderer into the answer dialog rather than calling usePlugin() inside the dialog.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions