[codex] Remove legacy after tool use hooks (#21805)

## Why

The legacy `AfterToolUse` hook path was still wired through core tool
dispatch even though the hooks registry never populated any handlers for
it. The supported hook surface is `PostToolUse`, so the old
infrastructure was dead code on the hot path.

## What changed

- Removed the legacy `AfterToolUse` dispatch from `codex-core` tool
execution.
- Removed the unused legacy hook payload types and exports from
`codex-hooks`.
- Simplified legacy notify handling now that `HookEvent` only carries
`AfterAgent`.

## Validation

- `cargo test -p codex-hooks`
- `cargo test -p codex-core registry`
This commit is contained in:
pakrym-oai authored and GitHub committed 2026-05-08 13:20:05 -07:00
1 parent e783341b70
commit 46e2250bcf
5 files changed
+3 -312

No files matched your search

-3
View File
@@ -46,7 +46,6 @@ pub struct HookListOutcome {
#[derive(Clone)]
pub struct Hooks {
after_agent: Vec<Hook>,
after_tool_use: Vec<Hook>,
engine: ClaudeHooksEngine,
}
@@ -76,7 +75,6 @@ impl Hooks {
);
Self {
after_agent,
after_tool_use: Vec::new(),
engine,
}
}
@@ -88,7 +86,6 @@ impl Hooks {
fn hooks_for_event(&self, hook_event: &HookEvent) -> &[Hook] {
match hook_event {
HookEvent::AfterAgent { .. } => &self.after_agent,
HookEvent::AfterToolUse { .. } => &self.after_tool_use,
}
}