mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Retire the personality feature flag and document deprecated settings (#45809)
## What changed - Accept and ignore `features.personality` in user configuration, profiles, and managed requirements. - Remove feature gating from `personality = "none"`, which strips the literal `# Personality` section when preparing model catalog instructions. Preserve explicit base instructions and existing thread instructions. - Document deprecated personality fields in configuration, app-server schemas, and the Python SDK: `friendly` and `pragmatic` no longer select a style, and `supportsPersonality` is always `false`. ## Testing Add regression coverage for ignored legacy flag values and managed requirements, personality opt-out behavior with the flag absent or set to either value, role overrides, and preservation of explicit base instructions, including empty strings. GitOrigin-RevId: 4e12c66b42bfc59d6f151a5b3c28fadc6654ae99
This commit is contained in:
1 parent
4d2807023a
commit
883af106b9
54 files changed
+389
-264
No files matched your search
@@ -94,7 +94,6 @@ async fn apply_role_to_config_inner(
|
||||
&& let Some(
|
||||
feature @ (Feature::ShellTool
|
||||
| Feature::Apps
|
||||
| Feature::Personality
|
||||
| Feature::Plugins
|
||||
| Feature::MemoryTool
|
||||
| Feature::RequestPermissionsTool),
|
||||
@@ -222,10 +221,8 @@ mod role_overrides {
|
||||
{
|
||||
next_config.include_skill_instructions = false;
|
||||
}
|
||||
let strips_baked_personality = |config: &Config| {
|
||||
config.features.enabled(Feature::Personality)
|
||||
&& config.personality == Some(Personality::None)
|
||||
};
|
||||
let strips_baked_personality =
|
||||
|config: &Config| config.personality == Some(Personality::None);
|
||||
if strips_baked_personality(config) != strips_baked_personality(&next_config)
|
||||
&& matches!(
|
||||
config.base_instructions_provenance,
|
||||
|
||||
@@ -250,6 +250,22 @@ async fn apply_role_refreshes_model_instructions_only_when_personality_opt_out_c
|
||||
},
|
||||
false,
|
||||
),
|
||||
(
|
||||
"none",
|
||||
"[features]\npersonality = false",
|
||||
BaseInstructionsProvenance::Model {
|
||||
model: "parent-model".to_string(),
|
||||
},
|
||||
false,
|
||||
),
|
||||
(
|
||||
"friendly",
|
||||
"personality = \"none\"\n[features]\npersonality = false",
|
||||
BaseInstructionsProvenance::Model {
|
||||
model: "parent-model".to_string(),
|
||||
},
|
||||
true,
|
||||
),
|
||||
(
|
||||
"friendly",
|
||||
"personality = \"pragmatic\"",
|
||||
|
||||
@@ -11201,7 +11201,7 @@ async fn feature_requirements_normalize_effective_feature_values() -> std::io::R
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
r#"
|
||||
[features]
|
||||
personality = true
|
||||
view_image = true
|
||||
shell_tool = false
|
||||
use_xaa = true
|
||||
"#,
|
||||
@@ -11210,7 +11210,7 @@ use_xaa = true
|
||||
.build()
|
||||
.await?;
|
||||
|
||||
assert!(config.features.enabled(Feature::Personality));
|
||||
assert!(config.features.enabled(Feature::ViewImage));
|
||||
assert!(!config.features.enabled(Feature::ShellTool));
|
||||
assert!(
|
||||
!config
|
||||
@@ -11396,7 +11396,7 @@ async fn explicit_feature_config_is_normalized_by_requirements() -> std::io::Res
|
||||
codex_home.path().join(CONFIG_TOML_FILE),
|
||||
r#"
|
||||
[features]
|
||||
personality = false
|
||||
view_image = false
|
||||
shell_tool = true
|
||||
"#,
|
||||
)?;
|
||||
@@ -11408,7 +11408,7 @@ shell_tool = true
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
r#"
|
||||
[features]
|
||||
personality = true
|
||||
view_image = true
|
||||
shell_tool = false
|
||||
"#,
|
||||
),
|
||||
@@ -11416,7 +11416,7 @@ shell_tool = false
|
||||
.build()
|
||||
.await?;
|
||||
|
||||
assert!(config.features.enabled(Feature::Personality));
|
||||
assert!(config.features.enabled(Feature::ViewImage));
|
||||
assert!(!config.features.enabled(Feature::ShellTool));
|
||||
assert!(
|
||||
!config
|
||||
@@ -11430,6 +11430,55 @@ shell_tool = false
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn retired_personality_feature_requirements_do_not_reject_configured_values() -> std::io::Result<()>
|
||||
{
|
||||
for (configured, required) in [(true, false), (false, true)] {
|
||||
let cfg: ConfigToml = toml::from_str(&format!(
|
||||
"[features]\npersonality = {configured}\nshell_tool = false\n"
|
||||
))
|
||||
.expect("valid config");
|
||||
let requirement = Sourced::new(
|
||||
FeatureRequirementsToml {
|
||||
entries: BTreeMap::from([
|
||||
("personality".to_string(), required),
|
||||
("shell_tool".to_string(), false),
|
||||
]),
|
||||
},
|
||||
RequirementSource::EnterpriseManaged {
|
||||
id: "enterprise-id".to_string(),
|
||||
name: "enterprise".to_string(),
|
||||
},
|
||||
);
|
||||
validate_feature_requirements_for_config_toml(&cfg, Some(&requirement))?;
|
||||
|
||||
let configured_features = Features::from_sources(
|
||||
FeatureConfigSource {
|
||||
features: cfg.features.as_ref(),
|
||||
..Default::default()
|
||||
},
|
||||
FeatureConfigSource::default(),
|
||||
FeatureOverrides::default(),
|
||||
);
|
||||
let mut warnings = Vec::new();
|
||||
let features = ManagedFeatures::from_configured_with_warnings(
|
||||
configured_features,
|
||||
Some(requirement),
|
||||
&mut warnings,
|
||||
)?;
|
||||
assert_eq!(
|
||||
(
|
||||
features.enabled(Feature::Personality),
|
||||
features.enabled(Feature::ShellTool),
|
||||
warnings,
|
||||
),
|
||||
(false, false, Vec::new()),
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn approvals_reviewer_defaults_to_manual_only_without_guardian_feature() -> std::io::Result<()>
|
||||
{
|
||||
@@ -12327,7 +12376,7 @@ async fn feature_requirements_normalize_runtime_feature_mutations() -> std::io::
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
r#"
|
||||
[features]
|
||||
personality = true
|
||||
view_image = true
|
||||
shell_tool = false
|
||||
"#,
|
||||
),
|
||||
@@ -12337,7 +12386,7 @@ shell_tool = false
|
||||
|
||||
let mut requested = config.features.get().clone();
|
||||
requested
|
||||
.disable(Feature::Personality)
|
||||
.disable(Feature::ViewImage)
|
||||
.enable(Feature::ShellTool);
|
||||
assert!(config.features.can_set(&requested).is_ok());
|
||||
config
|
||||
@@ -12345,7 +12394,7 @@ shell_tool = false
|
||||
.set(requested)
|
||||
.expect("managed feature mutations should normalize successfully");
|
||||
|
||||
assert!(config.features.enabled(Feature::Personality));
|
||||
assert!(config.features.enabled(Feature::ViewImage));
|
||||
assert!(!config.features.enabled(Feature::ShellTool));
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -218,6 +218,9 @@ fn parse_feature_requirements(
|
||||
) -> BTreeMap<Feature, bool> {
|
||||
let mut pinned_features = BTreeMap::new();
|
||||
for (key, enabled) in feature_requirements.entries {
|
||||
if key == Feature::Personality.key() {
|
||||
continue;
|
||||
}
|
||||
if key == "auto_review" {
|
||||
pinned_features.insert(Feature::GuardianApproval, enabled);
|
||||
continue;
|
||||
|
||||
@@ -640,7 +640,7 @@ pub struct Config {
|
||||
/// Info needed to make an API request to the model.
|
||||
pub model_provider: ModelProviderInfo,
|
||||
|
||||
/// Optionally specify the personality of the model
|
||||
/// Deprecated: `friendly` and `pragmatic` no longer select a style.
|
||||
pub personality: Option<Personality>,
|
||||
|
||||
/// Effective permission configuration for shell tool execution.
|
||||
@@ -1622,7 +1622,6 @@ impl Config {
|
||||
Some(BaseInstructionsProvenance::Model { .. })
|
||||
)
|
||||
}),
|
||||
personality_enabled: self.features.enabled(Feature::Personality),
|
||||
personality: self.personality,
|
||||
model_catalog: self.model_catalog.clone(),
|
||||
}
|
||||
@@ -2575,6 +2574,7 @@ pub struct ConfigOverrides {
|
||||
pub default_zsh_path: Option<AbsolutePathBuf>,
|
||||
pub base_instructions: Option<String>,
|
||||
pub developer_instructions: Option<String>,
|
||||
/// Deprecated: `friendly` and `pragmatic` no longer select a style.
|
||||
pub personality: Option<Personality>,
|
||||
pub compact_prompt: Option<String>,
|
||||
pub show_raw_agent_reasoning: Option<bool>,
|
||||
|
||||
@@ -374,7 +374,6 @@ impl Session {
|
||||
&constraints,
|
||||
self.services.models_manager.as_ref(),
|
||||
&overrides,
|
||||
self.features.enabled(Feature::Personality),
|
||||
self.features.enabled(Feature::FastMode),
|
||||
)
|
||||
.await
|
||||
|
||||
@@ -513,10 +513,9 @@ async fn submitted_sparse_updates_preserve_captured_steps_and_ordering() {
|
||||
let model_manager_config = {
|
||||
let state = session.state.lock().await;
|
||||
let configuration = &state.session_configuration;
|
||||
configuration.model_info_overrides.models_manager_config(
|
||||
configuration.step_settings.personality,
|
||||
session.features.enabled(Feature::Personality),
|
||||
)
|
||||
configuration
|
||||
.model_info_overrides
|
||||
.models_manager_config(configuration.step_settings.personality)
|
||||
};
|
||||
let expected_destination = with_config_overrides(expected_destination, &model_manager_config);
|
||||
let desired = desired_step_settings(&session).await;
|
||||
|
||||
@@ -129,7 +129,6 @@ impl ResolvedStepSettings {
|
||||
constraints: &StepSettingsConstraints<'_>,
|
||||
models_manager: &dyn ModelsManager,
|
||||
overrides: &ModelInfoOverrides,
|
||||
personality_enabled: bool,
|
||||
fast_mode_enabled: bool,
|
||||
) -> ConstraintResult<Self> {
|
||||
let selected = self.selected.apply(update, constraints)?;
|
||||
@@ -139,11 +138,7 @@ impl ResolvedStepSettings {
|
||||
{
|
||||
Arc::clone(&self.model_info)
|
||||
} else {
|
||||
Arc::new(
|
||||
selected
|
||||
.resolve_model_info(models_manager, overrides, personality_enabled)
|
||||
.await,
|
||||
)
|
||||
Arc::new(selected.resolve_model_info(models_manager, overrides).await)
|
||||
};
|
||||
let mut next = Self::new(Arc::new(selected), model_info, fast_mode_enabled);
|
||||
next.mcp_approvals_reviewer_override = update
|
||||
@@ -206,7 +201,6 @@ impl ModelInfoOverrides {
|
||||
pub(crate) fn models_manager_config(
|
||||
&self,
|
||||
personality: Option<Personality>,
|
||||
personality_enabled: bool,
|
||||
) -> ModelsManagerConfig {
|
||||
ModelsManagerConfig {
|
||||
model_context_window: self.context_window,
|
||||
@@ -214,7 +208,6 @@ impl ModelInfoOverrides {
|
||||
tool_output_token_limit: self.tool_output_token_limit,
|
||||
base_instructions: self.base_instructions.clone(),
|
||||
personality,
|
||||
personality_enabled,
|
||||
// The models manager already owns its catalog.
|
||||
model_catalog: None,
|
||||
}
|
||||
@@ -254,9 +247,8 @@ impl StepSettings {
|
||||
&self,
|
||||
models_manager: &dyn ModelsManager,
|
||||
overrides: &ModelInfoOverrides,
|
||||
personality_enabled: bool,
|
||||
) -> ModelInfo {
|
||||
let config = overrides.models_manager_config(self.personality, personality_enabled);
|
||||
let config = overrides.models_manager_config(self.personality);
|
||||
models_manager
|
||||
.get_model_info(self.collaboration_mode.model(), &config)
|
||||
.await
|
||||
|
||||
@@ -451,28 +451,14 @@ async fn model_resolution_preserves_startup_overrides_and_instruction_provenance
|
||||
// Capture the same filtered explicit overrides that session startup owns.
|
||||
let overrides = ModelInfoOverrides::from(config.to_models_manager_config());
|
||||
|
||||
for (personality, personality_enabled, catalog_instructions) in [
|
||||
for (personality, catalog_instructions) in [
|
||||
(
|
||||
Personality::Friendly,
|
||||
true,
|
||||
"Catalog B.\n# Personality\nfixed\n# Rules\nKeep the rules.",
|
||||
),
|
||||
(
|
||||
Personality::None,
|
||||
true,
|
||||
"Catalog B.\n# Rules\nKeep the rules.",
|
||||
),
|
||||
(
|
||||
Personality::Friendly,
|
||||
false,
|
||||
"Catalog B.\n# Personality\nfixed\n# Rules\nKeep the rules.",
|
||||
),
|
||||
(Personality::None, "Catalog B.\n# Rules\nKeep the rules."),
|
||||
] {
|
||||
config.personality = Some(personality);
|
||||
config
|
||||
.features
|
||||
.set_enabled(Feature::Personality, personality_enabled)
|
||||
.expect("test config should allow personality changes");
|
||||
let mut settings = configured_settings();
|
||||
settings.collaboration_mode = settings.collaboration_mode.with_updates(
|
||||
Some("model-b".to_string()),
|
||||
@@ -485,11 +471,7 @@ async fn model_resolution_preserves_startup_overrides_and_instruction_provenance
|
||||
.get_model_info("model-b", &config.to_models_manager_config())
|
||||
.await;
|
||||
let resolved = settings
|
||||
.resolve_model_info(
|
||||
&models_manager,
|
||||
&overrides,
|
||||
config.features.enabled(Feature::Personality),
|
||||
)
|
||||
.resolve_model_info(&models_manager, &overrides)
|
||||
.await;
|
||||
assert_eq!(resolved, legacy);
|
||||
assert_eq!(
|
||||
|
||||
@@ -1018,7 +1018,6 @@ impl Session {
|
||||
.resolve_model_info(
|
||||
self.services.models_manager.as_ref(),
|
||||
&session_configuration.model_info_overrides,
|
||||
self.features.enabled(Feature::Personality),
|
||||
)
|
||||
.await;
|
||||
let multi_agent_version = match multi_agent_runtime {
|
||||
|
||||
Reference in new issue
Block a user