mirror of
https://github.com/openai/codex.git
synced 2026-11-16 06:54:36 +00:00
Store model history in response item envelopes (#38045)
## What changed - Add `ResponseItemEnvelope` as the history-owned wrapper for a `ResponseItem`. - Store envelopes in `ContextManager` while keeping raw-item iteration and consuming APIs for existing callers. - Preserve envelopes when compaction and history normalization rewrite retained items, and wrap newly synthesized items. ## Testing - Cover envelope access, mutation, and conversion back to raw response items. - Cover annotated history replacement and annotated user-message collection for compaction. GitOrigin-RevId: 3fa2e7bdd981b08cc7aec410c80deccaecdabab4
This commit is contained in:
1 parent
be751dd1df
commit
99915080b6
20 files changed
+382
-224
No files matched your search
@@ -436,8 +436,8 @@ fn render_guardian_transcript_entries_with_offset(
|
||||
/// Keep both tool calls and tool results here. The reviewer often needs the
|
||||
/// agent's exact queried path / arguments as well as the returned evidence to
|
||||
/// decide whether the pending approval is justified.
|
||||
pub(crate) fn collect_guardian_transcript_entries(
|
||||
items: &[ResponseItem],
|
||||
pub(crate) fn collect_guardian_transcript_entries<'a>(
|
||||
items: impl IntoIterator<Item = &'a ResponseItem>,
|
||||
) -> Vec<GuardianTranscriptEntry> {
|
||||
let mut entries = Vec::new();
|
||||
let mut tool_names_by_call_id = HashMap::new();
|
||||
|
||||
@@ -221,8 +221,12 @@ impl GuardianReviewSessionReuseKey {
|
||||
}
|
||||
}
|
||||
|
||||
fn encrypted_parent_compaction(items: &[ResponseItem]) -> Option<ResponseItem> {
|
||||
let item = items.iter().rev().find(|item| {
|
||||
fn encrypted_parent_compaction<'a, I>(items: I) -> Option<ResponseItem>
|
||||
where
|
||||
I: IntoIterator<Item = &'a ResponseItem>,
|
||||
I::IntoIter: DoubleEndedIterator,
|
||||
{
|
||||
let item = items.into_iter().rev().find(|item| {
|
||||
matches!(
|
||||
item,
|
||||
ResponseItem::Compaction { .. } | ResponseItem::ContextCompaction { .. }
|
||||
|
||||
Reference in new issue
Block a user