mirror of
https://github.com/openai/codex.git
synced 2026-04-26 15:45:02 +00:00
Account for encrypted reasoning for auto compaction (#7113)
- The total token used returned from the api doesn't account for the reasoning items before the assistant message - Account for those for auto compaction - Add the encrypted reasoning effort in the common tests utils - Add a test to make sure it works as expected
This commit is contained in:
@@ -2,6 +2,7 @@ use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use anyhow::Result;
|
||||
use base64::Engine;
|
||||
use serde_json::Value;
|
||||
use wiremock::BodyPrintLimit;
|
||||
use wiremock::Match;
|
||||
@@ -297,12 +298,18 @@ pub fn ev_reasoning_item(id: &str, summary: &[&str], raw_content: &[&str]) -> Va
|
||||
.map(|text| serde_json::json!({"type": "summary_text", "text": text}))
|
||||
.collect();
|
||||
|
||||
let overhead = "b".repeat(550);
|
||||
let raw_content_joined = raw_content.join("");
|
||||
let encrypted_content =
|
||||
base64::engine::general_purpose::STANDARD.encode(overhead + raw_content_joined.as_str());
|
||||
|
||||
let mut event = serde_json::json!({
|
||||
"type": "response.output_item.done",
|
||||
"item": {
|
||||
"type": "reasoning",
|
||||
"id": id,
|
||||
"summary": summary_entries,
|
||||
"encrypted_content": encrypted_content,
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user