anomalyco / anomalyco/opencode
Provider-turn failures can leave assistant scaffolds unfinished
@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
- Create a session and persist a user message.
- Run
SessionPrompt.loop()with aSessionProcessorwhosecreate()defects. - The defect propagates, but the assistant scaffold remains persisted with no parts, error,
finish, ortime.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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.