Skip to content

fix(llm): serialize overlapping OpenAI reasoning - #37022

Open
xiaodream551-a11y wants to merge 1 commit into
anomalyco:v2from
xiaodream551-a11y:openai-reasoning-overlap
Open

fix(llm): serialize overlapping OpenAI reasoning#37022
xiaodream551-a11y wants to merge 1 commit into
anomalyco:v2from
xiaodream551-a11y:openai-reasoning-overlap

Conversation

@xiaodream551-a11y

@xiaodream551-a11y xiaodream551-a11y commented Jul 15, 2026

Copy link
Copy Markdown

Issue for this PR

Fixes #36892

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

OpenAI Responses can start another reasoning summary before the previous item has fully ended. V2 persists one reasoning block at a time, so those overlapping starts terminate the run with reasoning start before end.

This serializes overlapping reasoning events before publishing them, while retaining text/tool order and final encrypted continuation metadata. Reused provider block IDs are isolated so late deltas cannot merge into an earlier block.

How did you verify your code works?

  • Added a deterministic SSE regression covering overlapping summaries, interleaved text, final encrypted metadata, and a late reused block ID.
  • bun run test in packages/llm (319 passed, 29 skipped).
  • bun run typecheck in packages/llm and packages/core.
  • The pre-push bun turbo typecheck --concurrency=3 hook passed across 32 packages.

Screenshots / recordings

Not applicable; this is a non-UI stream parser fix.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Jul 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jul 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@xiaodream551-a11y

Copy link
Copy Markdown
Author

The linked issue is #36892 and the PR template now references it as Fixes #36892. This PR targets v2, while the repository default branch is dev; GitHub leaves closingIssuesReferences empty for non-default-base PRs, so the standards workflow appears to report a false negative. Could a maintainer clear the needs:issue label?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant