Speed up TUI startup by reusing plugin discovery (#26469)

## Summary

TUI startup loads related plugin data from `hooks/list`, session MCP
initialization, and plugin skill warmup. These paths repeated filesystem
discovery and emitted the same plugin warnings, while `hooks/list` and
account/model bootstrap ran serially.

This change:

- Reuses one immutable plugin load outcome across startup consumers.
- Keys the cache only on plugin-relevant configuration.
- Single-flights concurrent plugin loads and prevents invalidated loads
from repopulating the cache.
- Runs hook discovery and account/model bootstrap concurrently.
- Preserves configuration-migration ordering, hook review behavior, and
accurate startup telemetry.

In 10 alternating release-build launches in the Ruff repository with the
existing `~/.codex` configuration, median time to the first editable
composer decreased from 833ms to 504ms. The branch was faster in 9 of 10
pairs, with a paired median improvement of 312ms.
This commit is contained in:
Charlie Marsh authored and GitHub committed 2026-06-05 15:32:43 -04:00
1 parent 345cf6e8d0
commit 055c7a7c53
9 files changed
+303 -37

No files matched your search

@@ -647,9 +647,11 @@ impl CatalogRequestProcessor {
config.features.enabled(Feature::Plugins) && workspace_codex_plugins_enabled;
let plugin_hooks = if plugins_enabled {
let plugins_input = config.plugins_config_input();
plugins_manager
.plugin_hooks_for_layer_stack(&config.config_layer_stack, &plugins_input)
.await
let plugin_outcome = plugins_manager.plugins_for_config(&plugins_input).await;
codex_core_plugins::PluginHookLoadOutcome {
hook_sources: plugin_outcome.effective_plugin_hook_sources(),
hook_load_warnings: plugin_outcome.effective_plugin_hook_warnings(),
}
} else {
codex_core_plugins::PluginHookLoadOutcome::default()
};