Problem
The cross-turn reasoning cache in Codex Chat history only handles function_call type items. When Codex uses custom_tool_call (e.g. apply_patch) or tool_search_call, their reasoning_content is not cached and cannot be restored in follow-up turns.
This causes upstream providers like Kimi/Moonshot and DeepSeek to reject requests with errors like reasoning_content is missing in assistant tool call message, because the proxy cannot reconstruct the reasoning context that was present in the original tool call.
Current Behavior
In src-tauri/src/proxy/providers/codex_chat_history.rs:
cached_function_call() (line ~439) only matches type == "function_call" and returns None for all other types
record_response() (line ~57) uses .filter_map(cached_function_call), so only function_call items are recorded
enrich_request() (line ~110) only matches "function_call" and "function_call_output", skipping "custom_tool_call", "tool_search_call", and their *_output counterparts
Expected Behavior
The reasoning cache should generalize to the full tool-call triad:
function_call / function_call_output (already handled)
custom_tool_call / custom_tool_call_output (missing)
tool_search_call / tool_search_output (missing)
This ensures that when Codex sends a follow-up request with previous_response_id plus a custom_tool_call_output, the missing custom_tool_call with its reasoning_content is restored from the cache, matching the existing function_call behavior.
References
The streaming layer (streaming_codex_chat.rs) and transform layer (transform_codex_chat.rs) already handle all three tool types correctly. The gap is specifically in the cross-turn history cache.
Problem
The cross-turn reasoning cache in Codex Chat history only handles
function_calltype items. When Codex usescustom_tool_call(e.g. apply_patch) ortool_search_call, theirreasoning_contentis not cached and cannot be restored in follow-up turns.This causes upstream providers like Kimi/Moonshot and DeepSeek to reject requests with errors like
reasoning_content is missing in assistant tool call message, because the proxy cannot reconstruct the reasoning context that was present in the original tool call.Current Behavior
In
src-tauri/src/proxy/providers/codex_chat_history.rs:cached_function_call()(line ~439) only matchestype == "function_call"and returnsNonefor all other typesrecord_response()(line ~57) uses.filter_map(cached_function_call), so onlyfunction_callitems are recordedenrich_request()(line ~110) only matches"function_call"and"function_call_output", skipping"custom_tool_call","tool_search_call", and their*_outputcounterpartsExpected Behavior
The reasoning cache should generalize to the full tool-call triad:
function_call/function_call_output(already handled)custom_tool_call/custom_tool_call_output(missing)tool_search_call/tool_search_output(missing)This ensures that when Codex sends a follow-up request with
previous_response_idplus acustom_tool_call_output, the missingcustom_tool_callwith itsreasoning_contentis restored from the cache, matching the existingfunction_callbehavior.References
The streaming layer (
streaming_codex_chat.rs) and transform layer (transform_codex_chat.rs) already handle all three tool types correctly. The gap is specifically in the cross-turn history cache.