Skip to content

Unfinished assistant scaffold persists after prompt setup failure #38425

Description

@sowervids

Description

The legacy prompt loop persists an assistant message before processor setup begins. Cancellation is handled, but a defect during the durable write, processor creation, or later turn setup can leave the message with no parts, no finish, no error, and no completion timestamp.

The same shape remains after a hard process interruption because no finalizer can run. It stays in session history as an unfinished assistant turn.

Expected behavior: exact empty scaffolds from prior executions should be marked interrupted before the loop continues, and every failed exit after scaffold creation should finalize the message without swallowing the original failure. Recovery must still allow the latest user prompt to receive a new response.

Plugins

None

OpenCode version

Current dev at 411eff73

Steps to reproduce

  1. Create a session and persist a user message.
  2. Persist an assistant message parented to it with zero parts and no finish, error, or time.completed.
  3. Add a newer user prompt and run SessionPrompt.loop().
  4. The newer prompt receives a response, but the old assistant remains permanently unfinished.

The future-failure path is reproducible by replacing SessionProcessor.create() with an Effect defect. The defect propagates, but the already-persisted assistant remains in the same unfinished state.

Screenshot and/or share link

Not applicable.

Operating System

macOS

Terminal

zsh

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