mirror of
https://github.com/openai/codex.git
synced 2026-10-29 19:08:43 +00:00
Unify turn input submission and routing (#38275)
## What changed - Add `TurnInputRequest` and typed submission results for atomically starting a turn, steering the active turn, or declining input with a specific reason. - Expose `start_or_steer_turn`, `start_turn_if_idle`, and `steer_turn` on `CodexThread`, and migrate Core consumers to these APIs. - Make app-server `turn/start` steer an active regular turn and return that turn's ID. Reject incompatible output schemas and non-steerable turns without applying settings or enqueueing input. ## Testing - Cover concurrent start-or-steer submissions, accepted and rejected settings updates, output-schema compatibility, idle-start rejection, and app-server steering. GitOrigin-RevId: dd9b5528d76ec650c019e97af420bc13190ea86a
This commit is contained in:
@@ -11,7 +11,6 @@ use codex_login::AuthManager;
|
||||
use codex_login::default_client::USER_AGENT_SUFFIX;
|
||||
use codex_login::default_client::get_codex_user_agent;
|
||||
use codex_protocol::protocol::SessionSource;
|
||||
use codex_protocol::protocol::Submission;
|
||||
use rmcp::model::CallToolRequestParams;
|
||||
use rmcp::model::CallToolResult;
|
||||
use rmcp::model::ClientNotification;
|
||||
@@ -535,7 +534,7 @@ impl MessageProcessor {
|
||||
tracing::warn!("ignoring cancellation without a request id");
|
||||
return;
|
||||
};
|
||||
// Create a stable string form early for logging and submission id.
|
||||
// Create a stable string form early for logging.
|
||||
let request_id_string = request_id.to_string();
|
||||
|
||||
// Resolve the thread for the active MCP request.
|
||||
@@ -559,14 +558,7 @@ impl MessageProcessor {
|
||||
|
||||
// Submit interrupt to Codex.
|
||||
if let Err(e) = codex_arc
|
||||
.submit_with_id(Submission {
|
||||
id: request_id_string,
|
||||
op: codex_protocol::protocol::Op::Interrupt,
|
||||
client_user_message_id: None,
|
||||
trace: None,
|
||||
parent_turn_id: None,
|
||||
root_turn_id: None,
|
||||
})
|
||||
.submit(codex_protocol::protocol::Op::Interrupt)
|
||||
.await
|
||||
{
|
||||
tracing::error!("Failed to submit interrupt to Codex: {e}");
|
||||
|
||||
Reference in New Issue
Block a user