mirror of
https://github.com/openai/codex.git
synced 2026-05-24 13:04:29 +00:00
## Why `--profile-v2 <name>` gives launchers and runtime entry points a named profile config without making each profile duplicate the base user config. The base `$CODEX_HOME/config.toml` still loads first, then `$CODEX_HOME/<name>.config.toml` layers above it and becomes the active writable user config for that session. That keeps shared defaults, plugin/MCP setup, and managed/user constraints in one place while letting a named profile override only the pieces that need to differ. ## What Changed - Added the shared `--profile-v2 <name>` runtime option with validated plain names, now represented by `ProfileV2Name`. - Extended config layer state so the base user config and selected profile config are both `User` layers; APIs expose the active user layer and merged effective user config. - Threaded profile selection through runtime entry points: `codex`, `codex exec`, `codex review`, `codex resume`, `codex fork`, and `codex debug prompt-input`. - Made user-facing config writes go to the selected profile file when active, including TUI/settings persistence, app-server config writes, and MCP/app tool approval persistence. - Made plugin, marketplace, MCP, hooks, and config reload paths read from the merged user config so base and profile layers both participate. - Updated app-server config layer schemas to mark profile-backed user layers. ## Limits `--profile-v2` is still rejected for config-management subcommands such as feature, MCP, and marketplace edits. Those paths remain tied to the base `config.toml` until they have explicit profile-selection semantics. Some adjacent background writes may still update base or global state rather than the selected profile: - marketplace auto-upgrade metadata - automatic MCP dependency installs from skills - remote plugin sync or uninstall config edits - personality migration marker/default writes ## Verification Added targeted coverage for profile name validation, layer ordering/merging, selected-profile writes, app-server config writes, session hot reload, plugin config merging, hooks/config fixture updates, and MCP/app approval persistence. --------- Co-authored-by: Codex <noreply@openai.com>
136 lines
5.4 KiB
Rust
136 lines
5.4 KiB
Rust
mod cloud_requirements;
|
|
mod config_requirements;
|
|
pub mod config_toml;
|
|
mod constraint;
|
|
mod diagnostics;
|
|
mod fingerprint;
|
|
mod hook_config;
|
|
mod host_name;
|
|
mod key_aliases;
|
|
pub mod loader;
|
|
mod marketplace_edit;
|
|
mod mcp_edit;
|
|
mod mcp_types;
|
|
mod merge;
|
|
mod overrides;
|
|
pub mod permissions_toml;
|
|
mod plugin_edit;
|
|
pub mod profile_toml;
|
|
mod project_root_markers;
|
|
mod requirements_exec_policy;
|
|
pub mod schema;
|
|
mod skills_config;
|
|
mod state;
|
|
mod strict_config;
|
|
mod thread_config;
|
|
mod tui_keymap;
|
|
pub mod types;
|
|
|
|
pub const CONFIG_TOML_FILE: &str = "config.toml";
|
|
|
|
pub use cloud_requirements::CloudRequirementsLoadError;
|
|
pub use cloud_requirements::CloudRequirementsLoadErrorCode;
|
|
pub use cloud_requirements::CloudRequirementsLoader;
|
|
pub use codex_app_server_protocol::ConfigLayerSource;
|
|
pub use codex_protocol::config_types::ProfileV2Name;
|
|
pub use codex_protocol::config_types::ProfileV2NameParseError;
|
|
pub use codex_utils_absolute_path::AbsolutePathBuf;
|
|
pub use config_requirements::AppRequirementToml;
|
|
pub use config_requirements::AppToolRequirementToml;
|
|
pub use config_requirements::AppToolsRequirementsToml;
|
|
pub use config_requirements::AppsRequirementsToml;
|
|
pub use config_requirements::ConfigRequirements;
|
|
pub use config_requirements::ConfigRequirementsToml;
|
|
pub use config_requirements::ConfigRequirementsWithSources;
|
|
pub use config_requirements::ConstrainedWithSource;
|
|
pub use config_requirements::FeatureRequirementsToml;
|
|
pub use config_requirements::FilesystemConstraints;
|
|
pub use config_requirements::FilesystemDenyReadPattern;
|
|
pub use config_requirements::McpServerIdentity;
|
|
pub use config_requirements::McpServerRequirement;
|
|
pub use config_requirements::NetworkConstraints;
|
|
pub use config_requirements::NetworkDomainPermissionToml;
|
|
pub use config_requirements::NetworkDomainPermissionsToml;
|
|
pub use config_requirements::NetworkRequirementsToml;
|
|
pub use config_requirements::NetworkUnixSocketPermissionToml;
|
|
pub use config_requirements::NetworkUnixSocketPermissionsToml;
|
|
pub use config_requirements::PluginRequirementsToml;
|
|
pub use config_requirements::RemoteSandboxConfigToml;
|
|
pub use config_requirements::RequirementSource;
|
|
pub use config_requirements::ResidencyRequirement;
|
|
pub use config_requirements::SandboxModeRequirement;
|
|
pub use config_requirements::Sourced;
|
|
pub use config_requirements::WebSearchModeRequirement;
|
|
pub use config_requirements::sandbox_mode_requirement_for_permission_profile;
|
|
pub use constraint::Constrained;
|
|
pub use constraint::ConstraintError;
|
|
pub use constraint::ConstraintResult;
|
|
pub use diagnostics::ConfigError;
|
|
pub use diagnostics::ConfigLoadError;
|
|
pub use diagnostics::TextPosition;
|
|
pub use diagnostics::TextRange;
|
|
pub use diagnostics::config_error_from_toml;
|
|
pub use diagnostics::config_error_from_typed_toml;
|
|
pub use diagnostics::first_layer_config_error;
|
|
pub use diagnostics::first_layer_config_error_from_entries;
|
|
pub use diagnostics::format_config_error;
|
|
pub use diagnostics::format_config_error_with_source;
|
|
pub use diagnostics::io_error_from_config_error;
|
|
pub use fingerprint::version_for_toml;
|
|
pub use hook_config::HookEventsToml;
|
|
pub use hook_config::HookHandlerConfig;
|
|
pub use hook_config::HookStateToml;
|
|
pub use hook_config::HooksFile;
|
|
pub use hook_config::HooksToml;
|
|
pub use hook_config::ManagedHooksRequirementsToml;
|
|
pub use hook_config::MatcherGroup;
|
|
pub use host_name::host_name;
|
|
pub use marketplace_edit::MarketplaceConfigUpdate;
|
|
pub use marketplace_edit::RemoveMarketplaceConfigOutcome;
|
|
pub use marketplace_edit::record_user_marketplace;
|
|
pub use marketplace_edit::remove_user_marketplace;
|
|
pub use marketplace_edit::remove_user_marketplace_config;
|
|
pub use mcp_edit::ConfigEditsBuilder;
|
|
pub use mcp_edit::load_global_mcp_servers;
|
|
pub use mcp_types::AppToolApproval;
|
|
pub use mcp_types::McpServerConfig;
|
|
pub use mcp_types::McpServerDisabledReason;
|
|
pub use mcp_types::McpServerEnvVar;
|
|
pub use mcp_types::McpServerToolConfig;
|
|
pub use mcp_types::McpServerTransportConfig;
|
|
pub use mcp_types::RawMcpServerConfig;
|
|
pub use merge::merge_toml_values;
|
|
pub use overrides::build_cli_overrides_layer;
|
|
pub use plugin_edit::PluginConfigEdit;
|
|
pub use plugin_edit::apply_user_plugin_config_edits;
|
|
pub use plugin_edit::clear_user_plugin;
|
|
pub use plugin_edit::set_user_plugin_enabled;
|
|
pub use project_root_markers::default_project_root_markers;
|
|
pub use project_root_markers::project_root_markers_from_config;
|
|
pub use requirements_exec_policy::RequirementsExecPolicy;
|
|
pub use requirements_exec_policy::RequirementsExecPolicyDecisionToml;
|
|
pub use requirements_exec_policy::RequirementsExecPolicyParseError;
|
|
pub use requirements_exec_policy::RequirementsExecPolicyPatternTokenToml;
|
|
pub use requirements_exec_policy::RequirementsExecPolicyPrefixRuleToml;
|
|
pub use requirements_exec_policy::RequirementsExecPolicyToml;
|
|
pub use skills_config::BundledSkillsConfig;
|
|
pub use skills_config::SkillConfig;
|
|
pub use skills_config::SkillsConfig;
|
|
pub use state::ConfigLayerEntry;
|
|
pub use state::ConfigLayerStack;
|
|
pub use state::ConfigLayerStackOrdering;
|
|
pub use state::ConfigLoadOptions;
|
|
pub use state::LoaderOverrides;
|
|
pub use strict_config::config_error_from_ignored_toml_fields;
|
|
pub use thread_config::NoopThreadConfigLoader;
|
|
pub use thread_config::RemoteThreadConfigLoader;
|
|
pub use thread_config::SessionThreadConfig;
|
|
pub use thread_config::StaticThreadConfigLoader;
|
|
pub use thread_config::ThreadConfigContext;
|
|
pub use thread_config::ThreadConfigLoadError;
|
|
pub use thread_config::ThreadConfigLoadErrorCode;
|
|
pub use thread_config::ThreadConfigLoader;
|
|
pub use thread_config::ThreadConfigSource;
|
|
pub use thread_config::UserThreadConfig;
|
|
pub use toml::Value as TomlValue;
|