Uh oh!
There was an error while loading. Please reload this page.
fix(opencode): seal partial reasoning/text parts before stream retries - #44884
fix(opencode): seal partial reasoning/text parts before stream retries#44884ob1-s wants to merge 1 commit into
Conversation
When a provider stream dies mid-attempt, reasoning/text parts already persisted during streaming kept no end timestamp: the in-memory maps were dropped on retry without finalizing them, leaving dangling blocks in the transcript for every failed attempt (visible after retry storms on unstable endpoints). Extract the finalization logic into sealPartialParts() and invoke it before each retry attempt, so each dead attempt's parts are closed before the next one starts. Behavior of retries themselves is unchanged.
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate PRs FoundI found several related PRs that address similar issues with streaming, retries, and partial parts:
Why they might be related: These PRs all address problems with incomplete or orphaned stream parts from failed provider attempts. Your PR seals partial parts before retries, while these others handle recovery or cleanup of abandoned parts. There may be overlap in the problem domain. |
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Issue for this PR
Closes#44894
Type of change
What does this PR do?
When an attempt fails mid-stream, parts persisted during that attempt were left without
time.end: the retry path reset the in-memory maps without finalizing them. This extracts the existing finalization logic fromcleanup()intosealPartialParts()and calls it before each stream attempt (no-op on the first), so each failed attempt's parts are closed before the next starts. Retry behavior is otherwise unchanged.How did you verify your code works?
bun test test/session/: 420 passing, identical results on this branch and ondevbun turbo typecheck --filter=opencode: cleanScreenshots / recordings
Not a UI change.
Checklist