Add extra config to StoredThread, leave empty for now (#27092)

This commit is contained in:
Boyang Niu
2026-06-08 17:38:35 -07:00
committed by GitHub
Unverified
parent 8534912df9
commit e127a0cf99
18 changed files with 31 additions and 0 deletions
@@ -2181,6 +2181,7 @@ mod tests {
];
let stored_thread = StoredThread {
thread_id,
extra_config: None,
rollout_path: None,
forked_from_id: None,
parent_thread_id: None,
@@ -177,6 +177,7 @@ impl ExternalAgentSessionImporter {
let now = Utc::now();
let create_params = CreateThreadParams {
thread_id,
extra_config: None,
forked_from_id: None,
parent_thread_id: None,
source: source.clone(),
@@ -394,6 +394,7 @@ mod thread_processor_behavior_tests {
ThreadId::from_string("00000000-0000-0000-0000-000000000123").expect("valid thread");
let stored_thread = StoredThread {
thread_id,
extra_config: None,
rollout_path: Some(PathBuf::from("/tmp/thread.jsonl")),
forked_from_id: None,
parent_thread_id: None,
@@ -122,6 +122,7 @@ async fn get_conversation_summary_by_thread_id_reads_pathless_store_thread() ->
store
.create_thread(CreateThreadParams {
thread_id,
extra_config: None,
forked_from_id: None,
parent_thread_id: None,
source: SessionSource::Cli,
@@ -1356,6 +1356,7 @@ async fn seed_pathless_store_thread(
store
.create_thread(CreateThreadParams {
thread_id,
extra_config: None,
forked_from_id: None,
parent_thread_id: None,
source: ProtocolSessionSource::Cli,
@@ -209,6 +209,7 @@ async fn thread_unarchive_preserves_pathless_store_metadata() -> Result<()> {
store
.create_thread(CreateThreadParams {
thread_id,
extra_config: None,
forked_from_id: Some(parent_thread_id),
parent_thread_id: None,
source: SessionSource::Cli,
+1
View File
@@ -35,6 +35,7 @@ pub use codex_core::ThreadManager;
pub use codex_core::ThreadShutdownReport;
pub use codex_core::config::Config;
pub use codex_core::config::Constrained;
pub use codex_core::config::ExtraConfig;
pub use codex_core::config::GhostSnapshotConfig;
pub use codex_core::config::MultiAgentV2Config;
pub use codex_core::config::Permissions;
+5
View File
@@ -103,6 +103,7 @@ use codex_protocol::permissions::NetworkSandboxPolicy;
use codex_protocol::protocol::AskForApproval;
use codex_protocol::protocol::MultiAgentVersion;
use codex_protocol::protocol::SandboxPolicy;
pub use codex_thread_store::ExtraConfig;
use codex_utils_absolute_path::AbsolutePathBuf;
use codex_utils_absolute_path::AbsolutePathBufGuard;
use rmcp::model::ElicitationCapability;
@@ -870,6 +871,9 @@ pub struct Config {
/// When true, session is not persisted on disk. Default to `false`
pub ephemeral: bool,
/// Optional extra configuration fields for the thread.
pub extra_config: Option<ExtraConfig>,
/// Whether enabled hooks should run without requiring persisted hook trust for this session.
///
/// This is a runtime-only knob populated from invocation overrides, not from config files.
@@ -3525,6 +3529,7 @@ impl Config {
config_layer_stack,
history,
ephemeral: ephemeral.unwrap_or_default(),
extra_config: None,
bypass_hook_trust,
file_opener: cfg.file_opener.unwrap_or(UriBasedFileOpener::VsCode),
codex_self_exe,
@@ -30,6 +30,7 @@ use tempfile::TempDir;
fn stored_thread(cwd: &str, title: &str, first_user_message: &str) -> StoredThread {
StoredThread {
thread_id: ThreadId::new(),
extra_config: None,
rollout_path: Some(PathBuf::from("/tmp/rollout.jsonl")),
forked_from_id: None,
parent_thread_id: None,
+1
View File
@@ -543,6 +543,7 @@ impl Session {
Arc::clone(&thread_store),
CreateThreadParams {
thread_id,
extra_config: config.extra_config.clone(),
forked_from_id,
parent_thread_id,
source: session_source,
+2
View File
@@ -3526,6 +3526,7 @@ async fn attach_thread_persistence(session: &mut Session) -> PathBuf {
Arc::clone(&session.services.thread_store),
CreateThreadParams {
thread_id: session.thread_id,
extra_config: None,
forked_from_id: None,
parent_thread_id: None,
source: SessionSource::Exec,
@@ -6360,6 +6361,7 @@ async fn shutdown_complete_does_not_append_to_thread_store_after_shutdown() {
Arc::clone(&thread_store),
CreateThreadParams {
thread_id: session.thread_id,
extra_config: None,
forked_from_id: None,
parent_thread_id: None,
source: SessionSource::Exec,
@@ -238,6 +238,7 @@ fn new_config(model: Option<String>, arg0_paths: Arg0DispatchPaths) -> anyhow::R
codex_home,
history: History::default(),
ephemeral: true,
extra_config: None,
file_opener: UriBasedFileOpener::VsCode,
codex_self_exe: arg0_paths.codex_self_exe,
codex_linux_sandbox_exe: arg0_paths.codex_linux_sandbox_exe,
+1
View File
@@ -356,6 +356,7 @@ fn stored_thread_from_state(
Ok(StoredThread {
thread_id,
extra_config: created.extra_config.clone(),
rollout_path: metadata
.and_then(|metadata| metadata.rollout_path.clone())
.or(rollout_path),
+1
View File
@@ -25,6 +25,7 @@ pub use types::AppendThreadItemsParams;
pub use types::ArchiveThreadParams;
pub use types::ClearableField;
pub use types::CreateThreadParams;
pub use types::ExtraConfig;
pub use types::GitInfoPatch;
pub use types::ItemPage;
pub use types::ListItemsParams;
@@ -122,6 +122,7 @@ pub(super) fn stored_thread_from_rollout_item(
Some(StoredThread {
thread_id,
extra_config: None,
rollout_path: Some(rollout_path),
forked_from_id: None,
parent_thread_id: item.parent_thread_id,
+1
View File
@@ -1013,6 +1013,7 @@ mod tests {
fn create_thread_params(thread_id: ThreadId) -> CreateThreadParams {
CreateThreadParams {
thread_id,
extra_config: None,
forked_from_id: None,
parent_thread_id: None,
source: SessionSource::Exec,
@@ -325,6 +325,7 @@ async fn stored_thread_from_sqlite_metadata(
permission_profile_from_metadata_value(&metadata.sandbox_policy, metadata.cwd.as_path());
StoredThread {
thread_id: metadata.id,
extra_config: None,
rollout_path: Some(rollout_path),
forked_from_id,
parent_thread_id,
@@ -390,6 +391,7 @@ fn stored_thread_from_meta_line(
let rollout_path = codex_rollout::plain_rollout_path(path.as_path());
StoredThread {
thread_id: meta_line.meta.id,
extra_config: None,
rollout_path: Some(rollout_path),
forked_from_id: meta_line.meta.forked_from_id,
parent_thread_id: meta_line.meta.parent_thread_id,
+8
View File
@@ -56,11 +56,17 @@ pub struct ThreadPersistenceMetadata {
pub memory_mode: MemoryMode,
}
/// Extra configuration fields for a thread.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct ExtraConfig {}
/// Parameters required to create a persisted thread.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct CreateThreadParams {
/// Thread id generated by Codex before opening persistence.
pub thread_id: ThreadId,
/// Optional extra configuration fields for the thread.
pub extra_config: Option<ExtraConfig>,
/// Source thread id when this thread is created as a fork.
pub forked_from_id: Option<ThreadId>,
/// The ID of the parent thread. This will only be set if this thread is a subagent.
@@ -349,6 +355,8 @@ pub struct ItemPage {
pub struct StoredThread {
/// Thread id.
pub thread_id: ThreadId,
/// Optional extra configuration fields for the thread.
pub extra_config: Option<ExtraConfig>,
/// Local rollout path when the backing store is filesystem-based.
pub rollout_path: Option<PathBuf>,
/// Source thread id when this thread was forked from another thread.