Skip to content

TUI stops applying all events after a message is removed in a session it never loaded #52584

Closed

Description

@moritzWa

Description

An attached TUI can silently stop updating. Your prompts still send and the agent replies (both are saved server-side), but the transcript never shows them until you reopen the window.

Cause: every TUI client gets every session's events. The message.removed and message.part.removed handlers in packages/tui/src/context/sync.tsx index into store state without checking it exists. So a removal in a session this client never loaded throws: undefined is not an object (evaluating 'store.message[event.properties.sessionID].findIndex'). The throw escapes the SSE loop in context/sdk.tsx, whose .catch(() => {}) swallows it. The client stays connected but never applies another event.

Removals come from revert cleanup (the next prompt after /undo) and the delete message/part endpoints. So one /undo + resend in any session freezes every other open client that hadn't loaded that session.

Plugins

None needed to reproduce

OpenCode version

1.18.34, and current dev

Steps to reproduce

  1. opencode serve, with sessions A and B that both already have messages
  2. opencode attach <url> --session A
  3. Delete a message in B that existed before step 2: DELETE /session/B/message/<id> (or /undo in B and send a new prompt)
  4. Send anything in A. It's saved and answered, but the attached window never shows it

Operating System

macOS

Terminal

Hyper, tmux

Activity

  1. github-actions commented on Oct 1, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. neriousy commented on Oct 19, 2026

    @neriousy
    Member

    The v2 TUI safely handles undo cleanup for sessions it has not loaded. Its shared event store checks for missing session details and initializes message collections before applying removals, avoiding the exception that stopped subsequent updates. To get v2: npm i -g @opencode/cli@latest or curl -fsSL https://opencode.ai/v2/install | bash (desktop: update the app). If you still see this on v2, please open a new issue with the details.

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

Metadata

Metadata

Assignees

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