anomalyco / anomalyco/opencode

Provider-turn failures can leave assistant scaffolds unfinished

Open
#38,431 1 comment 0 reactions 1 assignee View on GitHub

@kitlangton is already working on this.

Since Jul 23, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

The legacy prompt loop persists an empty assistant message before creating its processor. Existing cleanup handles interruption, but another failed Effect exit during processor creation or ordinary provider-turn setup and execution can propagate while leaving the committed message without an error or completion timestamp.

For an ordinary provider turn created by the current run, the failure boundary should begin at the persistence call. A failed exit should attempt to finalize that run's exact persisted assistant message, if present, without replacing the original failure. Cleanup should preserve any existing error and finish value.

This is process-local cleanup only. It does not scan existing history or recover process crashes, compaction turns, subtasks, cross-process work, or turns created by another run.

Plugins

None

OpenCode version

Current dev at 411eff73

Steps to reproduce
  1. Create a session and persist a user message.
  2. Run SessionPrompt.loop() with a SessionProcessor whose create() defects.
  3. The defect propagates, but the assistant scaffold remains persisted with no parts, error, finish, or time.completed.

Expected: the original defect still propagates, while the persisted scaffold records an error and completion timestamp. finish remains unchanged.

Screenshot and/or share link

Not applicable

Operating System

macOS

Terminal

zsh

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.