Add ItemStarted/ItemCompleted events for UserInputItem (#5306)

Adds a new ItemStarted event and delivers UserMessage as the first item
type (more to come).


Renames `InputItem` to `UserInput` considering we're using the `Item`
suffix for actual items.
This commit is contained in:
pakrym-oai
2025-10-20 13:34:44 -07:00
committed by GitHub
parent 5e4f3bbb0b
commit 9c903c4716
49 changed files with 435 additions and 202 deletions

View File

@@ -1,9 +1,9 @@
use codex_protocol::protocol::AskForApproval;
use codex_protocol::protocol::EventMsg;
use codex_protocol::protocol::InputItem;
use codex_protocol::protocol::Op;
use codex_protocol::protocol::ReviewDecision;
use codex_protocol::protocol::SandboxPolicy;
use codex_protocol::user_input::UserInput;
use core_test_support::responses::ev_assistant_message;
use core_test_support::responses::ev_completed;
use core_test_support::responses::ev_custom_tool_call;
@@ -31,7 +31,7 @@ async fn responses_api_emits_api_request_event() {
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "hello".into(),
}],
})
@@ -77,7 +77,7 @@ async fn process_sse_emits_tracing_for_output_item() {
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "hello".into(),
}],
})
@@ -121,7 +121,7 @@ async fn process_sse_emits_failed_event_on_parse_error() {
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "hello".into(),
}],
})
@@ -166,7 +166,7 @@ async fn process_sse_records_failed_event_when_stream_closes_without_completed()
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "hello".into(),
}],
})
@@ -223,7 +223,7 @@ async fn process_sse_failed_event_records_response_error_message() {
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "hello".into(),
}],
})
@@ -278,7 +278,7 @@ async fn process_sse_failed_event_logs_parse_error() {
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "hello".into(),
}],
})
@@ -328,7 +328,7 @@ async fn process_sse_failed_event_logs_missing_error() {
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "hello".into(),
}],
})
@@ -378,7 +378,7 @@ async fn process_sse_failed_event_logs_response_completed_parse_error() {
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "hello".into(),
}],
})
@@ -433,7 +433,7 @@ async fn process_sse_emits_completed_telemetry() {
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "hello".into(),
}],
})
@@ -493,7 +493,7 @@ async fn handle_response_item_records_tool_result_for_custom_tool_call() {
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "hello".into(),
}],
})
@@ -557,7 +557,7 @@ async fn handle_response_item_records_tool_result_for_function_call() {
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "hello".into(),
}],
})
@@ -631,7 +631,7 @@ async fn handle_response_item_records_tool_result_for_local_shell_missing_ids()
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "hello".into(),
}],
})
@@ -689,7 +689,7 @@ async fn handle_response_item_records_tool_result_for_local_shell_call() {
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "hello".into(),
}],
})
@@ -787,7 +787,7 @@ async fn handle_container_exec_autoapprove_from_config_records_tool_decision() {
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "hello".into(),
}],
})
@@ -833,7 +833,7 @@ async fn handle_container_exec_user_approved_records_tool_decision() {
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "approved".into(),
}],
})
@@ -895,7 +895,7 @@ async fn handle_container_exec_user_approved_for_session_records_tool_decision()
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "persist".into(),
}],
})
@@ -957,7 +957,7 @@ async fn handle_sandbox_error_user_approves_retry_records_tool_decision() {
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "retry".into(),
}],
})
@@ -1019,7 +1019,7 @@ async fn handle_container_exec_user_denies_records_tool_decision() {
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "deny".into(),
}],
})
@@ -1081,7 +1081,7 @@ async fn handle_sandbox_error_user_approves_for_session_records_tool_decision()
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "persist".into(),
}],
})
@@ -1143,7 +1143,7 @@ async fn handle_sandbox_error_user_denies_records_tool_decision() {
codex
.submit(Op::UserInput {
items: vec![InputItem::Text {
items: vec![UserInput::Text {
text: "deny".into(),
}],
})