Accept user input when starting idle turns (#36947)

## What changed

- Generalize `CodexThread::try_start_turn_if_idle` to accept exported
  `TurnInput` values, preserving user content and client IDs in the first model
  request.
- Allow non-empty user input to start an idle turn in Plan mode while retaining
  the Plan-mode rejection for automatic response items and empty user input.
- Process idle user input through the normal user-turn path so connector
  selections are cleared, prompt telemetry is recorded, and referenced skill
  instructions are included.

## Testing

- Cover idle user input in Default and Plan modes, response-item mailbox
  merging, empty-input rejection, and skill instruction injection.

GitOrigin-RevId: 116667d160d4464b525d9e4c7e8cc05d23a94008
This commit is contained in:
efrazer-oai authored and copyberry committed 2026-08-04 18:52:41 +00:00
1 parent ceaa818898
commit 989a0b053e
9 files changed
+309 -34

No files matched your search

+5 -1
View File
@@ -4,6 +4,7 @@ use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use codex_core::ThreadManager;
use codex_core::TurnInput;
use codex_protocol::ThreadId;
use codex_protocol::models::ResponseItem;
use codex_protocol::protocol::ThreadGoal;
@@ -402,7 +403,10 @@ impl GoalRuntimeHandle {
}
let item = continuation_steering_item(&protocol_goal_from_state(goal));
if let Err(err) = thread.try_start_turn_if_idle(vec![item]).await {
if let Err(err) = thread
.try_start_turn_if_idle(vec![TurnInput::ResponseItem(item)])
.await
{
let reason = err.reason();
tracing::debug!(
?reason,