Skip to content

chat.message hook output not visible when plugin injects into output.parts #885

Closed as not planned

Description

@keybrdist

Issue Summary

When the chat.message hook injects text into output.parts (e.g., via output.parts.unshift(...)), the modified content does not appear in the OpenCode TUI when using oh-my-opencode. This affects any plugin that modifies output.parts in the chat.message hook.

Steps to Reproduce

  1. Install oh-my-opencode plugin
  2. Create a simple plugin that injects into chat.message:
    "chat.message": async (_input, output) => {
      output.parts.unshift({ type: "text", text: "Breadcrumb line" });
    }
  3. Add plugin to opencode.json alongside oh-my-opencode
  4. Start OpenCode with that config
  5. Submit a prompt
  6. Observe: the breadcrumb line does NOT appear in the TUI
  7. Observe: the hook IS being called (verified via console logging)

Expected Behavior

When output.parts.unshift(...) is called in the chat.message hook, the injected text should appear at the top of the chat message in the TUI, similar to how Claude Code hooks inject messages.

Actual Behavior

The text added to output.parts is NOT visible in the OpenCode TUI. The hook executes successfully (verified via console logs), but the UI does not render the modified output.parts.

Environment Details

  • OpenCode version: 1.0.150+
  • oh-my-opencode version: v2.14.0
  • Platform: macOS (darwin)
  • Reproduction case: Using local plugin in ~/.config/opencode/plugin/*/ with oh-my-opencode loaded

Additional Context

The opencode-breadcrumb plugin works correctly when oh-my-opencode is NOT loaded (verified with regular opencode.json). When both plugins are loaded, oh-my-opencode may be processing output.parts after other plugins have already mutated it, potentially overriding or hiding the changes.

Proposed Solution

Either:

  1. Support chat.message hook mutations: Ensure that plugins modifying output.parts in chat.message hook have their changes reflected in the TUI, or document the expected behavior (e.g., "mods to parts may not be visible when other plugins are loaded").

  2. Add a dedicated hook point for message prefix injection that runs after all plugins have had a chance to process output.parts, similar to how experimental.chat.messages.transform works but at the message render stage.

  3. Document plugin interaction order: If plugins modify output.parts in chat.message, specify which order they should be evaluated in and how conflicts should be resolved.

Related

This affects the opencode-breadcrumb plugin and any other plugin that injects into chat.message → output.parts.

Activity

  1. code-yeongyu commented on Feb 7, 2026

    @code-yeongyu
    Owner

    Not our bug — OpenCode TUI rendering issue. When plugin modifies output.parts in chat.message hook, the hook executes (verified via logs) but OpenCode TUI doesn't render the changes. Closing.

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions