Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions codex-rs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions codex-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ members = [
"ollama",
"process-hardening",
"protocol",
"rollout",
"rmcp-client",
"responses-api-proxy",
"sandboxing",
Expand All @@ -66,6 +67,7 @@ members = [
"utils/approval-presets",
"utils/oss",
"utils/output-truncation",
"utils/path-utils",
"utils/fuzzy-match",
"utils/stream-parser",
"codex-client",
Expand Down Expand Up @@ -130,6 +132,7 @@ codex-ollama = { path = "ollama" }
codex-otel = { path = "otel" }
codex-process-hardening = { path = "process-hardening" }
codex-protocol = { path = "protocol" }
codex-rollout = { path = "rollout" }
codex-responses-api-proxy = { path = "responses-api-proxy" }
codex-rmcp-client = { path = "rmcp-client" }
codex-sandboxing = { path = "sandboxing" }
Expand All @@ -156,6 +159,7 @@ codex-utils-image = { path = "utils/image" }
codex-utils-json-to-toml = { path = "utils/json-to-toml" }
codex-utils-oss = { path = "utils/oss" }
codex-utils-output-truncation = { path = "utils/output-truncation" }
codex-utils-path = { path = "utils/path-utils" }
codex-utils-pty = { path = "utils/pty" }
codex-utils-readiness = { path = "utils/readiness" }
codex-utils-rustls-provider = { path = "utils/rustls-provider" }
Expand Down
9 changes: 2 additions & 7 deletions codex-rs/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ codex-login = { workspace = true }
codex-shell-command = { workspace = true }
codex-skills = { workspace = true }
codex-execpolicy = { workspace = true }
codex-file-search = { workspace = true }
codex-git-utils = { workspace = true }
codex-hooks = { workspace = true }
codex-network-proxy = { workspace = true }
codex-otel = { workspace = true }
codex-artifacts = { workspace = true }
codex-protocol = { workspace = true }
codex-rollout = { workspace = true }
codex-rmcp-client = { workspace = true }
codex-sandboxing = { workspace = true }
codex-state = { workspace = true }
Expand All @@ -56,6 +56,7 @@ codex-utils-cache = { workspace = true }
codex-utils-image = { workspace = true }
codex-utils-home-dir = { workspace = true }
codex-utils-output-truncation = { workspace = true }
codex-utils-path = { workspace = true }
codex-utils-pty = { workspace = true }
codex-utils-readiness = { workspace = true }
codex-secrets = { workspace = true }
Expand Down Expand Up @@ -95,12 +96,6 @@ similar = { workspace = true }
tempfile = { workspace = true }
test-log = { workspace = true }
thiserror = { workspace = true }
time = { workspace = true, features = [
"formatting",
"parsing",
"local-offset",
"macros",
] }
tokio = { workspace = true, features = [
"io-std",
"macros",
Expand Down
2 changes: 1 addition & 1 deletion codex-rs/core/src/codex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,7 @@ impl Session {
})?;
let rollout_path = rollout_recorder
.as_ref()
.map(|rec| rec.rollout_path.clone());
.map(|rec| rec.rollout_path().to_path_buf());

let mut post_session_configured_events = Vec::<Event>::new();

Expand Down
10 changes: 7 additions & 3 deletions codex-rs/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub mod connectors;
mod context_manager;
mod contextual_user_message;
pub mod custom_prompts;
pub mod env;
pub use codex_utils_path::env;
mod environment_context;
pub mod error;
pub mod exec;
Expand Down Expand Up @@ -65,7 +65,8 @@ pub mod mention_syntax;
mod mentions;
pub mod message_history;
mod model_provider_info;
pub mod path_utils;
pub mod utils;
pub use utils::path_utils;
pub mod personality_migration;
pub mod plugins;
mod sandbox_tags;
Expand Down Expand Up @@ -123,11 +124,14 @@ pub mod project_doc;
mod rollout;
pub(crate) mod safety;
pub mod seatbelt;
mod session_rollout_init_error;
pub mod shell;
pub mod shell_snapshot;
pub mod skills;
pub mod spawn;
pub mod state_db;
pub mod state_db_bridge;
pub use codex_rollout::state_db;
mod thread_rollout_truncation;
mod tools;
pub mod turn_diff_tracker;
mod turn_metadata;
Expand Down
63 changes: 63 additions & 0 deletions codex-rs/core/src/rollout.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
use crate::config::Config;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relatedly, will all these re-exports get removed in a mechanical follow-up PR?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

pub use codex_rollout::ARCHIVED_SESSIONS_SUBDIR;
pub use codex_rollout::INTERACTIVE_SESSION_SOURCES;
pub use codex_rollout::RolloutRecorder;
pub use codex_rollout::RolloutRecorderParams;
pub use codex_rollout::SESSIONS_SUBDIR;
pub use codex_rollout::SessionMeta;
pub use codex_rollout::append_thread_name;
pub use codex_rollout::find_archived_thread_path_by_id_str;
#[deprecated(note = "use find_thread_path_by_id_str")]
pub use codex_rollout::find_conversation_path_by_id_str;
pub use codex_rollout::find_thread_name_by_id;
pub use codex_rollout::find_thread_path_by_id_str;
pub use codex_rollout::find_thread_path_by_name_str;
pub use codex_rollout::rollout_date_parts;

impl codex_rollout::RolloutConfigView for Config {
Comment thread
aibrahim-oai marked this conversation as resolved.
fn codex_home(&self) -> &std::path::Path {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separately, we should be moving all of these things to AbsolutePathBuf.

self.codex_home.as_path()
}

fn sqlite_home(&self) -> &std::path::Path {
self.sqlite_home.as_path()
}

fn cwd(&self) -> &std::path::Path {
self.cwd.as_path()
}

fn model_provider_id(&self) -> &str {
self.model_provider_id.as_str()
}

fn generate_memories(&self) -> bool {
self.memories.generate_memories
}
}

pub mod list {
pub use codex_rollout::list::*;
}

pub(crate) mod metadata {
pub(crate) use codex_rollout::metadata::builder_from_items;
}

pub mod policy {
pub use codex_rollout::policy::*;
}

pub mod recorder {
pub use codex_rollout::recorder::*;
}

pub mod session_index {
pub use codex_rollout::session_index::*;
}

pub(crate) use crate::session_rollout_init_error::map_session_init_error;

pub(crate) mod truncation {
pub(crate) use crate::thread_rollout_truncation::*;
}
21 changes: 21 additions & 0 deletions codex-rs/core/src/state_db_bridge.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use codex_rollout::state_db as rollout_state_db;
pub use codex_rollout::state_db::StateDbHandle;
pub use codex_rollout::state_db::apply_rollout_items;
pub use codex_rollout::state_db::find_rollout_path_by_id;
pub use codex_rollout::state_db::get_dynamic_tools;
pub use codex_rollout::state_db::list_thread_ids_db;
pub use codex_rollout::state_db::list_threads_db;
pub use codex_rollout::state_db::mark_thread_memory_mode_polluted;
pub use codex_rollout::state_db::normalize_cwd_for_state_db;
pub use codex_rollout::state_db::open_if_present;
pub use codex_rollout::state_db::persist_dynamic_tools;
pub use codex_rollout::state_db::read_repair_rollout_path;
pub use codex_rollout::state_db::reconcile_rollout;
pub use codex_rollout::state_db::touch_thread_updated_at;
pub use codex_state::LogEntry;

use crate::config::Config;

pub async fn get_state_db(config: &Config) -> Option<StateDbHandle> {
rollout_state_db::get_state_db(config).await
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ pub(crate) fn truncate_rollout_before_nth_user_message_from_start(
}

#[cfg(test)]
#[path = "truncation_tests.rs"]
#[path = "thread_rollout_truncation_tests.rs"]
mod tests;
1 change: 1 addition & 0 deletions codex-rs/core/src/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod path_utils;
1 change: 1 addition & 0 deletions codex-rs/core/src/utils/path_utils.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub use codex_utils_path::*;
6 changes: 6 additions & 0 deletions codex-rs/rollout/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
load("//:defs.bzl", "codex_rust_crate")

codex_rust_crate(
name = "rollout",
crate_name = "codex_rollout",
)
49 changes: 49 additions & 0 deletions codex-rs/rollout/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[package]
edition.workspace = true
license.workspace = true
name = "codex-rollout"
version.workspace = true

[lib]
doctest = false
name = "codex_rollout"
path = "src/lib.rs"

[lints]
workspace = true

[dependencies]
anyhow = { workspace = true }
async-trait = { workspace = true }
chrono = { workspace = true, features = ["serde"] }
codex-file-search = { workspace = true }
codex-git-utils = { workspace = true }
codex-login = { workspace = true }
codex-otel = { workspace = true }
codex-protocol = { workspace = true }
codex-state = { workspace = true }
codex-utils-path = { workspace = true }
codex-utils-string = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
time = { workspace = true, features = [
"formatting",
"local-offset",
"macros",
"parsing",
] }
tokio = { workspace = true, features = [
"fs",
"io-util",
"macros",
"process",
"rt",
"sync",
"time",
] }
tracing = { workspace = true }
uuid = { workspace = true }

[dev-dependencies]
pretty_assertions = { workspace = true }
tempfile = { workspace = true }
Loading
Loading