Skip to content

Commit 4d3835a

Browse files
committed
Cleanup
1 parent 5f904c4 commit 4d3835a

File tree

10 files changed

+22
-34
lines changed

10 files changed

+22
-34
lines changed

codex-rs/core/src/codex.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,7 @@ impl Session {
487487
let events = std::iter::once(Event {
488488
id: INITIAL_SUBMIT_ID.to_owned(),
489489
msg: EventMsg::SessionConfigured(SessionConfiguredEvent {
490-
session_id: conversation_id.0,
491-
conversation_id,
490+
session_id: conversation_id,
492491
model,
493492
history_log_id,
494493
history_entry_count,

codex-rs/core/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
use codex_protocol::mcp_protocol::ConversationId;
12
use reqwest::StatusCode;
23
use serde_json;
34
use std::io;
45
use std::time::Duration;
56
use thiserror::Error;
67
use tokio::task::JoinError;
7-
use codex_protocol::mcp_protocol::ConversationId;
88

99
pub type Result<T> = std::result::Result<T, CodexErr>;
1010

codex-rs/core/tests/chat_completions_payload.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use core_test_support::load_default_config_for_test;
1616
use futures::StreamExt;
1717
use serde_json::Value;
1818
use tempfile::TempDir;
19-
use uuid::Uuid;
2019
use wiremock::Mock;
2120
use wiremock::MockServer;
2221
use wiremock::ResponseTemplate;

codex-rs/core/tests/chat_completions_sse.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use codex_protocol::mcp_protocol::ConversationId;
1212
use core_test_support::load_default_config_for_test;
1313
use futures::StreamExt;
1414
use tempfile::TempDir;
15-
use uuid::Uuid;
1615
use wiremock::Mock;
1716
use wiremock::MockServer;
1817
use wiremock::ResponseTemplate;

codex-rs/exec/src/event_processor_with_human_output.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ impl EventProcessor for EventProcessorWithHumanOutput {
517517
}
518518
EventMsg::SessionConfigured(session_configured_event) => {
519519
let SessionConfiguredEvent {
520-
conversation_id,
520+
session_id: _,
521521
model,
522522
history_log_id: _,
523523
history_entry_count: _,

codex-rs/mcp-server/src/outgoing_message.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,7 @@ mod tests {
275275
let event = Event {
276276
id: "1".to_string(),
277277
msg: EventMsg::SessionConfigured(SessionConfiguredEvent {
278-
session_id: conversation_id.0,
279-
conversation_id,
278+
session_id: conversation_id,
280279
model: "gpt-4o".to_string(),
281280
history_log_id: 1,
282281
history_entry_count: 1000,
@@ -307,8 +306,7 @@ mod tests {
307306

308307
let conversation_id = ConversationId::new();
309308
let session_configured_event = SessionConfiguredEvent {
310-
session_id: conversation_id.0,
311-
conversation_id,
309+
session_id: conversation_id,
312310
model: "gpt-4o".to_string(),
313311
history_log_id: 1,
314312
history_entry_count: 1000,
@@ -337,7 +335,7 @@ mod tests {
337335
},
338336
"id": "1",
339337
"msg": {
340-
"conversation_id": session_configured_event.conversation_id,
338+
"session_id": session_configured_event.session_id,
341339
"model": session_configured_event.model,
342340
"history_log_id": session_configured_event.history_log_id,
343341
"history_entry_count": session_configured_event.history_entry_count,

codex-rs/protocol/src/protocol.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,21 @@ use std::path::PathBuf;
1010
use std::str::FromStr;
1111
use std::time::Duration;
1212

13+
use crate::config_types::ReasoningEffort as ReasoningEffortConfig;
14+
use crate::config_types::ReasoningSummary as ReasoningSummaryConfig;
1315
use crate::custom_prompts::CustomPrompt;
1416
use crate::mcp_protocol::ConversationId;
17+
use crate::message_history::HistoryEntry;
18+
use crate::models::ResponseItem;
19+
use crate::parse_command::ParsedCommand;
20+
use crate::plan_tool::UpdatePlanArgs;
1521
use mcp_types::CallToolResult;
1622
use mcp_types::Tool as McpTool;
1723
use serde::Deserialize;
1824
use serde::Serialize;
1925
use serde_with::serde_as;
2026
use strum_macros::Display;
2127
use ts_rs::TS;
22-
use uuid::Uuid;
23-
use crate::config_types::ReasoningEffort as ReasoningEffortConfig;
24-
use crate::config_types::ReasoningSummary as ReasoningSummaryConfig;
25-
use crate::message_history::HistoryEntry;
26-
use crate::models::ResponseItem;
27-
use crate::parse_command::ParsedCommand;
28-
use crate::plan_tool::UpdatePlanArgs;
2928

3029
/// Open/close tags for special user-input blocks. Used across crates to avoid
3130
/// duplicated hardcoded strings.
@@ -931,11 +930,8 @@ pub struct ListCustomPromptsResponseEvent {
931930

932931
#[derive(Debug, Default, Clone, Deserialize, Serialize)]
933932
pub struct SessionConfiguredEvent {
934-
/// For backwards compatibility.
935-
pub session_id: Uuid,
936-
937-
/// Unique id for this conversation.
938-
pub conversation_id: ConversationId,
933+
/// Name left as session_id instead of conversation_id for backwards compatibility.
934+
pub session_id: ConversationId,
939935

940936
/// Tell the client what model is being queried.
941937
pub model: String,
@@ -1021,8 +1017,7 @@ mod tests {
10211017
let event = Event {
10221018
id: "1234".to_string(),
10231019
msg: EventMsg::SessionConfigured(SessionConfiguredEvent {
1024-
session_id: conversation_id.0,
1025-
conversation_id,
1020+
session_id: conversation_id,
10261021
model: "codex-mini-latest".to_string(),
10271022
history_log_id: 0,
10281023
history_entry_count: 0,

codex-rs/tui/src/chatwidget.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl ChatWidget {
163163
fn on_session_configured(&mut self, event: codex_core::protocol::SessionConfiguredEvent) {
164164
self.bottom_pane
165165
.set_history_metadata(event.history_log_id, event.history_entry_count);
166-
self.conversation_id = Some(event.conversation_id);
166+
self.conversation_id = Some(event.session_id);
167167
let initial_messages = event.initial_messages.clone();
168168
if let Some(messages) = initial_messages {
169169
self.replay_initial_messages(messages);

codex-rs/tui/src/chatwidget/tests.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ use std::io::BufRead;
3636
use std::io::BufReader;
3737
use std::path::PathBuf;
3838
use tokio::sync::mpsc::unbounded_channel;
39-
use uuid::Uuid;
4039

4140
fn test_config() -> Config {
4241
// Use base defaults to avoid depending on host state.
@@ -136,8 +135,7 @@ fn resumed_initial_messages_render_history() {
136135
let conversation_id = ConversationId::new();
137136

138137
let configured = codex_core::protocol::SessionConfiguredEvent {
139-
session_id: conversation_id.0,
140-
conversation_id,
138+
session_id: conversation_id,
141139
model: "test-model".to_string(),
142140
history_log_id: 0,
143141
history_entry_count: 0,
@@ -371,11 +369,10 @@ fn begin_exec(chat: &mut ChatWidget, call_id: &str, raw_cmd: &str) {
371369
// Build the full command vec and parse it using core's parser,
372370
// then convert to protocol variants for the event payload.
373371
let command = vec!["bash".to_string(), "-lc".to_string(), raw_cmd.to_string()];
374-
let parsed_cmd: Vec<ParsedCommand> =
375-
codex_core::parse_command::parse_command(&command)
376-
.into_iter()
377-
.map(Into::into)
378-
.collect();
372+
let parsed_cmd: Vec<ParsedCommand> = codex_core::parse_command::parse_command(&command)
373+
.into_iter()
374+
.map(Into::into)
375+
.collect();
379376
chat.handle_codex_event(Event {
380377
id: call_id.to_string(),
381378
msg: EventMsg::ExecCommandBegin(ExecCommandBeginEvent {

codex-rs/tui/src/history_cell.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ pub(crate) fn new_session_info(
600600
) -> PlainHistoryCell {
601601
let SessionConfiguredEvent {
602602
model,
603+
session_id: _,
603604
conversation_id: _,
604605
history_log_id: _,
605606
history_entry_count: _,

0 commit comments

Comments
 (0)