Skip to content

fix: skip empty reasoning steps in replayed history - #37624

Closed
mihneaptu wants to merge 1 commit into
anomalyco:devfrom
mihneaptu:kimi-history-replay
Closed

mihneaptu wants to merge 1 commit into
anomalyco:devfrom
mihneaptu:kimi-history-replay

Conversation

@mihneaptu

@mihneaptu mihneaptu commented Jul 18, 2026 •

Copy link
Copy Markdown

Issue for this PR

Fixes #37651

Context: #37552 documented two independent 400 paths for Kimi K3 on OpenCode Go. The temperature path was fixed in models.dev#3331; this PR fixes the remaining history-replay path, now tracked in #37651.

Type of change

  • Bug fix

What does this PR do?

Skips metadata-free empty reasoning parts while rebuilding model history. Some providers can open and close a reasoning stream without emitting a delta; replaying that boundary previously produced an empty assistant message before the next step.

How did you verify your code works?

  • Added a regression test for the duplicate step-start / empty-reasoning sequence.
  • bun test test/session/message-v2.test.ts: 37 passed.
  • Replayed the affected Kimi K3 max session through the patched CLI; it continued for 26 steps and finished normally.

Screenshots / recordings

Not applicable.

Checklist

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

@github-actions

Copy link
Copy Markdown
Contributor

Hey! Your PR title Skip empty reasoning steps in replayed history doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@mihneaptu mihneaptu changed the title Skip empty reasoning steps in replayed history fix: skip empty reasoning steps in replayed history Jul 18, 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

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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.

Empty reasoning step (no delta) in replayed history causes 400 on later Kimi K3 requests

1 participant