This commit is contained in:
Roy Han
2026-03-24 15:16:50 -07:00
78 changed files with 740 additions and 53 deletions
@@ -82,6 +82,7 @@ use codex_protocol::protocol::SkillMetadata as CoreSkillMetadata;
use codex_protocol::protocol::SkillScope as CoreSkillScope;
use codex_protocol::protocol::SkillToolDependency as CoreSkillToolDependency;
use codex_protocol::protocol::SubAgentSource as CoreSubAgentSource;
use codex_protocol::protocol::SubmissionType;
use codex_protocol::protocol::TokenUsage as CoreTokenUsage;
use codex_protocol::protocol::TokenUsageInfo as CoreTokenUsageInfo;
use codex_protocol::request_permissions::PermissionGrantScope as CorePermissionGrantScope;
@@ -3925,6 +3926,10 @@ pub struct TurnStartParams {
/// Override the personality for this turn and subsequent turns.
#[ts(optional = nullable)]
pub personality: Option<Personality>,
/// Classify the primary input message submitted with `turn/start`.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional = nullable)]
pub submission_type: Option<SubmissionType>,
/// Optional JSON Schema used to constrain the final assistant message for
/// this turn.
#[ts(optional = nullable)]
@@ -8044,9 +8049,10 @@ mod tests {
service_tier: None,
effort: None,
summary: None,
personality: None,
submission_type: None,
output_schema: None,
collaboration_mode: None,
personality: None,
};
let serialized_without_override =
serde_json::to_value(&without_override).expect("params should serialize");
@@ -735,6 +735,7 @@ async fn trigger_zsh_fork_multi_cmd_approval(
text: message,
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
};
turn_params.approval_policy = Some(AskForApproval::OnRequest);
@@ -820,6 +821,7 @@ async fn resume_message_v2(
text: user_message,
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})?;
println!("< turn/start response: {turn_response:?}");
@@ -964,6 +966,7 @@ async fn send_message_v2_with_policies(
// Test client sends plain text without UI element ranges.
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
};
turn_params.approval_policy = policies.approval_policy;
@@ -1004,6 +1007,7 @@ async fn send_follow_up_v2(
// Test client sends plain text without UI element ranges.
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
};
let first_turn_response = client.turn_start(first_turn_params)?;
@@ -1017,6 +1021,7 @@ async fn send_follow_up_v2(
// Test client sends plain text without UI element ranges.
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
};
let follow_up_response = client.turn_start(follow_up_params)?;
@@ -1240,6 +1245,7 @@ fn live_elicitation_timeout_pause(
sandbox_policy: Some(SandboxPolicy::DangerFullAccess),
effort: Some(ReasoningEffort::High),
cwd: Some(workspace),
submission_type: None,
..Default::default()
})?;
println!("< turn/start response: {turn_response:?}");
@@ -6112,9 +6112,10 @@ impl CodexMessageProcessor {
.submit_core_op(
&request_id,
thread.as_ref(),
Op::UserInput {
Op::UserInputWithMetadata {
items: mapped_items,
final_output_json_schema: params.output_schema,
submission_type: params.submission_type,
},
)
.await;
@@ -599,6 +599,7 @@ async fn turn_start_jsonrpc_span_parents_core_turn_spans() -> Result<()> {
effort: None,
summary: None,
personality: None,
submission_type: None,
output_schema: None,
collaboration_mode: None,
},
@@ -419,6 +419,7 @@ async fn external_auth_refreshes_on_unauthorized() -> Result<()> {
text: "Hello".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -525,6 +526,7 @@ async fn external_auth_refresh_error_fails_turn() -> Result<()> {
text: "Hello".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -647,6 +649,7 @@ async fn external_auth_refresh_mismatched_workspace_fails_turn() -> Result<()> {
text: "Hello".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -762,6 +765,7 @@ async fn external_auth_refresh_invalid_access_token_fails_turn() -> Result<()> {
text: "Hello".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -342,6 +342,7 @@ async fn send_turn_and_wait(mcp: &mut McpProcess, thread_id: &str, text: &str) -
text: text.to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -202,6 +202,7 @@ async fn send_turn_start_request(stream: &mut WsClient, id: i64, thread_id: &str
text: "Hello".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})?),
)
@@ -86,6 +86,7 @@ async fn thread_start_injects_dynamic_tools_into_model_requests() -> Result<()>
text: "Hello".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -164,6 +165,7 @@ async fn thread_start_keeps_hidden_dynamic_tools_out_of_model_requests() -> Resu
text: "Hello".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -252,6 +254,7 @@ async fn dynamic_tool_call_round_trip_sends_text_content_items_to_model() -> Res
text: "Run the tool".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -420,6 +423,7 @@ async fn dynamic_tool_call_round_trip_sends_content_items_to_model() -> Result<(
text: "Run the tool".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -248,6 +248,7 @@ async fn turn_start_notify_payload_includes_initialize_client_name() -> Result<(
text: "Hello".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -137,6 +137,7 @@ async fn mcp_server_elicitation_round_trip() -> Result<()> {
text_elements: Vec::new(),
}],
model: Some("mock-model".to_string()),
submission_type: None,
..Default::default()
})
.await?;
@@ -169,6 +170,7 @@ async fn mcp_server_elicitation_round_trip() -> Result<()> {
text_elements: Vec::new(),
}],
model: Some("mock-model".to_string()),
submission_type: None,
..Default::default()
})
.await?;
@@ -63,6 +63,7 @@ async fn turn_start_accepts_output_schema_v2() -> Result<()> {
text: "Hello".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
output_schema: Some(output_schema.clone()),
..Default::default()
})
@@ -145,6 +146,7 @@ async fn turn_start_output_schema_is_per_turn_v2() -> Result<()> {
text: "Hello".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
output_schema: Some(output_schema.clone()),
..Default::default()
})
@@ -187,6 +189,7 @@ async fn turn_start_output_schema_is_per_turn_v2() -> Result<()> {
text: "Hello again".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
output_schema: None,
..Default::default()
})
@@ -156,6 +156,7 @@ async fn start_plan_mode_turn(mcp: &mut McpProcess) -> Result<codex_app_server_p
text: "Plan this".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
collaboration_mode: Some(collaboration_mode),
..Default::default()
})
@@ -54,6 +54,7 @@ async fn request_permissions_round_trip() -> Result<()> {
text_elements: Vec::new(),
}],
model: Some("mock-model".to_string()),
submission_type: None,
..Default::default()
})
.await?;
@@ -57,6 +57,7 @@ async fn request_user_input_round_trip() -> Result<()> {
}],
model: Some("mock-model".to_string()),
effort: Some(ReasoningEffort::Medium),
submission_type: None,
collaboration_mode: Some(CollaborationMode {
mode: ModeKind::Plan,
settings: Settings {
@@ -434,6 +434,7 @@ async fn materialize_thread_rollout(mcp: &mut McpProcess, thread_id: &str) -> Re
text: "materialize rollout".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -63,6 +63,7 @@ async fn openai_model_header_mismatch_emits_model_rerouted_notification_v2() ->
text: "trigger safeguard".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -136,6 +137,7 @@ async fn response_model_field_mismatch_emits_model_rerouted_notification_v2_when
text: "trigger response model check".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -92,6 +92,7 @@ async fn thread_archive_requires_materialized_rollout() -> Result<()> {
text: "materialize".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -189,6 +190,7 @@ async fn thread_archive_clears_stale_subscriptions_before_resume() -> Result<()>
text: "materialize".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -266,6 +268,7 @@ async fn thread_archive_clears_stale_subscriptions_before_resume() -> Result<()>
text: "secondary turn".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -463,6 +463,7 @@ async fn thread_fork_ephemeral_remains_pathless_and_omits_listing() -> Result<()
text: "continue".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -217,6 +217,7 @@ async fn thread_list_reports_system_error_idle_flag_after_failed_turn() -> Resul
text: "seed history".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -239,6 +240,7 @@ async fn thread_list_reports_system_error_idle_flag_after_failed_turn() -> Resul
text: "fail turn".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -441,6 +441,7 @@ async fn thread_read_reports_system_error_idle_flag_after_failed_turn() -> Resul
text: "fail this turn".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -564,6 +564,7 @@ async fn thread_resume_without_overrides_does_not_change_updated_at_or_mtime() -
text: "Hello".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -613,6 +614,7 @@ async fn thread_resume_keeps_in_flight_turn_streaming() -> Result<()> {
text: "seed history".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -638,6 +640,7 @@ async fn thread_resume_keeps_in_flight_turn_streaming() -> Result<()> {
text: "respond with docs".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -720,6 +723,7 @@ async fn thread_resume_rejects_history_when_thread_is_running() -> Result<()> {
text: "seed history".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -743,6 +747,7 @@ async fn thread_resume_rejects_history_when_thread_is_running() -> Result<()> {
text: "keep running".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -836,6 +841,7 @@ async fn thread_resume_rejects_mismatched_path_when_thread_is_running() -> Resul
text: "seed history".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -859,6 +865,7 @@ async fn thread_resume_rejects_mismatched_path_when_thread_is_running() -> Resul
text: "keep running".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -942,6 +949,7 @@ async fn thread_resume_rejoins_running_thread_even_with_override_mismatch() -> R
text: "seed history".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -964,6 +972,7 @@ async fn thread_resume_rejoins_running_thread_even_with_override_mismatch() -> R
text: "keep running".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -1055,6 +1064,7 @@ async fn thread_resume_replays_pending_command_execution_request_approval() -> R
text: "seed history".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -1078,6 +1088,7 @@ async fn thread_resume_replays_pending_command_execution_request_approval() -> R
text_elements: Vec::new(),
}],
approval_policy: Some(AskForApproval::UnlessTrusted),
submission_type: None,
..Default::default()
})
.await?;
@@ -1194,6 +1205,7 @@ async fn thread_resume_replays_pending_file_change_request_approval() -> Result<
text_elements: Vec::new(),
}],
cwd: Some(workspace.clone()),
submission_type: None,
..Default::default()
})
.await?;
@@ -1218,6 +1230,7 @@ async fn thread_resume_replays_pending_file_change_request_approval() -> Result<
}],
cwd: Some(workspace.clone()),
approval_policy: Some(AskForApproval::UnlessTrusted),
submission_type: None,
..Default::default()
})
.await?;
@@ -1362,6 +1375,7 @@ async fn thread_resume_with_overrides_defers_updated_at_until_turn_start() -> Re
text: "Hello".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -1541,6 +1555,7 @@ async fn thread_resume_prefers_path_over_thread_id() -> Result<()> {
text: "materialize".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -1661,6 +1676,7 @@ async fn start_materialized_thread_and_restart(
text: seed_text.to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -1735,6 +1751,7 @@ async fn thread_resume_accepts_personality_override() -> Result<()> {
text: "seed history".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -1775,6 +1792,7 @@ async fn thread_resume_accepts_personality_override() -> Result<()> {
text: "Hello".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -61,6 +61,7 @@ async fn thread_rollback_drops_last_turns_and_persists_to_rollout() -> Result<()
text: first_text.to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -82,6 +83,7 @@ async fn thread_rollback_drops_last_turns_and_persists_to_rollout() -> Result<()
text: "Second".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -205,6 +205,7 @@ async fn thread_shell_command_uses_existing_active_turn() -> Result<()> {
text_elements: Vec::new(),
}],
cwd: Some(workspace.clone()),
submission_type: None,
..Default::default()
})
.await?;
@@ -53,6 +53,7 @@ async fn thread_status_changed_emits_runtime_updates() -> Result<()> {
text_elements: Vec::new(),
}],
model: Some("mock-model".to_string()),
submission_type: None,
..Default::default()
})
.await?;
@@ -175,6 +176,7 @@ async fn thread_status_changed_can_be_opted_out() -> Result<()> {
text_elements: Vec::new(),
}],
model: Some("mock-model".to_string()),
submission_type: None,
..Default::default()
})
.await?;
@@ -60,6 +60,7 @@ async fn thread_unarchive_moves_rollout_back_into_sessions_directory() -> Result
text: "materialize".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -177,6 +177,7 @@ async fn thread_unsubscribe_during_turn_interrupts_turn_and_emits_thread_closed(
text_elements: Vec::new(),
}],
cwd: Some(working_directory),
submission_type: None,
..Default::default()
})
.await?;
@@ -250,6 +251,7 @@ async fn thread_unsubscribe_clears_cached_status_before_resume() -> Result<()> {
text: "fail this turn".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -78,6 +78,7 @@ async fn turn_interrupt_aborts_running_turn() -> Result<()> {
text_elements: Vec::new(),
}],
cwd: Some(working_directory.clone()),
submission_type: None,
..Default::default()
})
.await?;
@@ -172,6 +173,7 @@ async fn turn_interrupt_resolves_pending_command_approval_request() -> Result<()
text_elements: Vec::new(),
}],
cwd: Some(working_directory),
submission_type: None,
..Default::default()
})
.await?;
@@ -121,6 +121,7 @@ async fn turn_start_sends_originator_header() -> Result<()> {
text: "Hello".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -192,6 +193,7 @@ async fn turn_start_emits_user_message_item_with_text_elements() -> Result<()> {
text: "Hello".to_string(),
text_elements: text_elements.clone(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -280,6 +282,7 @@ async fn turn_start_accepts_text_at_limit_with_mention_item() -> Result<()> {
path: "app://demo-app".to_string(),
},
],
submission_type: None,
..Default::default()
})
.await?;
@@ -343,6 +346,7 @@ async fn turn_start_rejects_combined_oversized_text_input() -> Result<()> {
text_elements: Vec::new(),
},
],
submission_type: None,
..Default::default()
})
.await?;
@@ -419,6 +423,7 @@ async fn turn_start_emits_notifications_and_accepts_model_override() -> Result<(
text: "Hello".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -468,6 +473,7 @@ async fn turn_start_emits_notifications_and_accepts_model_override() -> Result<(
text_elements: Vec::new(),
}],
model: Some("mock-model-override".to_string()),
submission_type: None,
..Default::default()
})
.await?;
@@ -564,6 +570,7 @@ async fn turn_start_accepts_collaboration_mode_override_v2() -> Result<()> {
model: Some("mock-model-override".to_string()),
effort: Some(ReasoningEffort::Low),
summary: Some(ReasoningSummary::Auto),
submission_type: None,
output_schema: None,
collaboration_mode: Some(collaboration_mode),
..Default::default()
@@ -651,6 +658,7 @@ async fn turn_start_uses_thread_feature_overrides_for_collaboration_mode_instruc
model: Some("mock-model-override".to_string()),
effort: Some(ReasoningEffort::Low),
summary: Some(ReasoningSummary::Auto),
submission_type: None,
output_schema: None,
collaboration_mode: Some(collaboration_mode),
..Default::default()
@@ -720,6 +728,7 @@ async fn turn_start_accepts_personality_override_v2() -> Result<()> {
text_elements: Vec::new(),
}],
personality: Some(Personality::Friendly),
submission_type: None,
..Default::default()
})
.await?;
@@ -801,6 +810,7 @@ async fn turn_start_change_personality_mid_thread_v2() -> Result<()> {
text_elements: Vec::new(),
}],
personality: None,
submission_type: None,
..Default::default()
})
.await?;
@@ -825,6 +835,7 @@ async fn turn_start_change_personality_mid_thread_v2() -> Result<()> {
text_elements: Vec::new(),
}],
personality: Some(Personality::Friendly),
submission_type: None,
..Default::default()
})
.await?;
@@ -927,6 +938,7 @@ async fn turn_start_uses_migrated_pragmatic_personality_without_override_v2() ->
text_elements: Vec::new(),
}],
personality: None,
submission_type: None,
..Default::default()
})
.await?;
@@ -995,6 +1007,7 @@ async fn turn_start_accepts_local_image_input() -> Result<()> {
.send_turn_start_request(TurnStartParams {
thread_id: thread.id.clone(),
input: vec![V2UserInput::LocalImage { path: image_path }],
submission_type: None,
..Default::default()
})
.await?;
@@ -1082,6 +1095,7 @@ async fn turn_start_exec_approval_toggle_v2() -> Result<()> {
text: "run python".to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -1151,6 +1165,7 @@ async fn turn_start_exec_approval_toggle_v2() -> Result<()> {
model: Some("mock-model".to_string()),
effort: Some(ReasoningEffort::Medium),
summary: Some(ReasoningSummary::Auto),
submission_type: None,
..Default::default()
})
.await?;
@@ -1224,6 +1239,7 @@ async fn turn_start_exec_approval_decline_v2() -> Result<()> {
text_elements: Vec::new(),
}],
cwd: Some(workspace.clone()),
submission_type: None,
..Default::default()
})
.await?;
@@ -1392,6 +1408,7 @@ async fn turn_start_updates_sandbox_and_cwd_between_turns_v2() -> Result<()> {
summary: Some(ReasoningSummary::Auto),
service_tier: None,
personality: None,
submission_type: None,
output_schema: None,
collaboration_mode: None,
})
@@ -1425,6 +1442,7 @@ async fn turn_start_updates_sandbox_and_cwd_between_turns_v2() -> Result<()> {
summary: Some(ReasoningSummary::Auto),
service_tier: None,
personality: None,
submission_type: None,
output_schema: None,
collaboration_mode: None,
})
@@ -1527,6 +1545,7 @@ async fn turn_start_file_change_approval_v2() -> Result<()> {
text_elements: Vec::new(),
}],
cwd: Some(workspace.clone()),
submission_type: None,
..Default::default()
})
.await?;
@@ -1744,6 +1763,7 @@ async fn turn_start_emits_spawn_agent_item_with_model_metadata_v2() -> Result<()
text: PARENT_PROMPT.to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -1958,6 +1978,7 @@ config_file = "./custom-role.toml"
text: PARENT_PROMPT.to_string(),
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
})
.await?;
@@ -2104,6 +2125,7 @@ async fn turn_start_file_change_approval_accept_for_session_persists_v2() -> Res
text_elements: Vec::new(),
}],
cwd: Some(workspace.clone()),
submission_type: None,
..Default::default()
})
.await?;
@@ -2181,6 +2203,7 @@ async fn turn_start_file_change_approval_accept_for_session_persists_v2() -> Res
text_elements: Vec::new(),
}],
cwd: Some(workspace.clone()),
submission_type: None,
..Default::default()
})
.await?;
@@ -2284,6 +2307,7 @@ async fn turn_start_file_change_approval_decline_v2() -> Result<()> {
text_elements: Vec::new(),
}],
cwd: Some(workspace.clone()),
submission_type: None,
..Default::default()
})
.await?;
@@ -2429,6 +2453,7 @@ async fn command_execution_notifications_include_process_id() -> Result<()> {
text_elements: Vec::new(),
}],
sandbox_policy: Some(codex_app_server_protocol::SandboxPolicy::DangerFullAccess),
submission_type: None,
..Default::default()
})
.await?;
@@ -127,6 +127,7 @@ async fn turn_start_shell_zsh_fork_executes_command_v2() -> Result<()> {
model: Some("mock-model".to_string()),
effort: Some(codex_protocol::openai_models::ReasoningEffort::Medium),
summary: Some(codex_protocol::config_types::ReasoningSummary::Auto),
submission_type: None,
..Default::default()
})
.await?;
@@ -241,6 +242,7 @@ async fn turn_start_shell_zsh_fork_exec_approval_decline_v2() -> Result<()> {
text_elements: Vec::new(),
}],
cwd: Some(workspace.clone()),
submission_type: None,
..Default::default()
})
.await?;
@@ -374,6 +376,7 @@ async fn turn_start_shell_zsh_fork_exec_approval_cancel_v2() -> Result<()> {
text_elements: Vec::new(),
}],
cwd: Some(workspace.clone()),
submission_type: None,
..Default::default()
})
.await?;
@@ -544,6 +547,7 @@ async fn turn_start_shell_zsh_fork_subcommand_decline_marks_parent_declined_v2()
model: Some("mock-model".to_string()),
effort: Some(codex_protocol::openai_models::ReasoningEffort::Medium),
summary: Some(codex_protocol::config_types::ReasoningSummary::Auto),
submission_type: None,
..Default::default()
})
.await?;
@@ -121,6 +121,7 @@ async fn turn_steer_rejects_oversized_text_input() -> Result<()> {
text_elements: Vec::new(),
}],
cwd: Some(working_directory.clone()),
submission_type: None,
..Default::default()
})
.await?;
@@ -224,6 +225,7 @@ async fn turn_steer_returns_active_turn_id() -> Result<()> {
text_elements: Vec::new(),
}],
cwd: Some(working_directory.clone()),
submission_type: None,
..Default::default()
})
.await?;
+90 -3
View File
@@ -1,15 +1,16 @@
use crate::AuthManager;
use crate::config::Config;
use crate::default_client::create_client;
use crate::git_info::collect_git_info;
use crate::git_info::get_git_repo_root;
use crate::plugins::PluginTelemetryMetadata;
use codex_git_utils::collect_git_info;
use codex_git_utils::get_git_repo_root;
use codex_protocol::config_types::ModeKind;
use codex_protocol::config_types::ReasoningSummary;
use codex_protocol::config_types::ServiceTier;
use codex_protocol::openai_models::ReasoningEffort;
use codex_protocol::protocol::SandboxPolicy;
use codex_protocol::protocol::SkillScope;
use codex_protocol::protocol::SubmissionType;
use serde::Serialize;
use sha1::Digest;
use sha1::Sha1;
@@ -30,6 +31,7 @@ pub(crate) struct TrackEventsContext {
#[derive(Clone)]
pub(crate) struct CodexTurnEvent {
pub(crate) submission_type: Option<SubmissionType>,
pub(crate) sandbox_policy: SandboxPolicy,
pub(crate) reasoning_effort: Option<ReasoningEffort>,
pub(crate) reasoning_summary: ReasoningSummary,
@@ -37,6 +39,9 @@ pub(crate) struct CodexTurnEvent {
pub(crate) collaboration_mode: ModeKind,
}
#[derive(Clone, Copy)]
pub(crate) struct CodexTurnSteerEvent;
pub(crate) fn build_track_events_context(
model_slug: String,
thread_id: String,
@@ -101,6 +106,9 @@ impl AnalyticsEventsQueue {
TrackEventsJob::TurnEvent(job) => {
send_track_turn_event(&auth_manager, job).await;
}
TrackEventsJob::TurnSteer(job) => {
send_track_turn_steer(&auth_manager, job).await;
}
TrackEventsJob::PluginUsed(job) => {
send_track_plugin_used(&auth_manager, job).await;
}
@@ -227,6 +235,19 @@ impl AnalyticsEventsClient {
);
}
pub(crate) fn track_turn_steer(
&self,
tracking: TrackEventsContext,
turn_steer: CodexTurnSteerEvent,
) {
track_turn_steer(
&self.queue,
Arc::clone(&self.config),
Some(tracking),
turn_steer,
);
}
pub fn track_plugin_installed(&self, plugin: PluginTelemetryMetadata) {
track_plugin_management(
&self.queue,
@@ -269,6 +290,7 @@ enum TrackEventsJob {
AppMentioned(TrackAppMentionedJob),
AppUsed(TrackAppUsedJob),
TurnEvent(TrackTurnEventJob),
TurnSteer(TrackTurnSteerJob),
PluginUsed(TrackPluginUsedJob),
PluginInstalled(TrackPluginManagementJob),
PluginUninstalled(TrackPluginManagementJob),
@@ -300,6 +322,12 @@ struct TrackTurnEventJob {
turn_event: CodexTurnEvent,
}
struct TrackTurnSteerJob {
config: Arc<Config>,
tracking: TrackEventsContext,
turn_steer: CodexTurnSteerEvent,
}
struct TrackPluginUsedJob {
config: Arc<Config>,
tracking: TrackEventsContext,
@@ -383,16 +411,27 @@ struct CodexAppUsedEventRequest {
event_params: CodexAppMetadata,
}
#[derive(Serialize)]
#[derive(Default, Serialize)]
struct CodexTurnEventParams {
#[serde(skip_serializing_if = "Option::is_none")]
thread_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
turn_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
product_client_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
model_slug: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
submission_type: Option<SubmissionType>,
#[serde(skip_serializing_if = "Option::is_none")]
sandbox_policy: Option<&'static str>,
#[serde(skip_serializing_if = "Option::is_none")]
reasoning_effort: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reasoning_summary: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
service_tier: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
collaboration_mode: Option<&'static str>,
}
@@ -523,6 +562,26 @@ pub(crate) fn track_turn_event(
queue.try_send(job);
}
pub(crate) fn track_turn_steer(
queue: &AnalyticsEventsQueue,
config: Arc<Config>,
tracking: Option<TrackEventsContext>,
turn_steer: CodexTurnSteerEvent,
) {
if config.analytics_enabled == Some(false) {
return;
}
let Some(tracking) = tracking else {
return;
};
let job = TrackEventsJob::TurnSteer(TrackTurnSteerJob {
config,
tracking,
turn_steer,
});
queue.try_send(job);
}
pub(crate) fn track_plugin_used(
queue: &AnalyticsEventsQueue,
config: Arc<Config>,
@@ -662,6 +721,20 @@ async fn send_track_turn_event(auth_manager: &AuthManager, job: TrackTurnEventJo
send_track_events(auth_manager, config, events).await;
}
async fn send_track_turn_steer(auth_manager: &AuthManager, job: TrackTurnSteerJob) {
let TrackTurnSteerJob {
config,
tracking,
turn_steer,
} = job;
let events = vec![TrackEventRequest::TurnEvent(CodexTurnEventRequest {
event_type: "codex_turn_event",
event_params: codex_turn_steer_event_params(&tracking, turn_steer),
})];
send_track_events(auth_manager, config, events).await;
}
async fn send_track_plugin_used(auth_manager: &AuthManager, job: TrackPluginUsedJob) {
let TrackPluginUsedJob {
config,
@@ -735,6 +808,7 @@ fn codex_turn_event_params(
turn_id: Some(tracking.turn_id.clone()),
product_client_id: Some(crate::default_client::originator().value),
model_slug: Some(tracking.model_slug.clone()),
submission_type: turn_event.submission_type,
sandbox_policy: Some(sandbox_policy_mode(&turn_event.sandbox_policy)),
reasoning_effort: turn_event.reasoning_effort.map(|value| value.to_string()),
reasoning_summary: Some(turn_event.reasoning_summary.to_string()),
@@ -743,6 +817,19 @@ fn codex_turn_event_params(
}
}
fn codex_turn_steer_event_params(
tracking: &TrackEventsContext,
_turn_steer: CodexTurnSteerEvent,
) -> CodexTurnEventParams {
CodexTurnEventParams {
thread_id: Some(tracking.thread_id.clone()),
turn_id: Some(tracking.turn_id.clone()),
product_client_id: Some(crate::default_client::originator().value),
model_slug: Some(tracking.model_slug.clone()),
..Default::default()
}
}
fn sandbox_policy_mode(sandbox_policy: &SandboxPolicy) -> &'static str {
match sandbox_policy {
SandboxPolicy::DangerFullAccess => "full_access",
+34 -1
View File
@@ -6,13 +6,16 @@ use super::CodexPluginEventRequest;
use super::CodexPluginUsedEventRequest;
use super::CodexTurnEvent;
use super::CodexTurnEventRequest;
use super::CodexTurnSteerEvent;
use super::InvocationType;
use super::SubmissionType;
use super::TrackEventRequest;
use super::TrackEventsContext;
use super::codex_app_metadata;
use super::codex_plugin_metadata;
use super::codex_plugin_used_metadata;
use super::codex_turn_event_params;
use super::codex_turn_steer_event_params;
use super::normalize_path_for_skill_id;
use crate::plugins::AppConnectorId;
use crate::plugins::PluginCapabilitySummary;
@@ -205,6 +208,7 @@ fn turn_event_serializes_expected_shape() {
event_params: codex_turn_event_params(
&tracking,
CodexTurnEvent {
submission_type: Some(SubmissionType::Prompt),
sandbox_policy: SandboxPolicy::new_read_only_policy(),
reasoning_effort: Some(ReasoningEffort::High),
reasoning_summary: ReasoningSummary::Detailed,
@@ -214,7 +218,7 @@ fn turn_event_serializes_expected_shape() {
),
});
let payload = serde_json::to_value(&event).expect("serialize turn event");
let payload = serde_json::to_value(&event).expect("serialize codex turn event");
assert_eq!(
payload,
@@ -225,6 +229,7 @@ fn turn_event_serializes_expected_shape() {
"turn_id": "turn-2",
"product_client_id": crate::default_client::originator().value,
"model_slug": "gpt-5",
"submission_type": "prompt",
"sandbox_policy": "read_only",
"reasoning_effort": "high",
"reasoning_summary": "detailed",
@@ -235,6 +240,34 @@ fn turn_event_serializes_expected_shape() {
);
}
#[test]
fn turn_steer_event_serializes_expected_shape() {
let tracking = TrackEventsContext {
model_slug: "gpt-5".to_string(),
thread_id: "thread-2".to_string(),
turn_id: "turn-2".to_string(),
};
let event = TrackEventRequest::TurnEvent(CodexTurnEventRequest {
event_type: "codex_turn_event",
event_params: codex_turn_steer_event_params(&tracking, CodexTurnSteerEvent),
});
let payload = serde_json::to_value(&event).expect("serialize codex turn steer event");
assert_eq!(
payload,
json!({
"event_type": "codex_turn_event",
"event_params": {
"thread_id": "thread-2",
"turn_id": "turn-2",
"product_client_id": crate::default_client::originator().value,
"model_slug": "gpt-5"
}
})
);
}
#[test]
fn plugin_used_event_serializes_expected_shape() {
let tracking = TrackEventsContext {
+75 -41
View File
@@ -15,6 +15,7 @@ use crate::agent::agent_status_from_event;
use crate::analytics_client::AnalyticsEventsClient;
use crate::analytics_client::AppInvocation;
use crate::analytics_client::CodexTurnEvent;
use crate::analytics_client::CodexTurnSteerEvent;
use crate::analytics_client::InvocationType;
use crate::analytics_client::build_track_events_context;
use crate::apps::render_apps_section;
@@ -104,6 +105,7 @@ use codex_protocol::protocol::ReviewRequest;
use codex_protocol::protocol::RolloutItem;
use codex_protocol::protocol::SessionSource;
use codex_protocol::protocol::SubAgentSource;
use codex_protocol::protocol::SubmissionType;
use codex_protocol::protocol::TurnAbortReason;
use codex_protocol::protocol::TurnContextItem;
use codex_protocol::protocol::TurnContextNetworkItem;
@@ -236,6 +238,9 @@ pub(crate) struct PreviousTurnSettings {
use crate::exec_policy::ExecPolicyUpdateError;
use crate::feedback_tags;
use crate::file_watcher::FileWatcher;
use crate::file_watcher::FileWatcherEvent;
use crate::git_info::get_git_repo_root;
use crate::guardian::GuardianReviewSessionManager;
use crate::hook_runtime::PendingInputHookDisposition;
use crate::hook_runtime::inspect_pending_input;
@@ -320,8 +325,6 @@ use crate::skills::injection::ToolMentionKind;
use crate::skills::injection::app_id_from_path;
use crate::skills::injection::tool_kind_for_path;
use crate::skills::resolve_skill_dependencies_for_turn;
use crate::skills_watcher::SkillsWatcher;
use crate::skills_watcher::SkillsWatcherEvent;
use crate::state::ActiveTurn;
use crate::state::SessionServices;
use crate::state::SessionState;
@@ -350,7 +353,6 @@ use crate::unified_exec::UnifiedExecProcessManager;
use crate::util::backoff;
use crate::windows_sandbox::WindowsSandboxLevelExt;
use codex_async_utils::OrCancelExt;
use codex_git_utils::get_git_repo_root;
use codex_otel::SessionTelemetry;
use codex_otel::TelemetryAuthMode;
use codex_otel::metrics::names::THREAD_STARTED_METRIC;
@@ -404,7 +406,7 @@ pub(crate) struct CodexSpawnArgs {
pub(crate) skills_manager: Arc<SkillsManager>,
pub(crate) plugins_manager: Arc<PluginsManager>,
pub(crate) mcp_manager: Arc<McpManager>,
pub(crate) skills_watcher: Arc<SkillsWatcher>,
pub(crate) file_watcher: Arc<FileWatcher>,
pub(crate) conversation_history: InitialHistory,
pub(crate) session_source: SessionSource,
pub(crate) agent_control: AgentControl,
@@ -457,7 +459,7 @@ impl Codex {
skills_manager,
plugins_manager,
mcp_manager,
skills_watcher,
file_watcher,
conversation_history,
session_source,
agent_control,
@@ -645,7 +647,7 @@ impl Codex {
skills_manager,
plugins_manager,
mcp_manager.clone(),
skills_watcher,
file_watcher,
agent_control,
)
.await
@@ -848,6 +850,7 @@ pub(crate) struct TurnContext {
pub(crate) user_instructions: Option<String>,
pub(crate) collaboration_mode: CollaborationMode,
pub(crate) personality: Option<Personality>,
pub(crate) submission_type: Option<SubmissionType>,
pub(crate) approval_policy: Constrained<AskForApproval>,
pub(crate) sandbox_policy: Constrained<SandboxPolicy>,
pub(crate) file_system_sandbox_policy: FileSystemSandboxPolicy,
@@ -944,6 +947,7 @@ impl TurnContext {
provider: self.provider.clone(),
reasoning_effort,
reasoning_summary: self.reasoning_summary,
submission_type: None,
session_source: self.session_source.clone(),
environment: Arc::clone(&self.environment),
cwd: self.cwd.clone(),
@@ -1185,6 +1189,7 @@ pub(crate) struct SessionSettingsUpdate {
pub(crate) final_output_json_schema: Option<Option<Value>>,
pub(crate) personality: Option<Personality>,
pub(crate) app_server_client_name: Option<String>,
pub(crate) submission_type: Option<SubmissionType>,
}
impl Session {
@@ -1298,13 +1303,13 @@ impl Session {
self.out_of_band_elicitation_paused.send_replace(paused);
}
fn start_skills_watcher_listener(self: &Arc<Self>) {
let mut rx = self.services.skills_watcher.subscribe();
fn start_file_watcher_listener(self: &Arc<Self>) {
let mut rx = self.services.file_watcher.subscribe();
let weak_sess = Arc::downgrade(self);
tokio::spawn(async move {
loop {
match rx.recv().await {
Ok(SkillsWatcherEvent::SkillsChanged { .. }) => {
Ok(FileWatcherEvent::SkillsChanged { .. }) => {
let Some(sess) = weak_sess.upgrade() else {
break;
};
@@ -1403,6 +1408,7 @@ impl Session {
user_instructions: session_configuration.user_instructions.clone(),
collaboration_mode: session_configuration.collaboration_mode.clone(),
personality: session_configuration.personality,
submission_type: None,
approval_policy: session_configuration.approval_policy.clone(),
sandbox_policy: session_configuration.sandbox_policy.clone(),
file_system_sandbox_policy: session_configuration.file_system_sandbox_policy.clone(),
@@ -1440,7 +1446,7 @@ impl Session {
skills_manager: Arc<SkillsManager>,
plugins_manager: Arc<PluginsManager>,
mcp_manager: Arc<McpManager>,
skills_watcher: Arc<SkillsWatcher>,
file_watcher: Arc<FileWatcher>,
agent_control: AgentControl,
) -> anyhow::Result<Arc<Self>> {
debug!(
@@ -1859,7 +1865,7 @@ impl Session {
skills_manager,
plugins_manager: Arc::clone(&plugins_manager),
mcp_manager: Arc::clone(&mcp_manager),
skills_watcher,
file_watcher,
agent_control,
network_proxy,
network_approval: Arc::clone(&network_approval),
@@ -1938,7 +1944,7 @@ impl Session {
}
// Start the watcher after SessionConfigured so it cannot emit earlier events.
sess.start_skills_watcher_listener();
sess.start_file_watcher_listener();
// Construct sandbox_state before MCP startup so it can be sent to each
// MCP server immediately after it becomes ready (avoiding blocking).
let sandbox_state = SandboxState {
@@ -2394,6 +2400,7 @@ impl Session {
sub_id,
session_configuration,
updates.final_output_json_schema,
updates.submission_type,
sandbox_policy_changed,
)
.await)
@@ -2404,6 +2411,7 @@ impl Session {
sub_id: String,
session_configuration: SessionConfiguration,
final_output_json_schema: Option<Option<Value>>,
submission_type: Option<SubmissionType>,
sandbox_policy_changed: bool,
) -> Arc<TurnContext> {
let per_turn_config = Self::build_per_turn_config(&session_configuration);
@@ -2471,6 +2479,7 @@ impl Session {
if let Some(final_schema) = final_output_json_schema {
turn_context.final_output_json_schema = final_schema;
}
turn_context.submission_type = submission_type;
let turn_context = Arc::new(turn_context);
turn_context.turn_metadata_state.spawn_git_enrichment_task();
turn_context
@@ -2575,6 +2584,7 @@ impl Session {
sub_id,
session_configuration,
/*final_output_json_schema*/ None,
/*submission_type*/ None,
/*sandbox_policy_changed*/ false,
)
.await
@@ -2739,6 +2749,16 @@ impl Session {
))
}
async fn active_turn_tracking(&self) -> Option<crate::analytics_client::TrackEventsContext> {
let active = self.active_turn.lock().await;
let (_, task) = active.as_ref()?.tasks.first()?;
Some(build_track_events_context(
task.turn_context.model_info.slug.clone(),
self.conversation_id.to_string(),
task.turn_context.sub_id.clone(),
))
}
pub(crate) async fn record_execpolicy_amendment_message(
&self,
sub_id: &str,
@@ -3886,6 +3906,7 @@ impl Session {
let Some((active_turn_id, _)) = active_turn.tasks.first() else {
return Err(SteerInputError::NoActiveTurn(input));
};
let active_turn_id = active_turn_id.clone();
if let Some(expected_turn_id) = expected_turn_id
&& expected_turn_id != active_turn_id
@@ -3913,7 +3934,14 @@ impl Session {
let mut turn_state = active_turn.turn_state.lock().await;
turn_state.push_pending_input(input.into());
Ok(active_turn_id.clone())
drop(turn_state);
drop(active);
if let Some(tracking) = self.active_turn_tracking().await {
self.services
.analytics_events_client
.track_turn_steer(tracking, CodexTurnSteerEvent);
}
Ok(active_turn_id)
}
/// Returns the input if there was no task running to inject into.
@@ -3957,17 +3985,6 @@ impl Session {
}
}
pub(crate) async fn pending_input_snapshot(&self) -> Vec<ResponseInputItem> {
let active = self.active_turn.lock().await;
match active.as_ref() {
Some(at) => {
let ts = at.turn_state.lock().await;
ts.pending_input_snapshot()
}
None => Vec::with_capacity(0),
}
}
/// Queue response items to be injected into the next active turn created for this session.
pub(crate) async fn queue_response_items_for_next_turn(&self, items: Vec<ResponseInputItem>) {
if items.is_empty() {
@@ -3982,12 +3999,6 @@ impl Session {
std::mem::take(&mut *self.idle_pending_input.lock().await)
}
pub(crate) async fn queued_response_items_for_next_turn_snapshot(
&self,
) -> Vec<ResponseInputItem> {
self.idle_pending_input.lock().await.clone()
}
pub(crate) async fn has_queued_response_items_for_next_turn(&self) -> bool {
!self.idle_pending_input.lock().await.is_empty()
}
@@ -4320,7 +4331,7 @@ async fn submission_loop(sess: Arc<Session>, config: Arc<Config>, rx_sub: Receiv
.await;
false
}
Op::UserInput { .. } | Op::UserTurn { .. } => {
Op::UserInput { .. } | Op::UserInputWithMetadata { .. } | Op::UserTurn { .. } => {
handlers::user_input_or_turn(&sess, sub.id.clone(), sub.op).await;
false
}
@@ -4578,6 +4589,7 @@ mod handlers {
items,
collaboration_mode,
personality,
submission_type,
} => {
let collaboration_mode = collaboration_mode.or_else(|| {
Some(CollaborationMode {
@@ -4603,6 +4615,7 @@ mod handlers {
final_output_json_schema: Some(final_output_json_schema),
personality,
app_server_client_name: None,
submission_type,
},
)
}
@@ -4613,6 +4626,19 @@ mod handlers {
items,
SessionSettingsUpdate {
final_output_json_schema: Some(final_output_json_schema),
submission_type: None,
..Default::default()
},
),
Op::UserInputWithMetadata {
items,
final_output_json_schema,
submission_type,
} => (
items,
SessionSettingsUpdate {
final_output_json_schema: Some(final_output_json_schema),
submission_type,
..Default::default()
},
),
@@ -4651,27 +4677,27 @@ mod handlers {
}
}
/// Records an inter-agent assistant envelope and, when requested, wakes the recipient by
/// starting a regular turn if the session is currently idle.
pub async fn inter_agent_communication(
sess: &Arc<Session>,
sub_id: String,
communication: InterAgentCommunication,
) {
let pending_item = communication.to_response_input_item();
if let Ok(()) = sess.inject_response_items(vec![pending_item.clone()]).await {
if sess
.inject_response_items(vec![pending_item.clone()])
.await
.is_ok()
{
return;
}
let turn_context = sess.new_default_turn_with_sub_id(sub_id).await;
sess.maybe_emit_unknown_model_warning_for_turn(turn_context.as_ref())
.await;
sess.queue_response_items_for_next_turn(vec![pending_item])
.await;
if communication.trigger_turn {
let turn_context = sess.new_default_turn_with_sub_id(sub_id).await;
sess.maybe_emit_unknown_model_warning_for_turn(turn_context.as_ref())
.await;
sess.spawn_task(turn_context, Vec::new(), crate::tasks::RegularTask::new())
.await;
}
sess.spawn_task(turn_context, Vec::new(), crate::tasks::RegularTask::new())
.await;
}
pub async fn run_user_shell_command(sess: &Arc<Session>, sub_id: String, command: String) {
@@ -5380,6 +5406,7 @@ async fn spawn_review_thread(
provider: provider_for_context,
reasoning_effort,
reasoning_summary,
submission_type: None,
session_source,
environment: Arc::clone(&parent_turn_context.environment),
tools_config,
@@ -5992,9 +6019,16 @@ pub(crate) async fn run_turn(
}
if !input.is_empty() {
let submission_type = turn_context
.submission_type
.unwrap_or(SubmissionType::Prompt);
sess.services.analytics_events_client.track_turn_event(
tracking,
CodexTurnEvent {
submission_type: match submission_type {
SubmissionType::Prompt => Some(SubmissionType::Prompt),
SubmissionType::PromptQueued => Some(SubmissionType::PromptQueued),
},
sandbox_policy: turn_context.sandbox_policy.get().clone(),
reasoning_effort: turn_context.reasoning_effort,
reasoning_summary: turn_context.reasoning_summary,
+1
View File
@@ -3067,6 +3067,7 @@ async fn user_turn_updates_approvals_reviewer() {
final_output_json_schema: None,
collaboration_mode: None,
personality: config.personality,
submission_type: None,
},
)
.await;
@@ -523,6 +523,7 @@ async fn run_review_on_session(
final_output_json_schema: Some(params.schema.clone()),
collaboration_mode: None,
personality: params.personality,
submission_type: None,
})
.await
}),
+1
View File
@@ -731,6 +731,7 @@ impl TestCodex {
service_tier,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -318,6 +318,7 @@ async fn apply_patch_cli_move_without_content_change_has_no_turn_diff(
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -928,6 +929,7 @@ async fn apply_patch_shell_command_heredoc_with_cd_emits_turn_diff() -> Result<(
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1010,6 +1012,7 @@ async fn apply_patch_shell_command_failure_propagates_error_and_skips_diff() ->
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1162,6 +1165,7 @@ async fn apply_patch_emits_turn_diff_event_with_unified_diff(
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1227,6 +1231,7 @@ async fn apply_patch_turn_diff_for_rename_with_content_change(
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1300,6 +1305,7 @@ async fn apply_patch_aggregates_diff_across_multiple_tool_calls() -> Result<()>
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1373,6 +1379,7 @@ async fn apply_patch_aggregates_diff_preserves_success_after_failure() -> Result
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
+1
View File
@@ -566,6 +566,7 @@ async fn submit_turn(
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
+2
View File
@@ -1323,6 +1323,7 @@ async fn user_turn_collaboration_mode_overrides_model_and_effort() -> anyhow::Re
collaboration_mode: Some(collaboration_mode),
final_output_json_schema: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1437,6 +1438,7 @@ async fn user_turn_explicit_reasoning_summary_overrides_model_catalog_default()
collaboration_mode: None,
final_output_json_schema: None,
personality: None,
submission_type: None,
})
.await
.unwrap();
+1
View File
@@ -2327,6 +2327,7 @@ text(
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -191,6 +191,7 @@ async fn collaboration_instructions_added_on_user_turn() -> Result<()> {
collaboration_mode: Some(collaboration_mode),
final_output_json_schema: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -307,6 +308,7 @@ async fn user_turn_overrides_collaboration_instructions_after_override() -> Resu
collaboration_mode: Some(turn_mode),
final_output_json_schema: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
+7
View File
@@ -1666,6 +1666,7 @@ async fn auto_compact_runs_after_resume_when_token_usage_is_over_limit() {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await
.unwrap();
@@ -1757,6 +1758,7 @@ async fn pre_sampling_compact_runs_on_switch_to_smaller_context_model() {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await
.expect("submit first user turn");
@@ -1782,6 +1784,7 @@ async fn pre_sampling_compact_runs_on_switch_to_smaller_context_model() {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await
.expect("submit second user turn");
@@ -1893,6 +1896,7 @@ async fn pre_sampling_compact_runs_after_resume_and_switch_to_smaller_model() {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await
.expect("submit pre-resume turn");
@@ -1942,6 +1946,7 @@ async fn pre_sampling_compact_runs_after_resume_and_switch_to_smaller_model() {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await
.expect("submit resumed user turn");
@@ -3145,6 +3150,7 @@ async fn snapshot_request_shape_pre_turn_compaction_strips_incoming_model_switch
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await
.expect("submit first user turn");
@@ -3170,6 +3176,7 @@ async fn snapshot_request_shape_pre_turn_compaction_strips_incoming_model_switch
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await
.expect("submit second user turn");
+2
View File
@@ -59,6 +59,7 @@ async fn submit_user_turn(
service_tier: None,
collaboration_mode,
personality: None,
submission_type: None,
})
.await?;
Ok(())
@@ -140,6 +141,7 @@ async fn execpolicy_blocks_shell_invocation() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -130,6 +130,7 @@ async fn copy_paste_local_image_persists_rollout_request_shape() -> anyhow::Resu
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -214,6 +215,7 @@ async fn drag_drop_image_persists_rollout_request_shape() -> anyhow::Result<()>
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
+239 -5
View File
@@ -33,6 +33,7 @@ use core_test_support::responses::ev_response_created;
use core_test_support::responses::ev_web_search_call_added_partial;
use core_test_support::responses::ev_web_search_call_done;
use core_test_support::responses::mount_sse_once;
use core_test_support::responses::mount_sse_sequence;
use core_test_support::responses::sse;
use core_test_support::responses::start_mock_server;
use core_test_support::skip_if_no_network;
@@ -46,6 +47,7 @@ use std::path::Path;
use std::path::PathBuf;
use std::time::Duration;
use std::time::Instant;
use tempfile::tempdir;
fn image_generation_artifact_path(codex_home: &Path, session_id: &str, call_id: &str) -> PathBuf {
fn sanitize(value: &str) -> String {
@@ -71,6 +73,37 @@ fn image_generation_artifact_path(codex_home: &Path, session_id: &str, call_id:
.join(format!("{}.png", sanitize(call_id)))
}
async fn wait_for_analytics_event(
server: &wiremock::MockServer,
event_type: &str,
event_match: impl Fn(&Value) -> bool,
) -> Value {
let deadline = Instant::now() + Duration::from_secs(10);
loop {
let requests = server.received_requests().await.unwrap_or_default();
if let Some(event) = requests
.into_iter()
.filter(|request| request.url.path() == "/codex/analytics-events/events")
.find_map(|request| {
let payload: Value =
serde_json::from_slice(&request.body).expect("analytics payload");
payload["events"].as_array().and_then(|events| {
events
.iter()
.find(|event| event["event_type"] == event_type && event_match(event))
.cloned()
})
})
{
return event;
}
if Instant::now() >= deadline {
panic!("timed out waiting for analytics event {event_type}");
}
tokio::time::sleep(Duration::from_millis(50)).await;
}
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn user_message_item_is_emitted() -> anyhow::Result<()> {
skip_if_no_network!(Ok(()));
@@ -130,7 +163,7 @@ async fn user_message_item_is_emitted() -> anyhow::Result<()> {
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn user_turn_tracks_turn_metadata_analytics() -> anyhow::Result<()> {
async fn user_turn_tracks_turn_event_analytics() -> anyhow::Result<()> {
skip_if_no_network!(Ok(()));
let server = start_mock_server().await;
@@ -177,6 +210,7 @@ async fn user_turn_tracks_turn_metadata_analytics() -> anyhow::Result<()> {
},
}),
personality: None,
submission_type: None,
})
.await?;
@@ -201,14 +235,16 @@ async fn user_turn_tracks_turn_metadata_analytics() -> anyhow::Result<()> {
let event = payload["events"]
.as_array()
.and_then(|events| {
events
.iter()
.find(|event| event["event_type"] == "codex_turn_event")
events.iter().find(|event| {
event["event_type"] == "codex_turn_event"
&& event["event_params"]["submission_type"] == "prompt"
})
})
.expect("codex_turn_event should be present");
.expect("codex_turn_event prompt event should be present");
let event_params = &event["event_params"];
assert_eq!(event_params["submission_type"], "prompt");
assert_eq!(event_params["sandbox_policy"], "read_only");
assert_eq!(
event_params["product_client_id"],
@@ -225,6 +261,199 @@ async fn user_turn_tracks_turn_metadata_analytics() -> anyhow::Result<()> {
Ok(())
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn user_turn_tracks_turn_event_prompt_type_analytics() -> anyhow::Result<()> {
skip_if_no_network!(Ok(()));
let server = start_mock_server().await;
mount_sse_once(
&server,
sse(vec![ev_response_created("resp-1"), ev_completed("resp-1")]),
)
.await;
let chatgpt_base_url = server.uri();
let mut builder = test_codex()
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
.with_config(move |config| {
config.chatgpt_base_url = chatgpt_base_url;
});
let TestCodex {
codex,
session_configured,
config,
..
} = builder.build(&server).await?;
codex
.submit(Op::UserTurn {
items: vec![UserInput::Text {
text: "hello input message analytics".into(),
text_elements: Vec::new(),
}],
final_output_json_schema: None,
cwd: config.cwd.clone(),
approval_policy: AskForApproval::Never,
approvals_reviewer: None,
sandbox_policy: SandboxPolicy::new_read_only_policy(),
model: session_configured.model.clone(),
effort: Some(ReasoningEffort::High),
summary: Some(ReasoningSummary::Detailed),
service_tier: Some(Some(ServiceTier::Flex)),
collaboration_mode: Some(CollaborationMode {
mode: ModeKind::Plan,
settings: Settings {
model: session_configured.model.clone(),
reasoning_effort: Some(ReasoningEffort::High),
developer_instructions: None,
},
}),
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&codex, |event| matches!(event, EventMsg::TurnComplete(_))).await;
let event = wait_for_analytics_event(&server, "codex_turn_event", |event| {
event["event_params"]["submission_type"] == "prompt"
})
.await;
let event_params = &event["event_params"];
assert_eq!(event_params["submission_type"], "prompt");
assert_eq!(
event_params["product_client_id"],
serde_json::json!(codex_core::default_client::originator().value)
);
assert_eq!(event_params["model_slug"], session_configured.model);
assert!(event_params["thread_id"].as_str().is_some());
assert!(event_params["turn_id"].as_str().is_some());
Ok(())
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn user_turn_tracks_turn_steer_analytics() -> anyhow::Result<()> {
skip_if_no_network!(Ok(()));
let server = start_mock_server().await;
let temp = tempdir()?;
let unblock_path = temp.path().join("unblock-steering");
let command = format!(
"while [ ! -f \"{}\" ]; do sleep 0.01; done; echo done",
unblock_path.display()
);
let call_id = "shell-steering-call";
mount_sse_sequence(
&server,
vec![
sse(vec![
ev_response_created("resp-1"),
core_test_support::responses::ev_function_call(
call_id,
"shell",
&serde_json::to_string(&serde_json::json!({
"command": ["/bin/sh", "-c", command],
}))?,
),
ev_completed("resp-1"),
]),
sse(vec![
ev_assistant_message("msg-2", "done"),
ev_completed("resp-2"),
]),
],
)
.await;
let chatgpt_base_url = server.uri();
let test = test_codex()
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
.with_model("gpt-5")
.with_config(move |config| {
config.chatgpt_base_url = chatgpt_base_url;
})
.build(&server)
.await?;
let codex = test.codex.clone();
let turn_model = test.session_configured.model.clone();
codex
.submit(Op::UserTurn {
items: vec![UserInput::Text {
text: "start steering flow".into(),
text_elements: Vec::new(),
}],
final_output_json_schema: None,
cwd: test.cwd_path().to_path_buf(),
approval_policy: AskForApproval::Never,
approvals_reviewer: None,
sandbox_policy: SandboxPolicy::DangerFullAccess,
model: turn_model,
effort: None,
summary: None,
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
let turn_id = wait_for_event_match(&codex, |ev| match ev {
EventMsg::TurnStarted(event) => Some(event.turn_id.clone()),
_ => None,
})
.await;
wait_for_event_match(&codex, |ev| match ev {
EventMsg::ExecCommandBegin(event) if event.call_id == call_id => Some(()),
_ => None,
})
.await;
let steering_text = "steering metadata check";
let steered_turn_id = codex
.steer_input(
vec![UserInput::Text {
text: steering_text.into(),
text_elements: Vec::new(),
}],
Some(turn_id.as_str()),
)
.await
.expect("steer should succeed on active turn");
assert_eq!(steered_turn_id, turn_id);
std::fs::write(&unblock_path, "go")?;
wait_for_event(&codex, |event| matches!(event, EventMsg::TurnComplete(_))).await;
let event = wait_for_analytics_event(&server, "codex_turn_event", |event| {
event["event_params"].get("submission_type").is_none()
&& event["event_params"].get("sandbox_policy").is_none()
})
.await;
let event_params = &event["event_params"];
assert!(event_params.get("submission_type").is_none());
assert!(event_params.get("sandbox_policy").is_none());
assert!(event_params.get("reasoning_effort").is_none());
assert!(event_params.get("reasoning_summary").is_none());
assert!(event_params.get("service_tier").is_none());
assert!(event_params.get("collaboration_mode").is_none());
assert_eq!(
event_params["product_client_id"],
serde_json::json!(codex_core::default_client::originator().value)
);
assert_eq!(event_params["model_slug"], "gpt-5");
assert!(event_params["thread_id"].as_str().is_some());
assert!(event_params["turn_id"].as_str().is_some());
Ok(())
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn assistant_message_item_is_emitted() -> anyhow::Result<()> {
skip_if_no_network!(Ok(()));
@@ -635,6 +864,7 @@ async fn plan_mode_emits_plan_item_from_proposed_plan_block() -> anyhow::Result<
service_tier: None,
collaboration_mode: Some(collaboration_mode),
personality: None,
submission_type: None,
})
.await?;
@@ -712,6 +942,7 @@ async fn plan_mode_strips_plan_from_agent_messages() -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: Some(collaboration_mode),
personality: None,
submission_type: None,
})
.await?;
@@ -821,6 +1052,7 @@ async fn plan_mode_streaming_citations_are_stripped_across_added_deltas_and_done
service_tier: None,
collaboration_mode: Some(collaboration_mode),
personality: None,
submission_type: None,
})
.await?;
@@ -1008,6 +1240,7 @@ async fn plan_mode_streaming_proposed_plan_tag_split_across_added_and_delta_is_p
service_tier: None,
collaboration_mode: Some(collaboration_mode),
personality: None,
submission_type: None,
})
.await?;
@@ -1122,6 +1355,7 @@ async fn plan_mode_handles_missing_plan_close_tag() -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: Some(collaboration_mode),
personality: None,
submission_type: None,
})
.await?;
+1
View File
@@ -88,6 +88,7 @@ async fn codex_returns_json_result(model: String) -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
+1
View File
@@ -69,6 +69,7 @@ async fn submit_skill_turn(test: &TestCodex, skill_path: PathBuf, prompt: &str)
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -134,6 +134,7 @@ async fn model_change_appends_model_instructions_developer_message() -> Result<(
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -171,6 +172,7 @@ async fn model_change_appends_model_instructions_developer_message() -> Result<(
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -231,6 +233,7 @@ async fn model_and_personality_change_only_appends_model_instructions() -> Resul
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -268,6 +271,7 @@ async fn model_and_personality_change_only_appends_model_instructions() -> Resul
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -410,6 +414,7 @@ async fn model_change_from_image_to_text_strips_prior_image_content() -> Result<
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -431,6 +436,7 @@ async fn model_change_from_image_to_text_strips_prior_image_content() -> Result<
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -539,6 +545,7 @@ async fn generated_image_is_replayed_for_image_capable_models() -> Result<()> {
summary: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -560,6 +567,7 @@ async fn generated_image_is_replayed_for_image_capable_models() -> Result<()> {
summary: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -671,6 +679,7 @@ async fn model_change_from_generated_image_to_text_preserves_prior_generated_ima
summary: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -692,6 +701,7 @@ async fn model_change_from_generated_image_to_text_preserves_prior_generated_ima
summary: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -805,6 +815,7 @@ async fn thread_rollback_after_generated_image_drops_entire_image_turn_history()
summary: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -834,6 +845,7 @@ async fn thread_rollback_after_generated_image_drops_entire_image_turn_history()
summary: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -989,6 +1001,7 @@ async fn model_switch_to_smaller_model_updates_token_context_window() -> Result<
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1048,6 +1061,7 @@ async fn model_switch_to_smaller_model_updates_token_context_window() -> Result<
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -129,6 +129,7 @@ async fn snapshot_model_visible_layout_turn_overrides() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |event| {
@@ -153,6 +154,7 @@ async fn snapshot_model_visible_layout_turn_overrides() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: Some(Personality::Friendly),
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |event| {
@@ -232,6 +234,7 @@ async fn snapshot_model_visible_layout_cwd_change_does_not_refresh_agents() -> R
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |event| {
@@ -256,6 +259,7 @@ async fn snapshot_model_visible_layout_cwd_change_does_not_refresh_agents() -> R
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |event| {
@@ -366,6 +370,7 @@ async fn snapshot_model_visible_layout_resume_with_personality_change() -> Resul
service_tier: None,
collaboration_mode: None,
personality: Some(Personality::Friendly),
submission_type: None,
})
.await?;
wait_for_event(&resumed.codex, |event| {
@@ -104,6 +104,7 @@ async fn renews_cache_ttl_on_matching_models_etag() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -110,6 +110,7 @@ async fn refresh_models_on_models_etag_mismatch_and_avoid_duplicate_models_fetch
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
+13
View File
@@ -111,6 +111,7 @@ async fn user_turn_personality_none_does_not_add_update_message() -> anyhow::Res
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -162,6 +163,7 @@ async fn config_personality_some_sets_instructions_template() -> anyhow::Result<
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -220,6 +222,7 @@ async fn config_personality_none_sends_no_personality() -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -284,6 +287,7 @@ async fn default_personality_is_pragmatic_without_config_toml() -> anyhow::Resul
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -336,6 +340,7 @@ async fn user_turn_personality_some_adds_update_message() -> anyhow::Result<()>
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -374,6 +379,7 @@ async fn user_turn_personality_some_adds_update_message() -> anyhow::Result<()>
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -441,6 +447,7 @@ async fn user_turn_personality_same_value_does_not_add_update_message() -> anyho
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -479,6 +486,7 @@ async fn user_turn_personality_same_value_does_not_add_update_message() -> anyho
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -559,6 +567,7 @@ async fn user_turn_personality_skips_if_feature_disabled() -> anyhow::Result<()>
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -597,6 +606,7 @@ async fn user_turn_personality_skips_if_feature_disabled() -> anyhow::Result<()>
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -714,6 +724,7 @@ async fn remote_model_friendly_personality_instructions_with_feature() -> anyhow
service_tier: None,
collaboration_mode: None,
personality: Some(Personality::Friendly),
submission_type: None,
})
.await?;
@@ -833,6 +844,7 @@ async fn user_turn_personality_remote_model_template_includes_update_message() -
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -871,6 +883,7 @@ async fn user_turn_personality_remote_model_template_includes_update_message() -
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -712,6 +712,7 @@ async fn per_turn_overrides_keep_cached_prefix_and_key_constant() -> anyhow::Res
collaboration_mode: None,
final_output_json_schema: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -825,6 +826,7 @@ async fn send_user_turn_with_no_changes_does_not_send_environment_context() -> a
collaboration_mode: None,
final_output_json_schema: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -846,6 +848,7 @@ async fn send_user_turn_with_no_changes_does_not_send_environment_context() -> a
collaboration_mode: None,
final_output_json_schema: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -951,6 +954,7 @@ async fn send_user_turn_with_changes_sends_environment_context() -> anyhow::Resu
collaboration_mode: None,
final_output_json_schema: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -972,6 +976,7 @@ async fn send_user_turn_with_changes_sends_environment_context() -> anyhow::Resu
collaboration_mode: None,
final_output_json_schema: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await;
@@ -181,6 +181,7 @@ async fn remote_models_long_model_slug_is_sent_with_high_reasoning() -> Result<(
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -244,6 +245,7 @@ async fn namespaced_model_slug_uses_catalog_metadata_without_fallback_warning()
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -404,6 +406,7 @@ async fn remote_models_remote_model_uses_unified_exec() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -623,6 +626,7 @@ async fn remote_models_apply_remote_base_instructions() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -201,6 +201,7 @@ async fn submit_turn(
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
Ok(())
@@ -153,6 +153,7 @@ async fn submit_turn(
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
Ok(())
@@ -153,6 +153,7 @@ async fn request_user_input_round_trip_for_mode(mode: ModeKind) -> anyhow::Resul
},
}),
personality: None,
submission_type: None,
})
.await?;
@@ -264,6 +265,7 @@ where
service_tier: None,
collaboration_mode: Some(collaboration_mode),
personality: None,
submission_type: None,
})
.await?;
+6
View File
@@ -137,6 +137,7 @@ async fn stdio_server_round_trip() -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -307,6 +308,7 @@ async fn stdio_image_responses_round_trip() -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -511,6 +513,7 @@ async fn stdio_image_responses_are_sanitized_for_text_only_model() -> anyhow::Re
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -626,6 +629,7 @@ async fn stdio_server_propagates_whitelisted_env_vars() -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -788,6 +792,7 @@ async fn streamable_http_tool_call_round_trip() -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1035,6 +1040,7 @@ async fn streamable_http_with_oauth_round_trip_impl() -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -53,6 +53,7 @@ async fn openai_model_header_mismatch_emits_warning_event_and_warning_item() ->
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -152,6 +153,7 @@ async fn response_model_field_mismatch_emits_warning_when_header_matches_request
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -238,6 +240,7 @@ async fn openai_model_header_mismatch_only_emits_one_warning_per_turn() -> Resul
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -288,6 +291,7 @@ async fn openai_model_header_casing_only_mismatch_does_not_warn() -> Result<()>
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -172,6 +172,7 @@ async fn run_snapshot_command_with_options(
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -263,6 +264,7 @@ async fn run_shell_command_snapshot_with_options(
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -334,6 +336,7 @@ async fn run_tool_turn_on_harness(
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -568,6 +571,7 @@ async fn shell_command_snapshot_still_intercepts_apply_patch() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -73,6 +73,7 @@ async fn submit_turn_with_policies(
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
Ok(())
+1
View File
@@ -82,6 +82,7 @@ async fn user_turn_includes_skill_instructions() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -403,6 +403,7 @@ async fn mcp_call_marks_thread_memory_mode_polluted_when_configured() -> Result<
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
wait_for_event(&test.codex, |event| {
@@ -93,6 +93,7 @@ async fn shell_tool_executes_command_and_streams_output() -> anyhow::Result<()>
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -164,6 +165,7 @@ async fn update_plan_tool_emits_plan_update_event() -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -245,6 +247,7 @@ async fn update_plan_tool_rejects_malformed_payload() -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -341,6 +344,7 @@ async fn apply_patch_tool_executes_and_emits_patch_events() -> anyhow::Result<()
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -445,6 +449,7 @@ async fn apply_patch_reports_parse_diagnostics() -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -50,6 +50,7 @@ async fn run_turn(test: &TestCodex, prompt: &str) -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -367,6 +368,7 @@ async fn shell_tools_start_before_response_completed_when_stream_delayed() -> an
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
+1
View File
@@ -494,6 +494,7 @@ async fn mcp_image_output_preserves_image_and_no_text_summary() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
+26
View File
@@ -200,6 +200,7 @@ async fn unified_exec_intercepts_apply_patch_exec_command() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -334,6 +335,7 @@ async fn unified_exec_emits_exec_command_begin_event() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -417,6 +419,7 @@ async fn unified_exec_resolves_relative_workdir() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -503,6 +506,7 @@ async fn unified_exec_respects_workdir_override() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -601,6 +605,7 @@ async fn unified_exec_emits_exec_command_end_event() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -681,6 +686,7 @@ async fn unified_exec_emits_output_delta_for_exec_command() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -762,6 +768,7 @@ async fn unified_exec_full_lifecycle_with_background_end_event() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -897,6 +904,7 @@ async fn unified_exec_emits_terminal_interaction_for_write_stdin() -> Result<()>
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1039,6 +1047,7 @@ async fn unified_exec_terminal_interaction_captures_delayed_output() -> Result<(
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1204,6 +1213,7 @@ async fn unified_exec_emits_one_begin_and_one_end_event() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1307,6 +1317,7 @@ async fn exec_command_reports_chunk_and_exit_metadata() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1430,6 +1441,7 @@ async fn unified_exec_defaults_to_pipe() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1525,6 +1537,7 @@ async fn unified_exec_can_enable_tty() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1611,6 +1624,7 @@ async fn unified_exec_respects_early_exit_notifications() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1747,6 +1761,7 @@ async fn write_stdin_returns_exit_metadata_and_clears_session() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1920,6 +1935,7 @@ async fn unified_exec_emits_end_event_when_session_dies_via_stdin() -> Result<()
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -2002,6 +2018,7 @@ async fn unified_exec_keeps_long_running_session_after_turn_end() -> Result<()>
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -2095,6 +2112,7 @@ async fn unified_exec_interrupt_preserves_long_running_session() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -2204,6 +2222,7 @@ async fn unified_exec_reuses_session_via_stdin() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -2344,6 +2363,7 @@ PY
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
// This is a worst case scenario for the truncate logic.
@@ -2463,6 +2483,7 @@ async fn unified_exec_timeout_and_followup_poll() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -2564,6 +2585,7 @@ PY
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -2665,6 +2687,7 @@ async fn unified_exec_runs_under_sandbox() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -2774,6 +2797,7 @@ async fn unified_exec_python_prompt_under_seatbelt() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -2874,6 +2898,7 @@ async fn unified_exec_runs_on_all_platforms() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -3014,6 +3039,7 @@ async fn unified_exec_prunes_exited_sessions_first() -> Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -184,6 +184,7 @@ async fn user_shell_command_does_not_replace_active_turn() -> anyhow::Result<()>
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
+14
View File
@@ -178,6 +178,7 @@ async fn user_turn_with_local_image_attaches_image() -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -287,6 +288,7 @@ async fn view_image_tool_attaches_local_image() -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -428,6 +430,7 @@ async fn view_image_tool_can_preserve_original_resolution_when_requested_on_gpt5
summary: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -527,6 +530,7 @@ async fn view_image_tool_errors_clearly_for_unsupported_detail_values() -> anyho
summary: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -619,6 +623,7 @@ async fn view_image_tool_treats_null_detail_as_omitted() -> anyhow::Result<()> {
summary: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -719,6 +724,7 @@ async fn view_image_tool_resizes_when_model_lacks_original_detail_support() -> a
summary: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -830,6 +836,7 @@ async fn view_image_tool_does_not_force_original_resolution_with_capability_feat
summary: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -932,6 +939,7 @@ await codex.emitImage(out);
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1052,6 +1060,7 @@ console.log(out.type);
summary: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1145,6 +1154,7 @@ async fn view_image_tool_errors_when_path_is_directory() -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1221,6 +1231,7 @@ async fn view_image_tool_errors_for_non_image_files() -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1302,6 +1313,7 @@ async fn view_image_tool_errors_when_file_missing() -> anyhow::Result<()> {
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1425,6 +1437,7 @@ async fn view_image_tool_returns_unsupported_message_for_text_only_model() -> an
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -1500,6 +1513,7 @@ async fn replaces_invalid_local_image_after_bad_request() -> anyhow::Result<()>
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
@@ -164,6 +164,7 @@ async fn websocket_fallback_hides_first_websocket_retry_stream_error() -> Result
service_tier: None,
collaboration_mode: None,
personality: None,
submission_type: None,
})
.await?;
+1
View File
@@ -199,6 +199,7 @@ impl AppServerClient {
// Debug client sends plain text with no UI markup spans.
text_elements: Vec::new(),
}],
submission_type: None,
..Default::default()
},
};
+1
View File
@@ -674,6 +674,7 @@ async fn run_exec_session(args: ExecRunArgs) -> anyhow::Result<()> {
summary: None,
personality: None,
output_schema,
submission_type: None,
collaboration_mode: None,
},
},
+26
View File
@@ -205,6 +205,13 @@ pub struct ConversationTextParams {
pub text: String,
}
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "snake_case")]
pub enum SubmissionType {
Prompt,
PromptQueued,
}
/// Submission operation
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema)]
#[serde(tag = "type", rename_all = "snake_case")]
@@ -243,6 +250,19 @@ pub enum Op {
final_output_json_schema: Option<Value>,
},
/// User input with additional turn-scoped metadata supplied by a higher-level
/// surface such as app-server `turn/start`.
UserInputWithMetadata {
/// User input items, see `InputItem`
items: Vec<UserInput>,
/// Optional JSON Schema used to constrain the final assistant message for this turn.
#[serde(skip_serializing_if = "Option::is_none")]
final_output_json_schema: Option<Value>,
/// Semantic classification of this submitted user input.
#[serde(default, skip_serializing_if = "Option::is_none")]
submission_type: Option<SubmissionType>,
},
/// Similar to [`Op::UserInput`], but contains additional context required
/// for a turn of a [`crate::codex_thread::CodexThread`].
UserTurn {
@@ -298,6 +318,11 @@ pub enum Op {
/// Optional personality override for this turn.
#[serde(skip_serializing_if = "Option::is_none")]
personality: Option<Personality>,
/// Semantic classification of this submitted user message when known by
/// the higher-level surface.
#[serde(default, skip_serializing_if = "Option::is_none")]
submission_type: Option<SubmissionType>,
},
/// Inter-agent communication that should be recorded as assistant history
@@ -572,6 +597,7 @@ impl Op {
Self::RealtimeConversationText(_) => "realtime_conversation_text",
Self::RealtimeConversationClose => "realtime_conversation_close",
Self::UserInput { .. } => "user_input",
Self::UserInputWithMetadata { .. } => "user_input",
Self::UserTurn { .. } => "user_turn",
Self::InterAgentCommunication { .. } => "inter_agent_communication",
Self::OverrideTurnContext { .. } => "override_turn_context",
+1
View File
@@ -5279,6 +5279,7 @@ impl ChatWidget {
final_output_json_schema: None,
collaboration_mode,
personality,
submission_type: None,
};
if !self.submit_op(op) {
+2
View File
@@ -2020,6 +2020,7 @@ impl App {
final_output_json_schema,
collaboration_mode,
personality,
submission_type,
} => {
if let Some(turn_id) = self.active_turn_id_for_thread(thread_id).await {
match app_server
@@ -2053,6 +2054,7 @@ impl App {
*service_tier,
collaboration_mode.clone(),
*personality,
*submission_type,
final_output_json_schema.clone(),
)
.await?;
@@ -17,6 +17,7 @@ use codex_protocol::protocol::Op;
use codex_protocol::protocol::ReviewDecision;
use codex_protocol::protocol::ReviewRequest;
use codex_protocol::protocol::SandboxPolicy;
use codex_protocol::protocol::SubmissionType;
use codex_protocol::request_permissions::RequestPermissionsResponse;
use codex_protocol::request_user_input::RequestUserInputResponse;
use codex_protocol::user_input::UserInput;
@@ -51,6 +52,7 @@ pub(crate) enum AppCommandView<'a> {
final_output_json_schema: &'a Option<Value>,
collaboration_mode: &'a Option<CollaborationMode>,
personality: &'a Option<Personality>,
submission_type: &'a Option<SubmissionType>,
},
OverrideTurnContext {
cwd: &'a Option<PathBuf>,
@@ -155,6 +157,7 @@ impl AppCommand {
final_output_json_schema: Option<Value>,
collaboration_mode: Option<CollaborationMode>,
personality: Option<Personality>,
submission_type: Option<SubmissionType>,
) -> Self {
Self(Op::UserTurn {
items,
@@ -169,6 +172,7 @@ impl AppCommand {
final_output_json_schema,
collaboration_mode,
personality,
submission_type,
})
}
@@ -314,6 +318,7 @@ impl AppCommand {
final_output_json_schema,
collaboration_mode,
personality,
submission_type,
} => AppCommandView::UserTurn {
items,
cwd,
@@ -327,6 +332,7 @@ impl AppCommand {
final_output_json_schema,
collaboration_mode,
personality,
submission_type,
},
Op::OverrideTurnContext {
cwd,
@@ -75,6 +75,7 @@ use codex_protocol::protocol::ReviewRequest;
use codex_protocol::protocol::ReviewTarget as CoreReviewTarget;
use codex_protocol::protocol::SandboxPolicy;
use codex_protocol::protocol::SessionNetworkProxyRuntime;
use codex_protocol::protocol::SubmissionType;
use color_eyre::eyre::ContextCompat;
use color_eyre::eyre::Result;
use color_eyre::eyre::WrapErr;
@@ -389,6 +390,7 @@ impl AppServerSession {
service_tier: Option<Option<codex_protocol::config_types::ServiceTier>>,
collaboration_mode: Option<codex_protocol::config_types::CollaborationMode>,
personality: Option<codex_protocol::config_types::Personality>,
submission_type: Option<SubmissionType>,
output_schema: Option<serde_json::Value>,
) -> Result<TurnStartResponse> {
let request_id = self.next_request_id();
@@ -407,6 +409,7 @@ impl AppServerSession {
effort,
summary,
personality,
submission_type,
output_schema,
collaboration_mode,
},
+15 -1
View File
@@ -5210,6 +5210,14 @@ impl ChatWidget {
}
fn submit_user_message(&mut self, user_message: UserMessage) {
self.submit_user_message_with_type(user_message, None);
}
fn submit_user_message_with_type(
&mut self,
user_message: UserMessage,
submission_type: Option<SubmissionType>,
) {
if !self.is_session_configured() {
tracing::warn!("cannot submit user message before session is configured; queueing");
self.queued_user_messages.push_front(user_message);
@@ -5425,6 +5433,7 @@ impl ChatWidget {
/*final_output_json_schema*/ None,
collaboration_mode,
personality,
submission_type,
);
if !self.submit_op(op) {
@@ -6884,8 +6893,13 @@ impl ChatWidget {
if self.bottom_pane.is_task_running() {
return;
}
let submission_type = if self.rejected_steers_queue.is_empty() {
Some(SubmissionType::PromptQueued)
} else {
None
};
if let Some(user_message) = self.pop_next_queued_user_message() {
self.submit_user_message(user_message);
self.submit_user_message_with_type(user_message, submission_type);
}
// Update the list to reflect the remaining queued messages (if any).
self.refresh_pending_input_preview();