Repository navigation
Filter out reasoning items from previous turns - #5857
Conversation
…ove_reasoning_before_last_turn and update logic/comments to clarify turn boundary handling
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…visible_history - Move filtering logic for prompt input from filter_model_visible_history to ConversationHistory::get_history_for_prompt. - Update all relevant call sites to use get_history_for_prompt instead of get_history and filtering. - Remove now-unused filter_model_visible_history.
…access Eliminate SessionState::history_snapshot and Session::history_snapshot; refactor call sites to use clone_history().get_history*() as appropriate. Update tests and compact task logic for consistency.
- Added get_history_for_prompt_drops_ghost_commits test to verify ghost commits are filtered out - Fixed test usage to call get_history_for_prompt instead of get_history
| sess.record_conversation_items(&turn_context, &pending_input) | ||
| .await; | ||
| sess.history_snapshot().await | ||
| sess.clone_history().await.get_history_for_prompt() |
There was a problem hiding this comment.
history_snapshot was doing the same effective clonning but clone_history give us more flexibility
jif-oai
left a comment
There was a problem hiding this comment.
Can you add an integration test?
| else { | ||
| return; | ||
| }; | ||
| let mut index = 0usize; |
There was a problem hiding this comment.
This pattern is pretty strange but I guess retain_mut is not stable yet so good for now
| } | ||
|
|
||
| let history = sess.history_snapshot().await; | ||
| let history = sess.clone_history().await.get_history(); |
There was a problem hiding this comment.
NIT: The verbosity here is pretty strange. clone_history should conceptually return an "history"
Out of scope for this PR but there is something strange
…ring - Add inputs_of_type(&self, ty: &str) -> Vec<Value> to ResponsesRequest for type-based filtering of input items - Add cached_prompt_filters_reasoning_items_from_previous_turns test to prompt_caching.rs to verify prior reasoning items are filtered from cached prompts
Done. |
Reduces request size and prevents 400 errors when switching between API orgs.
Based on Responses API behavior described in https://cookbook.openai.com/examples/responses_api/reasoning_items#caching