Skip to content

experimental.text.complete hook output not reflected in TUI display #7287

Description

@sungchul2

Description

The experimental.text.complete hook is being triggered correctly and modifying text, but the modified text is not reflected in the TUI display.

Environment

Steps to Reproduce

  1. Create a plugin with experimental.text.complete hook that modifies text
  2. Generate LLM response containing markdown tables
  3. Hook runs and modifies text (confirmed by logs)
  4. TUI displays original unmodified text

Evidence

Plugin logs show the hook IS being called and IS modifying text:

[table-formatter] Formatted table {"tableCount":1,"beforeLength":1625,"afterLength":1828}
[table-formatter] Formatted table {"tableCount":1,"beforeLength":780,"afterLength":775}

Expected Behavior

TUI should display the text modified by experimental.text.complete hook.

Actual Behavior

TUI displays the original streamed text, not the hook-modified text.

Analysis

Looking at packages/opencode/src/session/processor.ts:

case "text-end":
  if (currentText) {
    currentText.text = currentText.text.trimEnd()
    const textOutput = await Plugin.trigger(
      "experimental.text.complete",
      {...},
      { text: currentText.text },
    )
    currentText.text = textOutput.text  // ✅ Result assigned
    await Session.updatePart(currentText)  // ✅ Saved
  }

The hook result is saved to the session, but the TUI may be:

  1. Caching the streamed text-delta updates
  2. Not re-rendering when the final text is saved after hook completion

Possible Root Cause

During streaming, text-delta events update the TUI in real-time. When text-end triggers the hook and saves the modified text, the TUI might not refresh to show the updated content.

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Jan 8, 2026
  2. github-actions commented on Jan 8, 2026

    @github-actions
    Contributor

    I've searched through existing issues and did not find any clear duplicates of this issue. The problem appears to be specific to the experimental.text.complete hook not reflecting modifications in the TUI display despite the changes being saved to the session.

    This is a distinct issue, though #196 is tangentially related in that it also deals with streamed message display behavior in the TUI.

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

Metadata

Metadata

Assignees

Labels

opentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions