hermes-agent/tests/hermes_state
cryptoyasenka f2d03c1f2a fix(state,cli,tui-gateway): keep reasoning fields intact across forks and branches
get_messages() only deserializes content and tool_calls; the structured
reasoning columns (reasoning_details, codex_reasoning_items,
codex_message_items) come back as the raw TEXT they were stored as.
Feeding those rows straight back into a write, which is exactly what
the POST /api/sessions/{id}/fork handler does by piping get_messages()
into replace_messages(), hit an unguarded json.dumps() and stored the
already-serialized string encoded a second time. On replay of the fork,
json.loads() then yields the inner string instead of a list, and every
consumer's isinstance(..., list) gate silently drops it: preserved
Anthropic thinking blocks, Codex encrypted-reasoning/message-item
replay, and OpenRouter multi-turn reasoning context are all lost after
a fork, with one more encoding layer added per fork.

The /branch copy loop had the same defect from the other side: it
forwarded reasoning but none of the structured columns, and both TUI
branch writers persisted role/content alone, dropping reasoning and
reasoning_content along with them.

Route the six dumps sites in append_message and _insert_message_rows
through a shared guard that keeps already-serialized strings as-is;
structured values from the live runtime are dumped exactly as before.
Forward the reasoning fields in all three branch writers, matching the
set gateway/slash_commands.py already forwards on its own /branch path.
2026-08-08 17:37:26 -07:00
..
test_append_messages_batch.py
…
test_aux_usage_accounting.py
…
test_conversation_root.py
…
test_get_anchored_view.py
…
test_get_messages_around.py
…
test_live_db_isolation_guard.py fix(tests): fail hard when pytest resolves the production state.db (live-DB isolation guard) 2026-08-06 07:49:50 -07:00
test_reasoning_roundtrip.py fix(state,cli,tui-gateway): keep reasoning fields intact across forks and branches 2026-08-08 17:37:26 -07:00
test_replace_messages_archive_siblings.py test: fold review findings — plain fixture, call-shaped probe guard, public-API row counting 2026-08-07 15:42:49 +05:30
test_resolve_resume_session_id.py
…
test_restore_alternation_repair.py
…
test_session_archiving.py
…
test_session_md_export.py
…
test_session_read_state.py
…