fix(app-server): initialize turn fixtures

This commit is contained in:
Felipe Coury
2026-07-09 21:11:34 -03:00
parent 5c52903603
commit 2ffcc81641
6 changed files with 24 additions and 0 deletions
@@ -339,6 +339,7 @@ fn sample_turn_start_response(turn_id: &str) -> ClientResponsePayload {
ClientResponsePayload::TurnStart(codex_app_server_protocol::TurnStartResponse {
turn: Turn {
id: turn_id.to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: vec![],
status: AppServerTurnStatus::InProgress,
@@ -355,6 +356,7 @@ fn sample_turn_started_notification(thread_id: &str, turn_id: &str) -> ServerNot
thread_id: thread_id.to_string(),
turn: Turn {
id: turn_id.to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: vec![],
status: AppServerTurnStatus::InProgress,
@@ -390,6 +392,7 @@ fn sample_turn_completed_notification(
thread_id: thread_id.to_string(),
turn: Turn {
id: turn_id.to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: vec![],
status,
+1
View File
@@ -361,6 +361,7 @@ fn sample_turn_start_response() -> ClientResponsePayload {
ClientResponsePayload::TurnStart(TurnStartResponse {
turn: Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: Vec::new(),
status: AppServerTurnStatus::InProgress,
@@ -310,6 +310,7 @@ fn turn_completed_recovers_final_message_from_turn_items() {
thread_id: "thread-1".to_string(),
turn: Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: vec![ThreadItem::AgentMessage {
id: "msg-1".to_string(),
@@ -358,6 +359,7 @@ fn turn_completed_overwrites_stale_final_message_from_turn_items() {
thread_id: "thread-1".to_string(),
turn: Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: vec![ThreadItem::AgentMessage {
id: "msg-1".to_string(),
@@ -407,6 +409,7 @@ fn turn_completed_preserves_streamed_final_message_when_turn_items_are_empty() {
thread_id: "thread-1".to_string(),
turn: Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: Vec::new(),
status: TurnStatus::Completed,
@@ -451,6 +454,7 @@ fn turn_failed_clears_stale_final_message() {
thread_id: "thread-1".to_string(),
turn: Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: Vec::new(),
status: TurnStatus::Failed,
@@ -496,6 +500,7 @@ fn turn_interrupted_clears_stale_final_message() {
thread_id: "thread-1".to_string(),
turn: Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: Vec::new(),
status: TurnStatus::Interrupted,
@@ -33,6 +33,7 @@ fn failed_turn_does_not_overwrite_output_last_message_file() {
thread_id: "thread-1".to_string(),
turn: codex_app_server_protocol::Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: Vec::new(),
status: TurnStatus::Failed,
+3
View File
@@ -358,6 +358,7 @@ fn turn_items_for_thread_returns_matching_turn_items() {
turns: vec![
codex_app_server_protocol::Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: vec![AppServerThreadItem::AgentMessage {
id: "msg-1".to_string(),
@@ -373,6 +374,7 @@ fn turn_items_for_thread_returns_matching_turn_items() {
},
codex_app_server_protocol::Turn {
id: "turn-2".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: vec![AppServerThreadItem::Plan {
id: "plan-1".to_string(),
@@ -406,6 +408,7 @@ fn should_backfill_turn_completed_items_skips_ephemeral_threads() {
thread_id: "thread-1".to_string(),
turn: codex_app_server_protocol::Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: Vec::new(),
status: codex_app_server_protocol::TurnStatus::Completed,
@@ -146,6 +146,7 @@ fn turn_started_emits_turn_started_event() {
thread_id: "thread-1".to_string(),
turn: Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: Vec::new(),
status: TurnStatus::InProgress,
@@ -1112,6 +1113,7 @@ fn plan_update_emits_started_then_updated_then_completed() {
thread_id: "thread-1".to_string(),
turn: Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: Vec::new(),
status: TurnStatus::Completed,
@@ -1172,6 +1174,7 @@ fn plan_update_after_completion_starts_new_todo_list_with_new_id() {
thread_id: "thread-1".to_string(),
turn: Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: Vec::new(),
status: TurnStatus::Completed,
@@ -1255,6 +1258,7 @@ fn token_usage_update_is_emitted_on_turn_completion() {
thread_id: "thread-1".to_string(),
turn: Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: Vec::new(),
status: TurnStatus::Completed,
@@ -1290,6 +1294,7 @@ fn turn_completion_recovers_final_message_from_turn_items() {
thread_id: "thread-1".to_string(),
turn: Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: vec![ThreadItem::AgentMessage {
id: "msg-1".to_string(),
@@ -1363,6 +1368,7 @@ fn turn_completion_reconciles_started_items_from_turn_items() {
thread_id: "thread-1".to_string(),
turn: Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: vec![ThreadItem::CommandExecution {
id: "cmd-1".to_string(),
@@ -1431,6 +1437,7 @@ fn turn_completion_overwrites_stale_final_message_from_turn_items() {
thread_id: "thread-1".to_string(),
turn: Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: vec![ThreadItem::AgentMessage {
id: "msg-1".to_string(),
@@ -1481,6 +1488,7 @@ fn turn_completion_preserves_streamed_final_message_when_turn_items_are_empty()
thread_id: "thread-1".to_string(),
turn: Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: Vec::new(),
status: TurnStatus::Completed,
@@ -1530,6 +1538,7 @@ fn failed_turn_clears_stale_final_message() {
thread_id: "thread-1".to_string(),
turn: Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: Vec::new(),
status: TurnStatus::Failed,
@@ -1558,6 +1567,7 @@ fn turn_completion_falls_back_to_final_plan_text() {
thread_id: "thread-1".to_string(),
turn: Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: vec![ThreadItem::Plan {
id: "plan-1".to_string(),
@@ -1613,6 +1623,7 @@ fn turn_failure_prefers_structured_error_message() {
thread_id: "thread-1".to_string(),
turn: Turn {
id: "turn-1".to_string(),
is_forkable: true,
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: Vec::new(),
status: TurnStatus::Failed,