Skip to content

fix(session): preserve reasoning fields in rewrite_transcript#3311

Merged
teknium1 merged 1 commit intomainfrom
hermes/hermes-5ef8201d
Mar 27, 2026
Merged

fix(session): preserve reasoning fields in rewrite_transcript#3311
teknium1 merged 1 commit intomainfrom
hermes/hermes-5ef8201d

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Summary

Salvaged from PR #3199 by @alireza78a — cherry-picked onto current main with original authorship preserved.

Root cause

rewrite_transcript() (called by /retry, /undo, /compress) clears all session messages from SQLite and re-inserts them — but drops reasoning, reasoning_details, and codex_reasoning_items. Since load_transcript reads from SQLite first, the reasoning data is permanently lost for all future loads.

Fix

Pass all three reasoning fields through to append_message() in rewrite_transcript, gated on role == "assistant" (only assistant messages carry reasoning).

Validation

  • python -m pytest tests/gateway/test_session.py -n0 -q → 54 passed
  • Includes regression test: inserts message with all 3 reasoning fields, calls rewrite, verifies all survive.

Closes #3199

Co-authored-by: alireza78a alireza78.crypto@gmail.com

rewrite_transcript (used by /retry, /undo, /compress) was calling
append_message without reasoning, reasoning_details, or
codex_reasoning_items — permanently dropping them from SQLite.
@teknium1 teknium1 merged commit f008ee1 into main Mar 27, 2026
1 of 2 checks passed
StreamOfRon pushed a commit to StreamOfRon/hermes-agent that referenced this pull request Mar 29, 2026
…search#3311)

rewrite_transcript (used by /retry, /undo, /compress) was calling
append_message without reasoning, reasoning_details, or
codex_reasoning_items — permanently dropping them from SQLite.

Co-authored-by: alireza78a <alireza78.crypto@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants