Skip to content

fix(core): preserve reasoning across model switches - #45401

Merged
rekram1-node merged 2 commits into
v2from
preserve-reasoning
Aug 26, 2026
Merged

rekram1-node merged 2 commits into
v2from
preserve-reasoning

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Aug 26, 2026 •

Copy link
Copy Markdown
Collaborator

Issue for this PR

Related to #45334. This addresses readable reasoning replay, not that issue's credential-switching bug.

Type of change

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

What does this PR do?

Keep readable reasoning as reasoning when replaying successful messages under a different model or provider, instead of making it ordinary assistant text. Destination adapters can then use their supported reasoning format.

Metadata stripping, encrypted-only omission, same-model replay, and failed-message handling are unchanged. Adapter policies also remain unchanged: Claude falls back to text for unsigned reasoning; Responses omits reasoning without replay state rather than receiving it as ordinary text.

Updates the existing model-switch test expectation. No new test files, credential changes, or metadata-schema changes.

How did you verify your code works?

  • Core: 29 tests passed across session-runner-message and session-model-request.
  • AI: 307 tests passed across the Chat Completions, Anthropic, Gemini, and OpenAI Responses adapters.
  • bun typecheck from packages/core passed.
  • Prettier and git diff --check passed. Oxlint reported no errors and two existing consistent-return warnings in unchanged functions.
  • No live provider calls.

Screenshots / recordings

Not applicable.

Checklist

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

@rekram1-node
rekram1-node merged commit 5ac4156 into v2 Aug 26, 2026
10 checks passed
@rekram1-node
rekram1-node deleted the preserve-reasoning branch August 26, 2026 22:52
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
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.

1 participant