Skip to content

[Fix] oclite TUI non-functional - missing text streaming handler & silent failures #142

@randomm

Description

@randomm

Problem

oclite TUI renders but is completely non-functional:

  • Input disappears on Enter
  • No LLM response
  • No slash commands work
  • No error messages

Root Causes

1. No text streaming event handler

handleEvent in useSDKEvents.ts doesn't handle text streaming events. The reducer has STREAM_TEXT action but nothing dispatches it.

2. Session init errors swallowed

initSession().catch(console.error)  // Errors hidden from user

3. Race condition on submit

User can press Enter before state.session.id is set - message lost silently.

4. Event subscription failures silent

If SSE connection fails, no feedback to user.

Required Fixes

1. Add text streaming handler in useSDKEvents.ts:

case "message.part.updated":
  if (event.properties.part?.type === "text") {
    dispatch({
      type: "STREAM_TEXT",
      payload: event.properties.part.text || "",
    })
  }
  // ... existing tool handling

2. Show session init errors in UI

3. Guard handleSubmit when session not ready

4. Show event stream errors in UI

Files

  • packages/opencode/src/cli/ink/hooks/useSDKEvents.ts
  • packages/opencode/src/cli/ink/App.tsx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions