mirror of
https://github.com/openai/codex.git
synced 2026-10-31 19:28:49 +00:00
Reject sessions with unloadable required managed hooks (#38394)
## Why Hooks supplied as managed requirements must not be silently skipped when their handlers cannot be loaded. ## What changed - Fail session and app-server thread startup when an enabled managed requirement contains an invalid matcher, an empty command, or an unsupported handler type. - Keep load failures for ordinary managed configuration hooks as warnings, and do not enforce managed hook requirements while the hooks feature is disabled. ## Testing Added hook-engine, core session, and app-server coverage for valid and invalid managed hook requirements. GitOrigin-RevId: 91a23b0c1d85e143aba6aabe874c5274e52fc6b2
This commit is contained in:
@@ -1162,7 +1162,7 @@ impl Session {
|
||||
resolved_environments.single_local_environment(),
|
||||
)
|
||||
.await;
|
||||
let (hooks, async_hook_results) = Hooks::new(hooks_config, thread_id);
|
||||
let (hooks, async_hook_results) = Hooks::new(hooks_config, thread_id)?;
|
||||
for warning in hooks.startup_warnings() {
|
||||
post_session_configured_events.push(Event {
|
||||
id: INITIAL_SUBMIT_ID.to_owned(),
|
||||
|
||||
@@ -782,7 +782,8 @@ async fn preview_session_start_hooks(
|
||||
..HooksConfig::default()
|
||||
},
|
||||
thread_id,
|
||||
);
|
||||
)
|
||||
.expect("initialize hooks for session-start preview");
|
||||
|
||||
Ok(
|
||||
hooks.preview_session_start(&codex_hooks::SessionStartRequest {
|
||||
@@ -5840,7 +5841,8 @@ pub(crate) async fn make_session_and_context() -> (Session, TurnContext) {
|
||||
..HooksConfig::default()
|
||||
},
|
||||
thread_id,
|
||||
);
|
||||
)
|
||||
.expect("initialize test hooks");
|
||||
let services = SessionServices {
|
||||
mcp_runtime,
|
||||
mcp_handler_cache: Default::default(),
|
||||
@@ -8023,7 +8025,8 @@ where
|
||||
..HooksConfig::default()
|
||||
},
|
||||
thread_id,
|
||||
);
|
||||
)
|
||||
.expect("initialize test hooks");
|
||||
let services = SessionServices {
|
||||
mcp_runtime,
|
||||
mcp_handler_cache: Default::default(),
|
||||
|
||||
Reference in New Issue
Block a user