Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

chores: models manager (#7937)

Ahmed Ibrahim149696d9595f
diff --git a/codex-rs/app-server/tests/common/Cargo.toml b/codex-rs/app-server/tests/common/Cargo.toml
index 380f70d9b1..67ceeae4f4 100644
--- a/codex-rs/app-server/tests/common/Cargo.toml
+++ b/codex-rs/app-server/tests/common/Cargo.toml
@@ -13,7 +13,7 @@ assert_cmd = { workspace = true }
base64 = { workspace = true }
chrono = { workspace = true }
codex-app-server-protocol = { workspace = true }
-codex-core = { workspace = true }
+codex-core = { workspace = true, features = ["test-support"] }
codex-protocol = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
diff --git a/codex-rs/core/src/error.rs b/codex-rs/core/src/error.rs
index c7e0c2bde2..e8fa91d26e 100644
--- a/codex-rs/core/src/error.rs
+++ b/codex-rs/core/src/error.rs
@@ -58,7 +58,6 @@ pub enum SandboxErr {
#[derive(Error, Debug)]
pub enum CodexErr {
- // todo(aibrahim): git rid of this error carrying the dangling artifacts
#[error("turn aborted. Something went wrong? Hit `/feedback` to report the issue.")]
TurnAborted,
diff --git a/codex-rs/core/src/openai_models/model_family.rs b/codex-rs/core/src/openai_models/model_family.rs
index 4e3375c580..e486c7d911 100644
--- a/codex-rs/core/src/openai_models/model_family.rs
+++ b/codex-rs/core/src/openai_models/model_family.rs
@@ -83,7 +83,7 @@ pub struct ModelFamily {
}
impl ModelFamily {
- pub fn with_config_overrides(mut self, config: &Config) -> Self {
+ pub(super) fn with_config_overrides(mut self, config: &Config) -> Self {
if let Some(supports_reasoning_summaries) = config.model_supports_reasoning_summaries {
self.supports_reasoning_summaries = supports_reasoning_summaries;
}
@@ -98,7 +98,7 @@ impl ModelFamily {
}
self
}
- pub fn with_remote_overrides(mut self, remote_models: Vec<ModelInfo>) -> Self {
+ pub(super) fn with_remote_overrides(mut self, remote_models: Vec<ModelInfo>) -> Self {
for model in remote_models {
if model.slug == self.slug {
self.apply_remote_overrides(model);
@@ -198,7 +198,7 @@ macro_rules! model_family {
/// Internal offline helper for `ModelsManager` that returns a `ModelFamily` for the given
/// model slug.
-pub(in crate::openai_models) fn find_family_for_model(slug: &str) -> ModelFamily {
+pub(super) fn find_family_for_model(slug: &str) -> ModelFamily {
if slug.starts_with("o3") {
model_family!(
slug, "o3",
diff --git a/codex-rs/core/src/openai_models/model_presets.rs b/codex-rs/core/src/openai_models/model_presets.rs
index cf635e8dac..d11e5af309 100644
--- a/codex-rs/core/src/openai_models/model_presets.rs
+++ b/codex-rs/core/src/openai_models/model_presets.rs
@@ -237,7 +237,7 @@ static PRESETS: Lazy<Vec<ModelPreset>> = Lazy::new(|| {
]
});
-pub(crate) fn builtin_model_presets(_auth_mode: Option<AuthMode>) -> Vec<ModelPreset> {
+pub(super) fn builtin_model_presets(_auth_mode: Option<AuthMode>) -> Vec<ModelPreset> {
PRESETS
.iter()
.filter(|preset| preset.show_in_picker)
@@ -245,7 +245,7 @@ pub(crate) fn builtin_model_presets(_auth_mode: Option<AuthMode>) -> Vec<ModelPr
.collect()
}
-// todo(aibrahim): remove this once we migrate tests
+#[cfg(any(test, feature = "test-support"))]
pub fn all_model_presets() -> &'static Vec<ModelPreset> {
&PRESETS
}