Skip plugin hook loading when hooks are disabled (#39047)

## What changed

Gate plugin hook resolution in `hooks/list` on both the hooks and plugins
feature flags. When hooks are disabled, return the default empty plugin hook
outcome without loading plugin hook sources or warnings.

GitOrigin-RevId: 166070576effaba248b790c4f2a47e6e9a7b1112
This commit is contained in:
Charlie Marsh
2026-08-17 18:48:34 +00:00
committed by copyberry
parent ff770113ca
commit 0c901fd141

View File

@@ -608,7 +608,8 @@ impl CatalogRequestProcessor {
continue;
}
};
let plugin_hooks = if config.features.enabled(Feature::Plugins) {
let hooks_enabled = config.features.enabled(Feature::CodexHooks);
let plugin_hooks = if hooks_enabled && config.features.enabled(Feature::Plugins) {
let plugins_input = config.plugins_config_input();
let plugin_outcome = plugins_manager.plugins_for_config(&plugins_input).await;
codex_core_plugins::PluginHookLoadOutcome {
@@ -619,7 +620,7 @@ impl CatalogRequestProcessor {
codex_core_plugins::PluginHookLoadOutcome::default()
};
let hooks = codex_hooks::list_hooks(codex_hooks::HooksConfig {
feature_enabled: config.features.enabled(Feature::CodexHooks),
feature_enabled: hooks_enabled,
bypass_hook_trust: config.bypass_hook_trust,
config_layer_stack: Some(config.config_layer_stack),
plugin_hook_sources: plugin_hooks.hook_sources,