[regression] Fix ephemeral turn backfill in exec (#16795)

Addresses #16781

Problem: `codex exec --ephemeral` backfilled empty `turn/completed`
items with `thread/read(includeTurns=true)`, which app-server rejects
for ephemeral threads.

This is a regression introduced in the recent conversion of "exec" to
use app server rather than call the core directly.

Solution: Skip turn-item backfill for ephemeral exec threads while
preserving the existing recovery path for non-ephemeral sessions.
This commit is contained in:
Eric Traut
2026-04-06 08:45:58 -07:00
committed by GitHub
parent ab58141e22
commit fb41a79f37
2 changed files with 44 additions and 5 deletions

View File

@@ -293,6 +293,25 @@ fn turn_items_for_thread_returns_matching_turn_items() {
assert_eq!(turn_items_for_thread(&thread, "missing-turn"), None);
}
#[test]
fn should_backfill_turn_completed_items_skips_ephemeral_threads() {
let notification =
ServerNotification::TurnCompleted(codex_app_server_protocol::TurnCompletedNotification {
thread_id: "thread-1".to_string(),
turn: codex_app_server_protocol::Turn {
id: "turn-1".to_string(),
items: Vec::new(),
status: codex_app_server_protocol::TurnStatus::Completed,
error: None,
},
});
assert!(!should_backfill_turn_completed_items(
/*thread_ephemeral*/ true,
&notification
));
}
#[test]
fn canceled_mcp_server_elicitation_response_uses_cancel_action() {
let value = canceled_mcp_server_elicitation_response()