mirror of
https://github.com/openai/codex.git
synced 2026-09-09 15:58:47 +00:00
Remove unrelated branch churn
This commit is contained in:
@@ -236,7 +236,7 @@ impl Session {
|
||||
self.start_task(turn_context, input, task).await;
|
||||
}
|
||||
|
||||
pub(crate) async fn start_task<T: SessionTask>(
|
||||
async fn start_task<T: SessionTask>(
|
||||
self: &Arc<Self>,
|
||||
turn_context: Arc<TurnContext>,
|
||||
input: Vec<UserInput>,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
pub(crate) mod agent_jobs;
|
||||
pub mod apply_patch;
|
||||
pub(crate) mod apply_patch;
|
||||
mod dynamic;
|
||||
mod js_repl;
|
||||
mod list_dir;
|
||||
|
||||
@@ -713,6 +713,7 @@ async fn build_thread_item(
|
||||
{
|
||||
return None;
|
||||
}
|
||||
// Apply filters: must have session meta and at least one user message event
|
||||
if summary.saw_session_meta && summary.saw_user_event {
|
||||
let HeadTailSummary {
|
||||
thread_id,
|
||||
|
||||
@@ -31,23 +31,6 @@ fn test_config(codex_home: &Path) -> RolloutConfig {
|
||||
}
|
||||
|
||||
fn write_session_file(root: &Path, ts: &str, uuid: Uuid) -> std::io::Result<PathBuf> {
|
||||
write_session_file_with_user_message(root, ts, uuid, /*include_user_message*/ true)
|
||||
}
|
||||
|
||||
fn write_session_file_without_user_message(
|
||||
root: &Path,
|
||||
ts: &str,
|
||||
uuid: Uuid,
|
||||
) -> std::io::Result<PathBuf> {
|
||||
write_session_file_with_user_message(root, ts, uuid, /*include_user_message*/ false)
|
||||
}
|
||||
|
||||
fn write_session_file_with_user_message(
|
||||
root: &Path,
|
||||
ts: &str,
|
||||
uuid: Uuid,
|
||||
include_user_message: bool,
|
||||
) -> std::io::Result<PathBuf> {
|
||||
let day_dir = root.join("sessions/2025/01/03");
|
||||
fs::create_dir_all(&day_dir)?;
|
||||
let path = day_dir.join(format!("rollout-{ts}-{uuid}.jsonl"));
|
||||
@@ -66,18 +49,16 @@ fn write_session_file_with_user_message(
|
||||
},
|
||||
});
|
||||
writeln!(file, "{meta}")?;
|
||||
if include_user_message {
|
||||
let user_event = serde_json::json!({
|
||||
"timestamp": ts,
|
||||
"type": "event_msg",
|
||||
"payload": {
|
||||
"type": "user_message",
|
||||
"message": "Hello from user",
|
||||
"kind": "plain",
|
||||
},
|
||||
});
|
||||
writeln!(file, "{user_event}")?;
|
||||
}
|
||||
let user_event = serde_json::json!({
|
||||
"timestamp": ts,
|
||||
"type": "event_msg",
|
||||
"payload": {
|
||||
"type": "user_message",
|
||||
"message": "Hello from user",
|
||||
"kind": "plain",
|
||||
},
|
||||
});
|
||||
writeln!(file, "{user_event}")?;
|
||||
Ok(path)
|
||||
}
|
||||
|
||||
@@ -542,86 +523,6 @@ async fn list_threads_db_enabled_repairs_stale_rollout_paths() -> std::io::Resul
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn list_threads_db_enabled_fills_page_after_filtering_empty_threads() -> std::io::Result<()> {
|
||||
let home = TempDir::new().expect("temp dir");
|
||||
let config = test_config(home.path());
|
||||
|
||||
let empty_uuid = Uuid::from_u128(9015);
|
||||
let valid_uuid = Uuid::from_u128(9016);
|
||||
let empty_thread_id =
|
||||
ThreadId::from_string(&empty_uuid.to_string()).expect("valid empty thread id");
|
||||
let valid_thread_id = ThreadId::from_string(&valid_uuid.to_string()).expect("valid thread id");
|
||||
let empty_path =
|
||||
write_session_file_without_user_message(home.path(), "2025-01-03T15-00-00", empty_uuid)?;
|
||||
let valid_path = write_session_file(home.path(), "2025-01-03T14-00-00", valid_uuid)?;
|
||||
|
||||
let runtime = codex_state::StateRuntime::init(
|
||||
home.path().to_path_buf(),
|
||||
config.model_provider_id.clone(),
|
||||
)
|
||||
.await
|
||||
.expect("state db should initialize");
|
||||
runtime
|
||||
.mark_backfill_complete(/*last_watermark*/ None)
|
||||
.await
|
||||
.expect("backfill should be complete");
|
||||
|
||||
let empty_created_at = chrono::Utc
|
||||
.with_ymd_and_hms(2025, 1, 3, 15, 0, 0)
|
||||
.single()
|
||||
.expect("valid empty thread datetime");
|
||||
let mut empty_builder = codex_state::ThreadMetadataBuilder::new(
|
||||
empty_thread_id,
|
||||
empty_path,
|
||||
empty_created_at,
|
||||
SessionSource::Cli,
|
||||
);
|
||||
empty_builder.model_provider = Some(config.model_provider_id.clone());
|
||||
empty_builder.cwd = home.path().to_path_buf();
|
||||
let empty_metadata = empty_builder.build(config.model_provider_id.as_str());
|
||||
runtime
|
||||
.upsert_thread(&empty_metadata)
|
||||
.await
|
||||
.expect("state db empty upsert should succeed");
|
||||
|
||||
let valid_created_at = chrono::Utc
|
||||
.with_ymd_and_hms(2025, 1, 3, 14, 0, 0)
|
||||
.single()
|
||||
.expect("valid thread datetime");
|
||||
let mut valid_builder = codex_state::ThreadMetadataBuilder::new(
|
||||
valid_thread_id,
|
||||
valid_path.clone(),
|
||||
valid_created_at,
|
||||
SessionSource::Cli,
|
||||
);
|
||||
valid_builder.model_provider = Some(config.model_provider_id.clone());
|
||||
valid_builder.cwd = home.path().to_path_buf();
|
||||
let mut valid_metadata = valid_builder.build(config.model_provider_id.as_str());
|
||||
valid_metadata.first_user_message = Some("Hello from user".to_string());
|
||||
runtime
|
||||
.upsert_thread(&valid_metadata)
|
||||
.await
|
||||
.expect("state db valid upsert should succeed");
|
||||
|
||||
let default_provider = config.model_provider_id.clone();
|
||||
let page = RolloutRecorder::list_threads(
|
||||
&config,
|
||||
/*page_size*/ 1,
|
||||
/*cursor*/ None,
|
||||
ThreadSortKey::CreatedAt,
|
||||
&[],
|
||||
/*model_providers*/ None,
|
||||
default_provider.as_str(),
|
||||
/*search_term*/ None,
|
||||
)
|
||||
.await?;
|
||||
assert_eq!(page.items.len(), 1);
|
||||
assert_eq!(page.items[0].path, valid_path);
|
||||
assert!(page.next_cursor.is_none());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn resume_candidate_matches_cwd_reads_latest_turn_context() -> std::io::Result<()> {
|
||||
let home = TempDir::new().expect("temp dir");
|
||||
|
||||
@@ -105,7 +105,6 @@ pub struct ToolsConfig {
|
||||
pub collab_tools: bool,
|
||||
pub multi_agent_v2: bool,
|
||||
pub hide_spawn_agent_metadata: bool,
|
||||
pub request_user_input: bool,
|
||||
pub timer_scheduler: bool,
|
||||
pub spawn_agent_usage_hint: bool,
|
||||
pub spawn_agent_usage_hint_text: Option<String>,
|
||||
@@ -148,7 +147,6 @@ impl ToolsConfig {
|
||||
let include_collab_tools = features.enabled(Feature::Collab);
|
||||
let include_multi_agent_v2 = features.enabled(Feature::MultiAgentV2);
|
||||
let include_agent_jobs = features.enabled(Feature::SpawnCsv);
|
||||
let include_request_user_input = !matches!(session_source, SessionSource::SubAgent(_));
|
||||
let include_timer_scheduler = features.enabled(Feature::TimerScheduler);
|
||||
let include_default_mode_request_user_input =
|
||||
features.enabled(Feature::DefaultModeRequestUserInput);
|
||||
@@ -230,7 +228,6 @@ impl ToolsConfig {
|
||||
collab_tools: include_collab_tools,
|
||||
multi_agent_v2: include_multi_agent_v2,
|
||||
hide_spawn_agent_metadata: false,
|
||||
request_user_input: include_request_user_input,
|
||||
timer_scheduler: include_timer_scheduler,
|
||||
spawn_agent_usage_hint: true,
|
||||
spawn_agent_usage_hint_text: None,
|
||||
|
||||
Reference in New Issue
Block a user