Echo reasoning items + prompt_cache_key for codex-oauth#325
Merged
Conversation
Carry the model's reasoning across turns on the gpt-5 Responses API: request `include: ["reasoning.encrypted_content"]`, capture reasoning items from the stream (response.output_item.done), store them in history as a new `Content::Reasoning`, and replay them in later requests with their id + encrypted_content — matching the Codex CLI. This restores reasoning continuity between turns. Also set a stable per-session `prompt_cache_key`. New `Content::Reasoning(ReasoningItem)` + `ProviderTurn.reasoning_items`; the openai/anthropic/ollama providers ignore the variant.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Makes the codex-oauth provider carry the model's reasoning items across turns (gpt-5 Responses API), matching the Codex CLI:
include: ["reasoning.encrypted_content"];response.output_item.done, typereasoning) —id+encrypted_content+ summary;Content::Reasoning(ReasoningItem)(carried onProviderTurn.reasoning_items);Also sets a stable per-session
prompt_cache_key(= session id).The
openai/anthropic/ollamaproviders ignore the newContent::Reasoningvariant.Why
Two related gaps found while benchmarking on DeepSWE:
Honest scope / results
codex-rs/core/src/client.rscaches a "Responses WebSocket connection"), while zarvis uses stateless HTTP POST + SSE; the prompt cache is likely connection-scoped. That's a separate, larger change.Test plan
cargo build+cargo test -p agentd-adapter-zarvis→ 138 passed, 0 failed.🤖 Generated with Claude Code