feat: persist reasoning across gateway session turns (schema v6) (#2974)

feat: persist reasoning across gateway session turns (schema v6)

Tested against OpenAI Codex (direct), Anthropic (direct + OAI-compat), and OpenRouter → 6 backends. All reasoning field types (reasoning, reasoning_details, codex_reasoning_items) round-trip through the DB correctly.
This commit is contained in:
Teknium 2026-03-25 09:47:28 -07:00 committed by GitHub
parent 5dbe2d9d73
commit 42fec19151
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 173 additions and 11 deletions

View file

@ -1540,6 +1540,9 @@ class AIAgent:
tool_calls=tool_calls_data,
tool_call_id=msg.get("tool_call_id"),
finish_reason=msg.get("finish_reason"),
reasoning=msg.get("reasoning") if role == "assistant" else None,
reasoning_details=msg.get("reasoning_details") if role == "assistant" else None,
codex_reasoning_items=msg.get("codex_reasoning_items") if role == "assistant" else None,
)
self._last_flushed_db_idx = len(messages)
except Exception as e: