mirror of
https://github.com/openai/codex.git
synced 2026-10-14 16:38:43 +00:00
Wait for idle before injecting remote compaction test history (#47571)
## Why Turn completion precedes active-turn cleanup, so the remote compaction test must wait for the thread to become idle before injecting its history fixture. ## What changed Register the `ThreadIdle` lifecycle contributor and wait after the initial turn in `remote_compact_v2_rewrites_multiple_trailing_function_call_outputs`, covering both manual and automatic compaction cases. GitOrigin-RevId: 1593b212db0e07b1457f090b5ac7ba2313a28360
This commit is contained in:
@@ -6,6 +6,7 @@ use base64::Engine;
|
||||
use base64::engine::general_purpose::STANDARD as BASE64_STANDARD;
|
||||
use codex_core::StartThreadOptions;
|
||||
use codex_core::TurnInputRequest;
|
||||
use codex_extension_api::ExtensionRegistryBuilder;
|
||||
use codex_features::Feature;
|
||||
use codex_history::CodexHarnessMetadata;
|
||||
use codex_history::InitialHistory;
|
||||
@@ -28,6 +29,7 @@ use codex_protocol::protocol::RealtimeEvent;
|
||||
use codex_protocol::protocol::RealtimeOutputModality;
|
||||
use codex_protocol::protocol::ThreadHistoryMode;
|
||||
use codex_protocol::user_input::UserInput;
|
||||
use core_test_support::ThreadIdle;
|
||||
use core_test_support::responses;
|
||||
use core_test_support::responses::mount_sse_once;
|
||||
use core_test_support::responses::sse;
|
||||
@@ -44,6 +46,7 @@ use serde_json::Value;
|
||||
use serde_json::json;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use test_case::test_case;
|
||||
use tokio::time::Duration;
|
||||
use wiremock::ResponseTemplate;
|
||||
@@ -1295,8 +1298,11 @@ async fn remote_compact_v2_rewrites_multiple_trailing_function_call_outputs(
|
||||
let second_trimmed_call_id = "second-trimmed-call";
|
||||
let retained_output = "retained tool output";
|
||||
|
||||
let mut extensions = ExtensionRegistryBuilder::new();
|
||||
extensions.thread_lifecycle_contributor(Arc::new(ThreadIdle));
|
||||
let harness = TestCodexHarness::with_builder(
|
||||
test_codex()
|
||||
.with_extensions(Arc::new(extensions.build()))
|
||||
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
|
||||
.with_config(|config| {
|
||||
config.model_context_window = Some(2_000);
|
||||
@@ -1316,6 +1322,8 @@ async fn remote_compact_v2_rewrites_multiple_trailing_function_call_outputs(
|
||||
.await;
|
||||
harness.test().submit_turn("initial turn").await?;
|
||||
let _ = initial_mock.single_request();
|
||||
// Completion precedes active-turn cleanup; inject the fixture into idle history.
|
||||
ThreadIdle::wait(&codex).await;
|
||||
let history = [
|
||||
json!({"type": "message", "role": "user", "content": [{"type": "input_text", "text": first_user_message}]}),
|
||||
json!({"type": "function_call", "call_id": retained_call_id, "name": "exec_command", "arguments": "{}"}),
|
||||
|
||||
Reference in New Issue
Block a user