Skip to content

fix: skip empty reasoning steps in replayed history#37624

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

fix: skip empty reasoning steps in replayed history#37624
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.

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

Labels

None yet

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