feat(personality) introduce model_personality config (#9459)

## Summary
Introduces the concept of a config model_personality. I would consider
this an MVP for testing out the feature. There are a number of
follow-ups to this PR:

- More sophisticated templating with validation
- In-product experience to manage this

## Testing
- [x] Testing locally
This commit is contained in:
Dylan Hurd
2026-01-20 11:06:14 -08:00
committed by GitHub
parent 46a4a03083
commit 714151eb4e
12 changed files with 210 additions and 4 deletions

View File

@@ -0,0 +1,23 @@
use codex_core::config::types::Personality;
use codex_core::models_manager::manager::ModelsManager;
use core_test_support::load_default_config_for_test;
use pretty_assertions::assert_eq;
use tempfile::TempDir;
const BASE_INSTRUCTIONS_TEMPLATE: &str = include_str!(
"../../templates/model_instructions/gpt-5.2-codex_instructions_template.md"
);
const FRIENDLY_PERSONALITY: &str = include_str!("../../templates/personalities/friendly.md");
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn model_personality_updates_base_instructions() {
let codex_home = TempDir::new().expect("create temp dir");
let mut config = load_default_config_for_test(&codex_home).await;
config.model_personality = Some(Personality::Friendly);
let model_info = ModelsManager::construct_model_info_offline("gpt-5.2-codex", &config);
let expected =
BASE_INSTRUCTIONS_TEMPLATE.replace("{{ personality_message }}", FRIENDLY_PERSONALITY);
assert_eq!(model_info.base_instructions, expected);
}