Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

core: stop emitting legacy command events directly (#31629)

Owen Lin602dbb42dcc9
diff --git a/codex-rs/core/src/tools/events.rs b/codex-rs/core/src/tools/events.rs
index 5b30c6a156..628e6ce9bc 100644
--- a/codex-rs/core/src/tools/events.rs
+++ b/codex-rs/core/src/tools/events.rs
@@ -3,7 +3,6 @@ use crate::session::session::Session;
use crate::session::turn_context::TurnContext;
use crate::tools::context::SharedTurnDiffTracker;
use crate::tools::sandboxing::ToolError;
-use crate::turn_timing::now_unix_timestamp_ms;
use codex_apply_patch::AppliedPatchDelta;
use codex_protocol::error::CodexErr;
use codex_protocol::error::SandboxErr;
@@ -14,8 +13,6 @@ use codex_protocol::items::FileChangeItem;
use codex_protocol::items::TurnItem;
use codex_protocol::parse_command::ParsedCommand;
use codex_protocol::protocol::EventMsg;
-use codex_protocol::protocol::ExecCommandBeginEvent;
-use codex_protocol::protocol::ExecCommandEndEvent;
use codex_protocol::protocol::ExecCommandSource;
use codex_protocol::protocol::ExecCommandStatus;
use codex_protocol::protocol::FileChange;
@@ -104,25 +101,6 @@ pub(crate) async fn emit_exec_command_begin(
interaction_input: Option<String>,
process_id: Option<&str>,
) {
- if matches!(source, ExecCommandSource::UnifiedExecInteraction) {
- ctx.session
- .send_event(
- ctx.turn,
- EventMsg::ExecCommandBegin(ExecCommandBeginEvent {
- call_id: ctx.call_id.to_string(),
- process_id: process_id.map(str::to_owned),
- turn_id: ctx.turn.sub_id.clone(),
- started_at_ms: now_unix_timestamp_ms(),
- command: command.to_vec(),
- cwd: cwd.clone(),
- parsed_cmd: parsed_cmd.to_vec(),
- source,
- interaction_input,
- }),
- )
- .await;
- return;
- }
ctx.session
.emit_turn_item_started(
ctx.turn,
@@ -568,32 +546,6 @@ async fn emit_exec_end(
exec_input: ExecCommandInput<'_>,
exec_result: ExecCommandResult,
) {
- if matches!(exec_input.source, ExecCommandSource::UnifiedExecInteraction) {
- ctx.session
- .send_event(
- ctx.turn,
- EventMsg::ExecCommandEnd(ExecCommandEndEvent {
- call_id: ctx.call_id.to_string(),
- process_id: exec_input.process_id.map(str::to_owned),
- turn_id: ctx.turn.sub_id.clone(),
- completed_at_ms: now_unix_timestamp_ms(),
- command: exec_input.command.to_vec(),
- cwd: exec_input.cwd.clone(),
- parsed_cmd: exec_input.parsed_cmd.to_vec(),
- source: exec_input.source,
- interaction_input: exec_input.interaction_input.map(str::to_owned),
- stdout: exec_result.stdout,
- stderr: exec_result.stderr,
- aggregated_output: exec_result.aggregated_output,
- exit_code: exec_result.exit_code,
- duration: exec_result.duration,
- formatted_output: exec_result.formatted_output,
- status: exec_result.status,
- }),
- )
- .await;
- return;
- }
ctx.session
.emit_turn_item_completed(
ctx.turn,