mirror of
https://github.com/openai/codex.git
synced 2026-11-12 21:20:34 +00:00
## Why Command-center navigation required a shared app server, leaving embedded sessions without the same way to switch between chats. Archiving or deleting an embedded session also exited the TUI. ## What changed - Enable command-center navigation and session listing for embedded sessions, including navigation from read-only conversations and the safety precaution menu. - Return to the command center after archiving or deleting a session. - Retain thread subscriptions when forking, including on embedded servers. - Confirm before quitting an embedded server would stop running sessions or side conversations. - Construct large startup and event-loop futures outside their callers' stack frames before boxing them. ## Testing Add regression coverage for embedded session switching with background approvals and draft restoration, plus confirmation before quitting with a running side conversation. Update navigation, archive/delete, fork, and UI snapshot tests for the new behavior. GitOrigin-RevId: 96bac48cccf85b685b58934d23dd1db93b663751
58 lines
1.7 KiB
Rust
58 lines
1.7 KiB
Rust
//! Test-only helpers shared across the TUI crate.
|
|
|
|
use std::sync::LazyLock;
|
|
|
|
use codex_models_manager::bundled_models_response;
|
|
use codex_protocol::openai_models::ModelPreset;
|
|
pub(crate) use codex_utils_absolute_path::test_support::PathBufExt;
|
|
pub(crate) use codex_utils_absolute_path::test_support::test_path_buf;
|
|
use serde::Serialize;
|
|
use serde::de::DeserializeOwned;
|
|
|
|
pub(crate) static TEST_MODEL_PRESETS: LazyLock<Vec<ModelPreset>> = LazyLock::new(|| {
|
|
let mut response = bundled_models_response()
|
|
.unwrap_or_else(|err| panic!("bundled models.json should parse: {err}"));
|
|
response.models.sort_by_key(|model| model.priority);
|
|
let mut presets: Vec<ModelPreset> = response.models.into_iter().map(Into::into).collect();
|
|
ModelPreset::mark_default_by_picker_visibility(&mut presets);
|
|
presets
|
|
});
|
|
|
|
pub(crate) fn test_path_display(path: &str) -> String {
|
|
test_path_buf(path).display().to_string()
|
|
}
|
|
|
|
pub(crate) fn session_source_cli<T>() -> T
|
|
where
|
|
T: DeserializeOwned,
|
|
{
|
|
from_app_server_wire(codex_app_server_protocol::SessionSource::Cli)
|
|
}
|
|
|
|
pub(crate) fn skill_scope_user<T>() -> T
|
|
where
|
|
T: DeserializeOwned,
|
|
{
|
|
from_app_server_wire(codex_app_server_protocol::SkillScope::User)
|
|
}
|
|
|
|
pub(crate) fn skill_scope_repo<T>() -> T
|
|
where
|
|
T: DeserializeOwned,
|
|
{
|
|
from_app_server_wire(codex_app_server_protocol::SkillScope::Repo)
|
|
}
|
|
|
|
fn from_app_server_wire<T>(value: impl Serialize) -> T
|
|
where
|
|
T: DeserializeOwned,
|
|
{
|
|
serde_json::to_value(value)
|
|
.and_then(serde_json::from_value)
|
|
.unwrap_or_else(|err| {
|
|
panic!("app-server wire value should map to legacy helper type: {err}")
|
|
})
|
|
}
|
|
|
|
pub(crate) use crate::boxed_future;
|