mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
fix
This commit is contained in:
@@ -3544,8 +3544,7 @@ mod tests {
|
||||
session_source: SessionSource::Exec,
|
||||
};
|
||||
|
||||
let conversation_id = ThreadId::default();
|
||||
let mut state = SessionState::new(session_configuration, conversation_id);
|
||||
let mut state = SessionState::new(session_configuration);
|
||||
let initial = RateLimitSnapshot {
|
||||
primary: Some(RateLimitWindow {
|
||||
used_percent: 10.0,
|
||||
@@ -3616,8 +3615,7 @@ mod tests {
|
||||
session_source: SessionSource::Exec,
|
||||
};
|
||||
|
||||
let conversation_id = ThreadId::default();
|
||||
let mut state = SessionState::new(session_configuration, conversation_id);
|
||||
let mut state = SessionState::new(session_configuration);
|
||||
let initial = RateLimitSnapshot {
|
||||
primary: Some(RateLimitWindow {
|
||||
used_percent: 15.0,
|
||||
@@ -3883,7 +3881,7 @@ mod tests {
|
||||
session_configuration.session_source.clone(),
|
||||
);
|
||||
|
||||
let state = SessionState::new(session_configuration.clone(), conversation_id);
|
||||
let state = SessionState::new(session_configuration.clone());
|
||||
let skills_manager = Arc::new(SkillsManager::new(config.codex_home.clone()));
|
||||
|
||||
let services = SessionServices {
|
||||
@@ -3983,7 +3981,7 @@ mod tests {
|
||||
session_configuration.session_source.clone(),
|
||||
);
|
||||
|
||||
let state = SessionState::new(session_configuration.clone(), conversation_id);
|
||||
let state = SessionState::new(session_configuration.clone());
|
||||
let skills_manager = Arc::new(SkillsManager::new(config.codex_home.clone()));
|
||||
|
||||
let services = SessionServices {
|
||||
@@ -4293,7 +4291,8 @@ mod tests {
|
||||
turn_context: &TurnContext,
|
||||
) -> (Vec<RolloutItem>, Vec<ResponseItem>) {
|
||||
let mut rollout_items = Vec::new();
|
||||
let mut live_history = ContextManager::new();
|
||||
let codex_home = session.codex_home().await;
|
||||
let mut live_history = ContextManager::new(&codex_home);
|
||||
|
||||
let initial_context = session.build_initial_context(turn_context).await;
|
||||
for item in &initial_context {
|
||||
|
||||
@@ -32,7 +32,8 @@ fn assistant_msg(text: &str) -> ResponseItem {
|
||||
}
|
||||
|
||||
fn create_history_with_items(items: Vec<ResponseItem>) -> ContextManager {
|
||||
let mut h = ContextManager::new();
|
||||
let codex_home = PathBuf::from("/tmp");
|
||||
let mut h = ContextManager::new(&codex_home);
|
||||
// Use a generous but fixed token budget; tests only rely on truncation
|
||||
// behavior, not on a specific model's token limit.
|
||||
h.record_items(items.iter(), TruncationPolicy::Tokens(10_000));
|
||||
@@ -89,15 +90,9 @@ fn truncate_exec_output(content: &str) -> String {
|
||||
|
||||
#[test]
|
||||
fn stores_oversized_user_message_in_user_message_dir() {
|
||||
let mut history = ContextManager::new();
|
||||
let temp_dir = tempdir().expect("create temp dir");
|
||||
history.set_user_message_dir(Some(
|
||||
temp_dir
|
||||
.path()
|
||||
.join("context")
|
||||
.join("usermsgs")
|
||||
.join("test-session"),
|
||||
));
|
||||
let codex_home = temp_dir.path().to_path_buf();
|
||||
let mut history = ContextManager::new(&codex_home);
|
||||
history.set_token_info(Some(TokenUsageInfo {
|
||||
total_token_usage: TokenUsage::default(),
|
||||
last_token_usage: TokenUsage::default(),
|
||||
@@ -531,7 +526,8 @@ fn normalization_retains_local_shell_outputs() {
|
||||
|
||||
#[test]
|
||||
fn record_items_truncates_function_call_output_content() {
|
||||
let mut history = ContextManager::new();
|
||||
let codex_home = PathBuf::from("/tmp");
|
||||
let mut history = ContextManager::new(&codex_home);
|
||||
// Any reasonably small token budget works; the test only cares that
|
||||
// truncation happens and the marker is present.
|
||||
let policy = TruncationPolicy::Tokens(1_000);
|
||||
@@ -569,7 +565,8 @@ fn record_items_truncates_function_call_output_content() {
|
||||
|
||||
#[test]
|
||||
fn record_items_truncates_custom_tool_call_output_content() {
|
||||
let mut history = ContextManager::new();
|
||||
let codex_home = PathBuf::from("/tmp");
|
||||
let mut history = ContextManager::new(&codex_home);
|
||||
let policy = TruncationPolicy::Tokens(1_000);
|
||||
let line = "custom output that is very long\n";
|
||||
let long_output = line.repeat(2_500);
|
||||
@@ -599,7 +596,8 @@ fn record_items_truncates_custom_tool_call_output_content() {
|
||||
|
||||
#[test]
|
||||
fn record_items_respects_custom_token_limit() {
|
||||
let mut history = ContextManager::new();
|
||||
let codex_home = PathBuf::from("/tmp");
|
||||
let mut history = ContextManager::new(&codex_home);
|
||||
let policy = TruncationPolicy::Tokens(10);
|
||||
let long_output = "tokenized content repeated many times ".repeat(200);
|
||||
let item = ResponseItem::FunctionCallOutput {
|
||||
|
||||
Reference in New Issue
Block a user