anomalyco / anomalyco/opencode

Stream failures between retry attempts leave reasoning/text parts permanently unclosed in transcripts

Open
#44,894 0 comments 0 reactions 1 assignee View on GitHub

@kitlangton is already working on this.

Since Aug 25, 2026.

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

Description

While looking into sessions that hit repeated provider 503s, I noticed stored part records that have time.start but never get a time.end.

Cause as far as I can tell: in packages/opencode/src/session/processor.ts, when an attempt fails, the retry loop resets ctx.currentText = undefined / ctx.reasoningMap = {} without finalizing the parts already persisted during streaming. The sealing logic lives in cleanup(), which only runs after the whole retry chain settles - so every failed attempt in the middle of a chain leaves dangling blocks behind.

On one long-running install I count ~970 such parts (reasoning and text). No accounting damage (usage comes from step-finish), but transcripts accumulate blocks that never officially ended, which is visible in the session view after unstable-provider stretches.

Happy to send a PR if this seems worth fixing.

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.