chore: mechanical rename (#26156)

Rename `Session::conversation_id` to `Session::thread_id` with an auto
refactor in RustRover
This commit is contained in:
jif authored and GitHub committed 2026-06-03 15:38:30 +02:00
1 parent 7db18c8241
commit c9ae0f48a1
40 files changed
+207 -220

No files matched your search

@@ -211,7 +211,7 @@ async fn run_agent_job_loop(
"agent_job:{job_id}"
)))),
SpawnAgentOptions {
parent_thread_id: Some(session.conversation_id),
parent_thread_id: Some(session.thread_id),
environments: Some(turn.environments.to_selections()),
..Default::default()
},
@@ -61,7 +61,7 @@ pub async fn handle(
));
}
let db = required_state_db(&session)?;
let reporting_thread_id = session.conversation_id.to_string();
let reporting_thread_id = session.thread_id.to_string();
let accepted = db
.report_agent_job_item_result(
args.job_id.as_str(),
@@ -486,7 +486,7 @@ mod tests {
let (session, turn, rx) = crate::session::tests::make_session_and_context_with_rx().await;
let expected_path = crate::stream_events_utils::image_generation_artifact_path(
&turn.config.codex_home,
&session.conversation_id.to_string(),
&session.thread_id.to_string(),
"call-image",
);
let invocation = ToolInvocation {
@@ -53,7 +53,7 @@ async fn handle_close_agent(
CollabCloseBeginEvent {
call_id: call_id.clone(),
started_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
receiver_thread_id: agent_id,
}
.into(),
@@ -77,7 +77,7 @@ async fn handle_close_agent(
CollabCloseEndEvent {
call_id: call_id.clone(),
completed_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id(),
receiver_thread_id: agent_id,
receiver_agent_nickname: receiver_agent.agent_nickname.clone(),
receiver_agent_role: receiver_agent.agent_role.clone(),
@@ -99,7 +99,7 @@ async fn handle_close_agent(
CollabCloseEndEvent {
call_id,
completed_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
receiver_thread_id: agent_id,
receiver_agent_nickname: receiver_agent.agent_nickname,
receiver_agent_role: receiver_agent.agent_role,
@@ -66,7 +66,7 @@ async fn handle_resume_agent(
CollabResumeBeginEvent {
call_id: call_id.clone(),
started_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
receiver_thread_id,
receiver_agent_nickname: receiver_agent.agent_nickname.clone(),
receiver_agent_role: receiver_agent.agent_role.clone(),
@@ -122,7 +122,7 @@ async fn handle_resume_agent(
CollabResumeEndEvent {
call_id,
completed_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id(),
receiver_thread_id,
receiver_agent_nickname: receiver_agent.agent_nickname,
receiver_agent_role: receiver_agent.agent_role,
@@ -186,7 +186,7 @@ async fn try_resume_closed_agent(
config,
receiver_thread_id,
thread_spawn_source(
session.conversation_id,
session.thread_id(),
&turn.session_source,
child_depth,
/*agent_role*/ None,
@@ -58,7 +58,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
CollabAgentInteractionBeginEvent {
call_id: call_id.clone(),
started_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
receiver_thread_id,
prompt: prompt.clone(),
}
@@ -81,7 +81,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
CollabAgentInteractionEndEvent {
call_id,
completed_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
receiver_thread_id,
receiver_agent_nickname: receiver_agent.agent_nickname,
receiver_agent_role: receiver_agent.agent_role,
@@ -80,7 +80,7 @@ async fn handle_spawn_agent(
CollabAgentSpawnBeginEvent {
call_id: call_id.clone(),
started_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
prompt: prompt.clone(),
model: args.model.clone().unwrap_or_default(),
reasoning_effort: args.reasoning_effort.unwrap_or_default(),
@@ -121,7 +121,7 @@ async fn handle_spawn_agent(
config,
input_items,
Some(thread_spawn_source(
session.conversation_id,
session.thread_id,
&turn.session_source,
child_depth,
role_name,
@@ -130,7 +130,7 @@ async fn handle_spawn_agent(
SpawnAgentOptions {
fork_parent_spawn_call_id: args.fork_context.then(|| call_id.clone()),
fork_mode: args.fork_context.then_some(SpawnAgentForkMode::FullHistory),
parent_thread_id: Some(session.conversation_id),
parent_thread_id: Some(session.thread_id),
environments: Some(turn.environments.to_selections()),
},
))
@@ -183,7 +183,7 @@ async fn handle_spawn_agent(
CollabAgentSpawnEndEvent {
call_id,
completed_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
new_thread_id,
new_agent_nickname,
new_agent_role,
@@ -96,7 +96,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
&turn,
CollabWaitingBeginEvent {
started_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
receiver_thread_ids: receiver_thread_ids.clone(),
receiver_agents: receiver_agents.clone(),
call_id: call_id.clone(),
@@ -126,7 +126,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
.send_event(
&turn,
CollabWaitingEndEvent {
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
call_id: call_id.clone(),
completed_at_ms: now_unix_timestamp_ms(),
agent_statuses: build_wait_agent_statuses(
@@ -195,7 +195,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
.send_event(
&turn,
CollabWaitingEndEvent {
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
call_id,
completed_at_ms: now_unix_timestamp_ms(),
agent_statuses,
@@ -310,7 +310,7 @@ async fn spawn_agent_fork_context_rejects_agent_type_override() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let err = SpawnAgentHandler::default()
.handle(invocation(
Arc::new(session),
@@ -343,7 +343,7 @@ async fn spawn_agent_fork_context_rejects_child_model_overrides() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let err = SpawnAgentHandler::default()
.handle(invocation(
@@ -379,7 +379,7 @@ async fn multi_agent_v2_spawn_fork_turns_all_rejects_agent_type_override() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -424,7 +424,7 @@ async fn multi_agent_v2_spawn_defaults_to_full_fork_and_rejects_child_model_over
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -471,7 +471,7 @@ async fn spawn_agent_service_tier_override_validates_the_effective_child_model()
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let output = SpawnAgentHandler::default()
.handle(invocation(
@@ -576,7 +576,7 @@ async fn spawn_agent_service_tier_inheritance_preserves_supported_or_configured_
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let output = SpawnAgentHandler::default()
.handle(invocation(
@@ -617,7 +617,7 @@ async fn spawn_agent_service_tier_inheritance_preserves_supported_or_configured_
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let output = SpawnAgentHandler::default()
.handle(invocation(
@@ -680,7 +680,7 @@ service_tier = "priority"
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let output = SpawnAgentHandler::default()
.handle(invocation(
@@ -753,7 +753,7 @@ service_tier = "turbo"
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let output = SpawnAgentHandler::default()
.handle(invocation(
@@ -850,7 +850,7 @@ async fn spawn_agent_full_history_fork_accepts_explicit_service_tier() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let output = SpawnAgentHandler::default()
.handle(invocation(
@@ -904,7 +904,7 @@ async fn multi_agent_v2_full_history_fork_accepts_explicit_service_tier() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let session = Arc::new(session);
let turn = Arc::new(turn);
@@ -928,7 +928,7 @@ async fn multi_agent_v2_full_history_fork_accepts_explicit_service_tier() {
.services
.agent_control
.resolve_agent_reference(
session.conversation_id,
session.thread_id,
&turn.session_source,
result.task_name.as_str(),
)
@@ -957,7 +957,7 @@ async fn multi_agent_v2_spawn_partial_fork_turns_allows_agent_type_override() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -1041,7 +1041,7 @@ async fn multi_agent_v2_spawn_requires_task_name() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -1075,7 +1075,7 @@ async fn multi_agent_v2_spawn_rejects_legacy_items_field() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -1135,7 +1135,7 @@ async fn multi_agent_v2_spawn_returns_path_and_send_message_accepts_relative_pat
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -1166,11 +1166,7 @@ async fn multi_agent_v2_spawn_returns_path_and_send_message_accepts_relative_pat
let child_thread_id = session
.services
.agent_control
.resolve_agent_reference(
session.conversation_id,
&turn.session_source,
"test_process",
)
.resolve_agent_reference(session.thread_id, &turn.session_source, "test_process")
.await
.expect("relative path should resolve");
let child_snapshot = manager
@@ -1232,7 +1228,7 @@ async fn multi_agent_v2_spawn_rejects_legacy_fork_context() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -1272,7 +1268,7 @@ async fn multi_agent_v2_spawn_rejects_invalid_fork_turns_string() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -1312,7 +1308,7 @@ async fn multi_agent_v2_spawn_rejects_zero_fork_turns() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -1358,7 +1354,7 @@ async fn multi_agent_v2_send_message_accepts_root_target_from_child() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let child_path = AgentPath::try_from("/root/worker").expect("agent path");
let child_thread_id = session
@@ -1383,7 +1379,7 @@ async fn multi_agent_v2_send_message_accepts_root_target_from_child() {
.await
.expect("worker spawn should succeed")
.thread_id;
session.conversation_id = child_thread_id;
session.thread_id = child_thread_id;
turn.session_source = SessionSource::SubAgent(SubAgentSource::ThreadSpawn {
parent_thread_id: root.thread_id,
depth: 1,
@@ -1434,7 +1430,7 @@ async fn multi_agent_v2_followup_task_rejects_root_target_from_child() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let child_path = AgentPath::try_from("/root/worker").expect("agent path");
let child_thread_id = session
@@ -1459,7 +1455,7 @@ async fn multi_agent_v2_followup_task_rejects_root_target_from_child() {
.await
.expect("worker spawn should succeed")
.thread_id;
session.conversation_id = child_thread_id;
session.thread_id = child_thread_id;
turn.session_source = SessionSource::SubAgent(SubAgentSource::ThreadSpawn {
parent_thread_id: root.thread_id,
depth: 1,
@@ -1511,7 +1507,7 @@ async fn multi_agent_v2_list_agents_returns_completed_status_and_last_task_messa
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
let _ = config.features.enable(Feature::MultiAgentV2);
set_turn_config(&mut turn, config);
@@ -1535,7 +1531,7 @@ async fn multi_agent_v2_list_agents_returns_completed_status_and_last_task_messa
let agent_id = session
.services
.agent_control
.resolve_agent_reference(session.conversation_id, &turn.session_source, "worker")
.resolve_agent_reference(session.thread_id, &turn.session_source, "worker")
.await
.expect("worker path should resolve");
let child_thread = manager
@@ -1608,7 +1604,7 @@ async fn multi_agent_v2_list_agents_filters_by_relative_path_prefix() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let researcher_path = AgentPath::from_string("/root/researcher".to_string()).expect("path");
let worker_path = AgentPath::from_string("/root/researcher/worker".to_string()).expect("path");
@@ -1692,7 +1688,7 @@ async fn multi_agent_v2_list_agents_omits_closed_agents() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
let _ = config.features.enable(Feature::MultiAgentV2);
set_turn_config(&mut turn, config);
@@ -1716,7 +1712,7 @@ async fn multi_agent_v2_list_agents_omits_closed_agents() {
let agent_id = session
.services
.agent_control
.resolve_agent_reference(session.conversation_id, &turn.session_source, "worker")
.resolve_agent_reference(session.thread_id, &turn.session_source, "worker")
.await
.expect("worker path should resolve");
session
@@ -1756,7 +1752,7 @@ async fn multi_agent_v2_send_message_rejects_legacy_items_field() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = turn.config.as_ref().clone();
let _ = config.features.enable(Feature::MultiAgentV2);
set_turn_config(&mut turn, config);
@@ -1778,7 +1774,7 @@ async fn multi_agent_v2_send_message_rejects_legacy_items_field() {
let agent_id = session
.services
.agent_control
.resolve_agent_reference(session.conversation_id, &turn.session_source, "worker")
.resolve_agent_reference(session.thread_id, &turn.session_source, "worker")
.await
.expect("worker should resolve");
let invocation = invocation(
@@ -1812,7 +1808,7 @@ async fn multi_agent_v2_send_message_rejects_interrupt_parameter() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = turn.config.as_ref().clone();
let _ = config.features.enable(Feature::MultiAgentV2);
set_turn_config(&mut turn, config);
@@ -1834,7 +1830,7 @@ async fn multi_agent_v2_send_message_rejects_interrupt_parameter() {
let agent_id = session
.services
.agent_control
.resolve_agent_reference(session.conversation_id, &turn.session_source, "worker")
.resolve_agent_reference(session.thread_id, &turn.session_source, "worker")
.await
.expect("worker should resolve");
@@ -1891,7 +1887,7 @@ async fn multi_agent_v2_followup_task_completion_notifies_parent_on_every_turn()
// and stored its runtime; mirror that before using the synthetic handler.
root.thread.codex.session.new_default_turn().await;
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let session = Arc::new(session);
let turn = Arc::new(turn);
@@ -1910,7 +1906,7 @@ async fn multi_agent_v2_followup_task_completion_notifies_parent_on_every_turn()
let agent_id = session
.services
.agent_control
.resolve_agent_reference(session.conversation_id, &turn.session_source, "worker")
.resolve_agent_reference(session.thread_id, &turn.session_source, "worker")
.await
.expect("worker should resolve");
let thread = manager
@@ -2023,7 +2019,7 @@ async fn multi_agent_v2_followup_task_rejects_legacy_items_field() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = turn.config.as_ref().clone();
let _ = config.features.enable(Feature::MultiAgentV2);
set_turn_config(&mut turn, config);
@@ -2045,7 +2041,7 @@ async fn multi_agent_v2_followup_task_rejects_legacy_items_field() {
let agent_id = session
.services
.agent_control
.resolve_agent_reference(session.conversation_id, &turn.session_source, "worker")
.resolve_agent_reference(session.thread_id, &turn.session_source, "worker")
.await
.expect("worker should resolve");
let invocation = invocation(
@@ -2076,7 +2072,7 @@ async fn multi_agent_v2_interrupted_turn_does_not_notify_parent() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = turn.config.as_ref().clone();
let _ = config.features.enable(Feature::MultiAgentV2);
set_turn_config(&mut turn, config);
@@ -2098,7 +2094,7 @@ async fn multi_agent_v2_interrupted_turn_does_not_notify_parent() {
let agent_id = session
.services
.agent_control
.resolve_agent_reference(session.conversation_id, &turn.session_source, "worker")
.resolve_agent_reference(session.thread_id, &turn.session_source, "worker")
.await
.expect("worker should resolve");
let thread = manager
@@ -2153,7 +2149,7 @@ async fn multi_agent_v2_spawn_omits_agent_id_when_named() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -2192,7 +2188,7 @@ async fn multi_agent_v2_spawn_surfaces_task_name_validation_errors() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -2316,7 +2312,7 @@ async fn spawn_agent_rejects_when_depth_limit_exceeded() {
let max_depth = turn.config.agent_max_depth;
turn.session_source = SessionSource::SubAgent(SubAgentSource::ThreadSpawn {
parent_thread_id: session.conversation_id,
parent_thread_id: session.thread_id,
depth: max_depth,
agent_path: None,
agent_nickname: None,
@@ -2356,7 +2352,7 @@ async fn spawn_agent_allows_depth_up_to_configured_max_depth() {
config.agent_max_depth = DEFAULT_AGENT_MAX_DEPTH + 1;
turn.config = Arc::new(config);
turn.session_source = SessionSource::SubAgent(SubAgentSource::ThreadSpawn {
parent_thread_id: session.conversation_id,
parent_thread_id: session.thread_id,
depth: DEFAULT_AGENT_MAX_DEPTH,
agent_path: None,
agent_nickname: None,
@@ -2407,7 +2403,7 @@ async fn multi_agent_v2_spawn_agent_ignores_configured_max_depth() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
set_turn_config(&mut turn, config);
let parent_path = AgentPath::try_from("/root/parent").expect("agent path");
turn.session_source = SessionSource::SubAgent(SubAgentSource::ThreadSpawn {
@@ -2785,7 +2781,7 @@ async fn resume_agent_rejects_when_depth_limit_exceeded() {
let max_depth = turn.config.agent_max_depth;
turn.session_source = SessionSource::SubAgent(SubAgentSource::ThreadSpawn {
parent_thread_id: session.conversation_id,
parent_thread_id: session.thread_id,
depth: max_depth,
agent_path: None,
agent_nickname: None,
@@ -2875,7 +2871,7 @@ async fn multi_agent_v2_wait_agent_accepts_timeout_only_argument() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -2900,7 +2896,7 @@ async fn multi_agent_v2_wait_agent_accepts_timeout_only_argument() {
let agent_id = session
.services
.agent_control
.resolve_agent_reference(session.conversation_id, &turn.session_source, "worker")
.resolve_agent_reference(session.thread_id, &turn.session_source, "worker")
.await
.expect("worker should resolve");
let worker_path = session
@@ -3358,7 +3354,7 @@ async fn multi_agent_v2_wait_agent_returns_summary_for_mailbox_activity() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -3385,11 +3381,7 @@ async fn multi_agent_v2_wait_agent_returns_summary_for_mailbox_activity() {
let agent_id = session
.services
.agent_control
.resolve_agent_reference(
session.conversation_id,
&turn.session_source,
"test_process",
)
.resolve_agent_reference(session.thread_id, &turn.session_source, "test_process")
.await
.expect("relative path should resolve");
let worker_path = session
@@ -3452,7 +3444,7 @@ async fn multi_agent_v2_wait_agent_returns_for_already_queued_mail() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -3477,7 +3469,7 @@ async fn multi_agent_v2_wait_agent_returns_for_already_queued_mail() {
let agent_id = session
.services
.agent_control
.resolve_agent_reference(session.conversation_id, &turn.session_source, "worker")
.resolve_agent_reference(session.thread_id, &turn.session_source, "worker")
.await
.expect("worker should resolve");
let worker_path = session
@@ -3533,7 +3525,7 @@ async fn multi_agent_v2_wait_agent_wakes_on_any_mailbox_notification() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -3560,7 +3552,7 @@ async fn multi_agent_v2_wait_agent_wakes_on_any_mailbox_notification() {
let worker_b_id = session
.services
.agent_control
.resolve_agent_reference(session.conversation_id, &turn.session_source, "worker_b")
.resolve_agent_reference(session.thread_id, &turn.session_source, "worker_b")
.await
.expect("worker_b should resolve");
let worker_b_path = session
@@ -3624,7 +3616,7 @@ async fn multi_agent_v2_wait_agent_does_not_return_completed_content() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -3649,7 +3641,7 @@ async fn multi_agent_v2_wait_agent_does_not_return_completed_content() {
let agent_id = session
.services
.agent_control
.resolve_agent_reference(session.conversation_id, &turn.session_source, "worker")
.resolve_agent_reference(session.thread_id, &turn.session_source, "worker")
.await
.expect("worker should resolve");
let worker_path = session
@@ -3713,7 +3705,7 @@ async fn multi_agent_v2_close_agent_accepts_task_name_target() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -3739,7 +3731,7 @@ async fn multi_agent_v2_close_agent_accepts_task_name_target() {
let agent_id = session
.services
.agent_control
.resolve_agent_reference(session.conversation_id, &turn.session_source, "worker")
.resolve_agent_reference(session.thread_id, &turn.session_source, "worker")
.await
.expect("worker path should resolve");
@@ -3791,7 +3783,7 @@ async fn multi_agent_v2_close_agent_reaps_stale_task_name_target() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
set_turn_config(&mut turn, config.clone());
let session = Arc::new(session);
@@ -3812,7 +3804,7 @@ async fn multi_agent_v2_close_agent_reaps_stale_task_name_target() {
let agent_id = session
.services
.agent_control
.resolve_agent_reference(session.conversation_id, &turn.session_source, "worker")
.resolve_agent_reference(session.thread_id, &turn.session_source, "worker")
.await
.expect("worker path should resolve");
let stale_thread = manager
@@ -3872,7 +3864,7 @@ async fn multi_agent_v2_close_agent_reaps_stale_task_name_target() {
let replacement_id = session
.services
.agent_control
.resolve_agent_reference(session.conversation_id, &turn.session_source, "replacement")
.resolve_agent_reference(session.thread_id, &turn.session_source, "replacement")
.await
.expect("replacement path should resolve");
let _ = session
@@ -3892,7 +3884,7 @@ async fn multi_agent_v2_close_agent_rejects_root_target_and_id() {
.await
.expect("root thread should start");
session.services.agent_control = manager.agent_control();
session.conversation_id = root.thread_id;
session.thread_id = root.thread_id;
let mut config = (*turn.config).clone();
config
.features
@@ -61,7 +61,7 @@ async fn handle_close_agent(
CollabCloseBeginEvent {
call_id: call_id.clone(),
started_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
receiver_thread_id: agent_id,
}
.into(),
@@ -85,7 +85,7 @@ async fn handle_close_agent(
CollabCloseEndEvent {
call_id: call_id.clone(),
completed_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
receiver_thread_id: agent_id,
receiver_agent_nickname: receiver_agent.agent_nickname.clone(),
receiver_agent_role: receiver_agent.agent_role.clone(),
@@ -110,7 +110,7 @@ async fn handle_close_agent(
CollabCloseEndEvent {
call_id,
completed_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
receiver_thread_id: agent_id,
receiver_agent_nickname: receiver_agent.agent_nickname,
receiver_agent_role: receiver_agent.agent_role,
@@ -30,7 +30,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
session
.services
.agent_control
.register_session_root(session.conversation_id, turn.parent_thread_id);
.register_session_root(session.thread_id, turn.parent_thread_id);
let agents = session
.services
.agent_control
@@ -91,7 +91,7 @@ pub(crate) async fn handle_message_string_tool(
CollabAgentInteractionBeginEvent {
call_id: call_id.clone(),
started_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
receiver_thread_id,
prompt: prompt.clone(),
}
@@ -127,7 +127,7 @@ pub(crate) async fn handle_message_string_tool(
CollabAgentInteractionEndEvent {
call_id,
completed_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
receiver_thread_id,
receiver_agent_nickname: receiver_agent.agent_nickname,
receiver_agent_role: receiver_agent.agent_role,
@@ -72,7 +72,7 @@ async fn handle_spawn_agent(
CollabAgentSpawnBeginEvent {
call_id: call_id.clone(),
started_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
prompt: prompt.clone(),
model: args.model.clone().unwrap_or_default(),
reasoning_effort: args.reasoning_effort.unwrap_or_default(),
@@ -110,7 +110,7 @@ async fn handle_spawn_agent(
apply_spawn_agent_runtime_overrides(&mut config, turn.as_ref())?;
let spawn_source = thread_spawn_source(
session.conversation_id,
session.thread_id,
&turn.session_source,
child_depth,
role_name,
@@ -143,7 +143,7 @@ async fn handle_spawn_agent(
SpawnAgentOptions {
fork_parent_spawn_call_id: fork_mode.as_ref().map(|_| call_id.clone()),
fork_mode,
parent_thread_id: Some(session.conversation_id),
parent_thread_id: Some(session.thread_id),
environments: Some(turn.environments.to_selections()),
},
),
@@ -197,7 +197,7 @@ async fn handle_spawn_agent(
CollabAgentSpawnEndEvent {
call_id,
completed_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
new_thread_id,
new_agent_nickname,
new_agent_role,
@@ -67,7 +67,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
&turn,
CollabWaitingBeginEvent {
started_at_ms: now_unix_timestamp_ms(),
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
receiver_thread_ids: Vec::new(),
receiver_agents: Vec::new(),
call_id: call_id.clone(),
@@ -84,7 +84,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
.send_event(
&turn,
CollabWaitingEndEvent {
sender_thread_id: session.conversation_id,
sender_thread_id: session.thread_id,
call_id,
completed_at_ms: now_unix_timestamp_ms(),
agent_statuses: Vec::new(),
@@ -121,7 +121,7 @@ impl ToolExecutor<ToolInvocation> for RequestPluginInstallHandler {
let request_id = RequestId::String(format!("request_plugin_install_{call_id}").into());
let params = build_request_plugin_install_elicitation_request(
CODEX_APPS_MCP_SERVER_NAME,
session.conversation_id.to_string(),
session.thread_id.to_string(),
turn.sub_id.clone(),
&args,
suggest_reason,
@@ -179,7 +179,7 @@ impl ToolExecutor<ToolInvocation> for ShellCommandHandler {
&params,
session.as_ref(),
turn.as_ref(),
session.conversation_id,
session.thread_id,
turn.config.permissions.allow_login_shell,
)?;
let shell_type = Some(session.user_shell().shell_type.clone());
@@ -92,7 +92,7 @@ async fn shell_command_handler_to_exec_params_uses_session_shell_and_turn_contex
let expected_cwd = turn_context.resolve_path(workdir.clone());
let expected_env = create_env(
&turn_context.shell_environment_policy,
Some(session.conversation_id),
Some(session.thread_id),
);
let params = ShellCommandToolCallParams {
@@ -110,7 +110,7 @@ async fn shell_command_handler_to_exec_params_uses_session_shell_and_turn_contex
&params,
&session,
&turn_context,
session.conversation_id,
session.thread_id,
/*allow_login_shell*/ true,
)
.expect("login shells should be allowed");
@@ -177,7 +177,7 @@ async fn shell_command_handler_defaults_to_non_login_when_disallowed() {
&params,
&session,
&turn_context,
session.conversation_id,
session.thread_id,
/*allow_login_shell*/ false,
)
.expect("non-login shells should still be allowed");