| 310 | |
| 311 | impl Hooks { |
| 312 | fn should_handoff_codex_lifecycle(&self) -> bool { |
| 313 | // Codex clamps SessionEnd hooks to three seconds. Hand terminal |
| 314 | // lifecycle work to a child so recording/attestation/view restoration |
| 315 | // can finish after the hook process returns. `--json` must remain |
| 316 | // in-process because handoff deliberately drops stdout. |
| 317 | !self.foreground |
| 318 | && !self.json |
| 319 | && self.agent_name == "codex" |
| 320 | && matches!(self.verb.as_str(), "stop" | "session-end") |
| 321 | } |
| 322 | |
| 323 | fn handoff_codex_lifecycle(&self, input: &[u8]) -> CliResult<()> { |
| 324 | let exe = std::env::current_exe().map_err(|e| { |