feat(app-server) Expose personality (#9674)

### Motivation
Exposes a per-thread / per-turn `personality` override in the v2
app-server API so clients can influence model communication style at
thread/turn start. Ensures the override is passed into the session
configuration resolution so it becomes effective for subsequent turns
and headless runners.

### Testing
- [x] Add an integration-style test
`turn_start_accepts_personality_override_v2` in
`codex-rs/app-server/tests/suite/v2/turn_start.rs` that verifies a
`/personality` override results in a developer update message containing
`<personality_spec>` in the outbound model request.

------
[Codex
Task](https://chatgpt.com/codex/tasks/task_i_6971d646b1c08322a689a54d2649f3fe)
This commit is contained in:
Dylan Hurd
2026-01-22 18:00:20 -08:00
committed by GitHub
parent a2c829a808
commit 2b1ee24e11
7 changed files with 296 additions and 26 deletions

View File

@@ -169,6 +169,7 @@ use codex_login::ShutdownHandle;
use codex_login::run_login_server;
use codex_protocol::ThreadId;
use codex_protocol::config_types::ForcedLoginMethod;
use codex_protocol::config_types::Personality;
use codex_protocol::items::TurnItem;
use codex_protocol::models::ResponseItem;
use codex_protocol::protocol::GitInfo as CoreGitInfo;
@@ -1405,6 +1406,7 @@ impl CodexMessageProcessor {
params.sandbox,
params.base_instructions,
params.developer_instructions,
params.personality,
);
let config =
@@ -1518,6 +1520,7 @@ impl CodexMessageProcessor {
sandbox: Option<SandboxMode>,
base_instructions: Option<String>,
developer_instructions: Option<String>,
personality: Option<Personality>,
) -> ConfigOverrides {
ConfigOverrides {
model,
@@ -1529,6 +1532,7 @@ impl CodexMessageProcessor {
codex_linux_sandbox_exe: self.codex_linux_sandbox_exe.clone(),
base_instructions,
developer_instructions,
model_personality: personality,
..Default::default()
}
}
@@ -1836,6 +1840,7 @@ impl CodexMessageProcessor {
config: request_overrides,
base_instructions,
developer_instructions,
personality,
} = params;
let thread_history = if let Some(history) = history {
@@ -1921,6 +1926,7 @@ impl CodexMessageProcessor {
sandbox,
base_instructions,
developer_instructions,
personality,
);
// Derive a Config using the same logic as new conversation, honoring overrides if provided.
@@ -2105,6 +2111,7 @@ impl CodexMessageProcessor {
sandbox,
base_instructions,
developer_instructions,
None,
);
// Derive a Config using the same logic as new conversation, honoring overrides if provided.
let config = match derive_config_for_cwd(
@@ -3615,7 +3622,8 @@ impl CodexMessageProcessor {
|| params.model.is_some()
|| params.effort.is_some()
|| params.summary.is_some()
|| params.collaboration_mode.is_some();
|| params.collaboration_mode.is_some()
|| params.personality.is_some();
// If any overrides are provided, update the session turn context first.
if has_any_overrides {
@@ -3628,7 +3636,7 @@ impl CodexMessageProcessor {
effort: params.effort.map(Some),
summary: params.summary,
collaboration_mode: params.collaboration_mode,
personality: None,
personality: params.personality,
})
.await;
}