Skip to content

opencode-session-corruption #38436

Closed as not planned
Closed as not planned

Description

@samuel-pro-ai

Description

A long-running session (~950 events, ~74 messages) with the build agent on deepseek-v4-pro suddenly entered a state where new messages are saved to the database but the AI response is never triggered. The input clears as normal, no error is shown, but no assistant message is ever created. Other sessions in the same OpenCode instance work fine.

The event stream shows a pattern of abort cycles before the session went silent:

message.updated.1        (user message created)
message.part.updated.1   (user text saved)
session.updated.1
message.updated.1        (assistant message created)
message.part.updated.1   (assistant step-start/reasoning)
message.updated.1        (assistant completed with MessageAbortedError)
session.updated.1
message.removed.1        (user message removed)
message.removed.1        (assistant message removed)
session.updated.1

After several such cycles, the session transitioned to a "write-only" state where user messages still create events, but no assistant message is ever created — not even an aborted one.

What did NOT fix it:

  • Manually deleting orphan user messages/parts/events from the DB
  • Updating event_sequence
  • Changing the session's model field
  • Closing and reopening OpenCode

What worked (both confirm it's client-side state, not data corruption):

  1. opencode --session <id> --fork — the forked session works normally
  2. Exporting all sessions from Linux and re-importing on Windows — the serialization/deserialization round-trip flushed the bad state

Plugins

none

OpenCode version

1.18.4

Steps to reproduce

Not reliably reproducible, but the progression appears to be:

  1. Run a long session with the build agent
  2. Have message abort/remove cycles occur (possibly from rapid message sending or provider interruptions)
  3. Continue sending messages — the session may enter the write-only state after several cycles

Screenshot and/or share link

No response

Operating System

Windows 11 (build 26200), Git Bash terminal

Terminal

Git Bash (MINGW64_NT-10.0-26200) inside Cursor IDE integrated terminal

Activity

  1. github-actions commented on Jul 23, 2026

    @github-actions
    Contributor

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

    If your issue is distinct (particularly the abort-cycle trigger path leading to the stuck state), it would help to clarify the differences from those issues in a comment here.

  2. github-actions commented on Sep 22, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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