mirror of
https://github.com/openai/codex.git
synced 2026-11-14 21:40:39 +00:00
Separate thread startup metadata from replay history (#46294)
## Why `CodexThread` retained the full `SessionConfiguredEvent`, including initial replay messages, and cloned it even for callers that only needed thread or session IDs. ## What changed Store `ThreadStartupMetadata` without replay history and expose it by reference through `startup_metadata()`. Update callers to read IDs from this metadata. When rejoining a running thread, rebuild the startup response using the supplied resume history for `initial_messages`. ## Testing Extend the resume test to verify that rejoining reuses the loaded thread, preserves startup metadata, and still returns the original replay messages as a prefix. GitOrigin-RevId: 9d656063088c28f091d29e5862e4b9d894b7642c
This commit is contained in:
@@ -8,6 +8,7 @@ use crate::session::SessionSettingsUpdate;
|
||||
use crate::session::new_submission_id;
|
||||
use crate::session::session::Session;
|
||||
use crate::session::step_settings::StepSettingsUpdate;
|
||||
use crate::thread_startup_metadata::ThreadStartupMetadata;
|
||||
use codex_diagnostics::Gauge;
|
||||
use codex_diagnostics::GaugeGuard;
|
||||
use codex_exec_server::SelectedCapabilityRootsStatus;
|
||||
@@ -39,7 +40,6 @@ use codex_protocol::protocol::Event;
|
||||
use codex_protocol::protocol::MultiAgentVersion;
|
||||
use codex_protocol::protocol::Op;
|
||||
use codex_protocol::protocol::SandboxPolicy;
|
||||
use codex_protocol::protocol::SessionConfiguredEvent;
|
||||
use codex_protocol::protocol::SessionSource;
|
||||
use codex_protocol::protocol::Submission;
|
||||
use codex_protocol::protocol::ThreadHistoryMode;
|
||||
@@ -184,7 +184,7 @@ pub struct CodexThread {
|
||||
// Registration source controls live access and lifecycle hooks. Managed Guardian
|
||||
// reviewers keep their existing subagent identity inside the session.
|
||||
pub(crate) session_source: SessionSource,
|
||||
session_configured: SessionConfiguredEvent,
|
||||
startup_metadata: ThreadStartupMetadata,
|
||||
rollout_path: Option<PathBuf>,
|
||||
out_of_band_elicitations: Mutex<OutOfBandElicitations>,
|
||||
_diagnostics_guard: GaugeGuard,
|
||||
@@ -210,7 +210,7 @@ impl CodexThread {
|
||||
pub(crate) fn new(
|
||||
session: Arc<Session>,
|
||||
io: SessionIo,
|
||||
session_configured: SessionConfiguredEvent,
|
||||
startup_metadata: ThreadStartupMetadata,
|
||||
rollout_path: Option<PathBuf>,
|
||||
session_source: SessionSource,
|
||||
) -> Self {
|
||||
@@ -218,7 +218,7 @@ impl CodexThread {
|
||||
session,
|
||||
io,
|
||||
session_source,
|
||||
session_configured,
|
||||
startup_metadata,
|
||||
rollout_path,
|
||||
out_of_band_elicitations: Mutex::new(OutOfBandElicitations::default()),
|
||||
_diagnostics_guard: LIVE_THREADS.track(),
|
||||
@@ -707,8 +707,9 @@ impl CodexThread {
|
||||
self.rollout_path.clone()
|
||||
}
|
||||
|
||||
pub fn session_configured(&self) -> SessionConfiguredEvent {
|
||||
self.session_configured.clone()
|
||||
/// Returns startup metadata without the one-time initial message replay.
|
||||
pub fn startup_metadata(&self) -> &ThreadStartupMetadata {
|
||||
&self.startup_metadata
|
||||
}
|
||||
|
||||
pub(crate) fn is_running(&self) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user