Skip to content

The agent that grows with you

fix: pin the auxiliary wire's route-scoped reasoning_details strip; document OpenRouter/Nous-only replay

teknium10c24dd56cb0b
diff --git a/tests/agent/transports/test_chat_completions_reasoning_details_replay.py b/tests/agent/transports/test_chat_completions_reasoning_details_replay.py
index 1fbaf1b7b6c..6a686b08dca 100644
--- a/tests/agent/transports/test_chat_completions_reasoning_details_replay.py
+++ b/tests/agent/transports/test_chat_completions_reasoning_details_replay.py
@@ -2,6 +2,9 @@
chat-completions route gets a wire copy without it (strict schemas 400/422 on the field,
wedging the session after an in-session model switch — hermes-agent#70233)."""
+from openai import OpenAI
+
+from agent.auxiliary_wire import prepare_chat_messages
from agent.transports import get_transport
_HISTORY = [
@@ -11,10 +14,14 @@ _HISTORY = [
]
-def test_non_replaying_route_drops_reasoning_details_only_on_the_wire_copy():
- kwargs = get_transport("chat_completions").build_kwargs("qwen/qwen3.6-27b", _HISTORY, base_url="https://api.groq.com/openai/v1")
+def test_auxiliary_wire_drops_reasoning_details_only_for_non_replaying_routes():
+ with OpenAI(api_key="k", base_url="https://api.groq.com/openai/v1") as client:
+ kwargs = prepare_chat_messages(client, {"model": "qwen/qwen3.6-27b", "messages": _HISTORY})
assert all("reasoning_details" not in m for m in kwargs["messages"])
assert "reasoning_details" in _HISTORY[1] # durable history is untouched
+ with OpenAI(api_key="k", base_url="https://openrouter.ai/api/v1") as client:
+ kwargs = prepare_chat_messages(client, {"model": "m", "messages": _HISTORY})
+ assert any("reasoning_details" in m for m in kwargs["messages"])
def test_openrouter_and_nous_routes_keep_reasoning_details():
diff --git a/website/docs/developer-guide/session-storage.md b/website/docs/developer-guide/session-storage.md
index db42da3f27a..d8163dc0b49 100644
--- a/website/docs/developer-guide/session-storage.md
+++ b/website/docs/developer-guide/session-storage.md
@@ -236,6 +236,7 @@ CREATE INDEX IF NOT EXISTS idx_messages_session_id ON messages(session_id, id);
Notes:
- `tool_calls` is stored as a JSON string (serialized list of tool call objects)
- `reasoning_details`, `codex_reasoning_items`, and `codex_message_items` are stored as JSON strings
+- `reasoning_details` is always kept in history; on the chat-completions wire it is replayed only to OpenRouter and the Nous Portal (every other chat-completions route gets a copy without it, since strict schemas reject the field)
- Desktop history hydration retains assistant sidecars in both REST and JSON-RPC (`session.resume`, `session.activate`, `session.history`) projections, including rows with reasoning and tool calls. REST may return the SQLite JSON string while RPC returns decoded items; Desktop accepts both. A final Responses reply may live only in `codex_message_items` while `content` is empty. Canonical content still takes precedence, and analysis/commentary items are not promoted to reply text.
- `reasoning` stores the raw reasoning text for providers that expose it
- A reasoning-only clean stop (empty `content`, `finish_reason=stop`, reasoning present) is answered with the reasoning text, but the assistant row is never written with that text as `content`: `content` stays empty, the text lives in `reasoning`/`reasoning_content`, and `api_content` carries it so the next request replays the answer byte-identically. History surfaces therefore show it as reasoning, not as a reply.