mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Remove initial messages from session configuration events (#50360)
## What changed Remove `initial_messages` from `SessionConfiguredEvent` and the corresponding schema. Stop attaching replay history to startup events for resumed or rejoined threads, and remove `InitialHistory::get_event_msgs`. ## Testing Update the MCP resume test to verify persisted tool events through `load_history`, and retain coverage that resumed requests include prior conversation items. GitOrigin-RevId: 54b72bc44423c9b1ef2051891ef392c0ede32fe5
This commit is contained in:
@@ -66,7 +66,6 @@ async fn interrupt_if_no_pending_input_handles_cancelled_submission() {
|
||||
active_permission_profile: None,
|
||||
cwd: turn_context.config.cwd.clone(),
|
||||
reasoning_effort: None,
|
||||
initial_messages: None,
|
||||
network_proxy: None,
|
||||
rollout_path: None,
|
||||
}),
|
||||
|
||||
@@ -1857,8 +1857,6 @@ impl Session {
|
||||
*guard = Arc::downgrade(&sess);
|
||||
}
|
||||
// Dispatch the SessionConfiguredEvent first and then report any errors.
|
||||
// If resuming, include converted initial messages in the payload so UIs can render them immediately.
|
||||
let initial_messages = initial_history.get_event_msgs();
|
||||
let thread_config =
|
||||
session_configuration.thread_config_snapshot(turn_environments.selections());
|
||||
let events = std::iter::once(Event {
|
||||
@@ -1884,7 +1882,6 @@ impl Session {
|
||||
permission_profile: thread_config.permission_profile,
|
||||
active_permission_profile: thread_config.active_permission_profile,
|
||||
reasoning_effort: thread_config.reasoning_effort,
|
||||
initial_messages,
|
||||
rollout_path,
|
||||
}),
|
||||
})
|
||||
|
||||
@@ -2156,9 +2156,8 @@ impl ThreadManagerState {
|
||||
resumed.conversation_id
|
||||
)));
|
||||
}
|
||||
let session_configured = thread
|
||||
.startup_metadata()
|
||||
.to_session_configured_event(initial_history.get_event_msgs());
|
||||
let session_configured =
|
||||
thread.startup_metadata().to_session_configured_event();
|
||||
startup_state.release_membership();
|
||||
if let Some(startup_guard) = startup_guard {
|
||||
startup_guard.disarm();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Retained startup metadata, separate from the replay sent in startup responses.
|
||||
//! Retained startup metadata for new and resumed threads.
|
||||
|
||||
use codex_protocol::SessionId;
|
||||
use codex_protocol::ThreadId;
|
||||
@@ -7,14 +7,13 @@ use codex_protocol::models::ActivePermissionProfile;
|
||||
use codex_protocol::models::PermissionProfile;
|
||||
use codex_protocol::openai_models::ReasoningEffort;
|
||||
use codex_protocol::protocol::AskForApproval;
|
||||
use codex_protocol::protocol::EventMsg;
|
||||
use codex_protocol::protocol::SessionConfiguredEvent;
|
||||
use codex_protocol::protocol::SessionNetworkProxyRuntime;
|
||||
use codex_protocol::protocol::ThreadSource;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// The configuration reported when a thread started, without its replay history.
|
||||
/// The configuration reported when a thread started.
|
||||
/// Current settings are available through [`crate::CodexThread::config_snapshot`].
|
||||
#[derive(Debug)]
|
||||
pub struct ThreadStartupMetadata {
|
||||
@@ -55,7 +54,6 @@ impl From<&SessionConfiguredEvent> for ThreadStartupMetadata {
|
||||
active_permission_profile,
|
||||
cwd,
|
||||
reasoning_effort,
|
||||
initial_messages: _,
|
||||
network_proxy,
|
||||
rollout_path,
|
||||
} = event;
|
||||
@@ -82,10 +80,7 @@ impl From<&SessionConfiguredEvent> for ThreadStartupMetadata {
|
||||
}
|
||||
|
||||
impl ThreadStartupMetadata {
|
||||
pub(crate) fn to_session_configured_event(
|
||||
&self,
|
||||
initial_messages: Option<Vec<EventMsg>>,
|
||||
) -> SessionConfiguredEvent {
|
||||
pub(crate) fn to_session_configured_event(&self) -> SessionConfiguredEvent {
|
||||
SessionConfiguredEvent {
|
||||
session_id: self.session_id,
|
||||
thread_id: self.thread_id,
|
||||
@@ -102,7 +97,6 @@ impl ThreadStartupMetadata {
|
||||
active_permission_profile: self.active_permission_profile.clone(),
|
||||
cwd: self.cwd.clone(),
|
||||
reasoning_effort: self.reasoning_effort.clone(),
|
||||
initial_messages,
|
||||
network_proxy: self.network_proxy.clone(),
|
||||
rollout_path: self.rollout_path.clone(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user