#[non_exhaustive]pub enum Op {
Show 26 variants
Interrupt,
CleanBackgroundTerminals,
UserInput {
items: Vec<UserInput>,
final_output_json_schema: Option<Value>,
},
UserTurn {
items: Vec<UserInput>,
cwd: PathBuf,
approval_policy: AskForApproval,
sandbox_policy: SandboxPolicy,
model: String,
effort: Option<ReasoningEffort>,
summary: ReasoningSummary,
final_output_json_schema: Option<Value>,
collaboration_mode: Option<CollaborationMode>,
personality: Option<Personality>,
},
OverrideTurnContext {
cwd: Option<PathBuf>,
approval_policy: Option<AskForApproval>,
sandbox_policy: Option<SandboxPolicy>,
windows_sandbox_level: Option<WindowsSandboxLevel>,
model: Option<String>,
effort: Option<Option<ReasoningEffort>>,
summary: Option<ReasoningSummary>,
collaboration_mode: Option<CollaborationMode>,
personality: Option<Personality>,
},
ExecApproval {
id: String,
turn_id: Option<String>,
decision: ReviewDecision,
},
PatchApproval {
id: String,
decision: ReviewDecision,
},
ResolveElicitation {
server_name: String,
request_id: RequestId,
decision: ElicitationAction,
},
UserInputAnswer {
id: String,
response: RequestUserInputResponse,
},
DynamicToolResponse {
id: String,
response: DynamicToolResponse,
},
AddToHistory {
text: String,
},
GetHistoryEntryRequest {
offset: usize,
log_id: u64,
},
ListMcpTools,
RefreshMcpServers {
config: McpServerRefreshConfig,
},
ListCustomPrompts,
ListSkills {
cwds: Vec<PathBuf>,
force_reload: bool,
},
ListRemoteSkills,
DownloadRemoteSkill {
hazelnut_id: String,
is_preload: bool,
},
Compact,
SetThreadName {
name: String,
},
Undo,
ThreadRollback {
num_turns: u32,
},
Review {
review_request: ReviewRequest,
},
Shutdown,
RunUserShellCommand {
command: String,
},
ListModels,
}Expand description
Submission operation
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Interrupt
Abort current task.
This server sends EventMsg::TurnAborted in response.
CleanBackgroundTerminals
Terminate all running background terminal processes for this thread.
UserInput
Legacy user input.
Prefer Op::UserTurn so the caller provides full turn context
(cwd/approval/sandbox/model/etc.) for each turn.
Fields
UserTurn
Similar to Op::UserInput, but contains additional context required
for a turn of a [crate::codex_thread::CodexThread].
Fields
cwd: PathBufcwd to use with the SandboxPolicy and potentially tool calls
such as local_shell.
approval_policy: AskForApprovalPolicy to use for command approval.
sandbox_policy: SandboxPolicyPolicy to use for tool calls such as local_shell.
model: StringMust be a valid model slug for the configured client session associated with this conversation.
effort: Option<ReasoningEffort>Will only be honored if the model is configured to use reasoning.
summary: ReasoningSummaryWill only be honored if the model is configured to use reasoning.
collaboration_mode: Option<CollaborationMode>EXPERIMENTAL - set a pre-set collaboration mode. Takes precedence over model, effort, and developer instructions if set.
personality: Option<Personality>Optional personality override for this turn.
OverrideTurnContext
Override parts of the persistent turn context for subsequent turns.
All fields are optional; when omitted, the existing value is preserved.
This does not enqueue any input – it only updates defaults used for
turns that rely on persistent session-level context (for example,
Op::UserInput).
Fields
approval_policy: Option<AskForApproval>Updated command approval policy.
sandbox_policy: Option<SandboxPolicy>Updated sandbox policy for tool calls.
windows_sandbox_level: Option<WindowsSandboxLevel>Updated Windows sandbox mode for tool execution.
effort: Option<Option<ReasoningEffort>>Updated reasoning effort (honored only for reasoning-capable models).
Use Some(Some(_)) to set a specific effort, Some(None) to clear
the effort, or None to leave the existing value unchanged.
summary: Option<ReasoningSummary>Updated reasoning summary preference (honored only for reasoning-capable models).
collaboration_mode: Option<CollaborationMode>EXPERIMENTAL - set a pre-set collaboration mode. Takes precedence over model, effort, and developer instructions if set.
personality: Option<Personality>Updated personality preference.
ExecApproval
Approve a command execution
Fields
decision: ReviewDecisionThe user’s decision in response to the request.
PatchApproval
Approve a code patch
Fields
decision: ReviewDecisionThe user’s decision in response to the request.
ResolveElicitation
Resolve an MCP elicitation request.
Fields
decision: ElicitationActionUser’s decision for the request.
UserInputAnswer
Resolve a request_user_input tool call.
Fields
response: RequestUserInputResponseUser-provided answers.
DynamicToolResponse
Resolve a dynamic tool call request.
Fields
response: DynamicToolResponseTool output payload.
AddToHistory
Append an entry to the persistent cross-session message history.
Note the entry is not guaranteed to be logged if the user has history disabled, it matches the list of “sensitive” patterns, etc.
GetHistoryEntryRequest
Request a single history entry identified by log_id + offset.
ListMcpTools
Request the list of MCP tools available across all configured servers.
Reply is delivered via EventMsg::McpListToolsResponse.
RefreshMcpServers
Request MCP servers to reinitialize and refresh cached tool lists.
Fields
config: McpServerRefreshConfigListCustomPrompts
Request the list of available custom prompts.
ListSkills
Request the list of skills for the provided cwd values or the session default.
Fields
ListRemoteSkills
Request the list of remote skills available via ChatGPT sharing.
DownloadRemoteSkill
Download a remote skill by id into the local skills cache.
Compact
Request the agent to summarize the current conversation context. The agent will use its existing context (either conversation history or previous response id) to generate a summary which will be returned as an AgentMessage event.
SetThreadName
Set a user-facing thread name in the persisted rollout metadata. This is a local-only operation handled by codex-core; it does not involve the model.
Undo
Request Codex to undo a turn (turn are stacked so it is the same effect as CMD + Z).
ThreadRollback
Request Codex to drop the last N user turns from in-memory context.
This does not attempt to revert local filesystem changes. Clients are responsible for undoing any edits on disk.
Review
Request a code review from the agent.
Fields
review_request: ReviewRequestShutdown
Request to shut down codex instance.
RunUserShellCommand
Execute a user-initiated one-off shell command (triggered by “!cmd”).
The command string is executed using the user’s default shell and may
include shell syntax (pipes, redirects, etc.). Output is streamed via
ExecCommand* events and the UI regains control upon TurnComplete.
ListModels
Request the list of available models.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Op
impl<'de> Deserialize<'de> for Op
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for Op
impl JsonSchema for Op
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreimpl StructuralPartialEq for Op
Auto Trait Implementations§
impl Freeze for Op
impl RefUnwindSafe for Op
impl Send for Op
impl Sync for Op
impl Unpin for Op
impl UnsafeUnpin for Op
impl UnwindSafe for Op
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more