mirror of
https://github.com/openai/codex.git
synced 2026-09-14 11:57:03 +00:00
## Why Configured Git marketplaces may be defined outside the user config, but those definitions could not download or update their snapshots. ## What changed - Select marketplace source, ref, and sparse-path settings from the effective merged configuration for startup synchronization and explicit upgrades. - Preserve the initiating operation's configuration loader and overrides when reloading before activation. - Roll back activation if the marketplace definition changed or configuration can no longer be loaded, without copying settings into the user config. ## Testing - Cover system-defined marketplaces, CLI overrides, startup fallback after invalid user configuration, and rollback after configuration changes. GitOrigin-RevId: 53d1eecf68a91ce2aa8430e5749d78697bfcd821
28 lines
964 B
Rust
28 lines
964 B
Rust
//! Adapts existing config loaders for blocking plugin-upgrade workers.
|
|
//! Reloads must use the same normal or fallback entry point as the initial load.
|
|
|
|
use crate::config_manager::ConfigManager;
|
|
use codex_core_plugins::ConfigLayerReload;
|
|
use codex_utils_absolute_path::AbsolutePathBuf;
|
|
use std::sync::Arc;
|
|
|
|
/// The config-loading path used to select marketplaces for startup tasks.
|
|
pub(crate) enum PluginStartupConfig {
|
|
Current,
|
|
Defaults,
|
|
}
|
|
|
|
pub(crate) fn for_cwd(manager: ConfigManager, cwd: AbsolutePathBuf) -> ConfigLayerReload {
|
|
let runtime = tokio::runtime::Handle::current();
|
|
Arc::new(move || runtime.block_on(manager.load_config_layers_for_cwd(cwd.clone())))
|
|
}
|
|
|
|
pub(crate) fn defaults(manager: ConfigManager) -> ConfigLayerReload {
|
|
let runtime = tokio::runtime::Handle::current();
|
|
Arc::new(move || {
|
|
runtime
|
|
.block_on(manager.load_default_config())
|
|
.map(|config| config.config_layer_stack)
|
|
})
|
|
}
|