Codex `SessionStart` hook handler.
()
| 44 | |
| 45 | /// Codex `SessionStart` hook handler. |
| 46 | pub async fn hook_codex_session_start() -> i32 { |
| 47 | let event = read_hook_event!(); |
| 48 | let root = codex_project_root_from_event(&event); |
| 49 | record_hook_invoked(root.as_deref(), HintAgent::Codex, "SessionStart", &event); |
| 50 | let (mut context, _) = codex_session_context_for_event(&event).await; |
| 51 | if let Some(root) = root.as_deref() { |
| 52 | let session_id = serde_json::from_str::<Value>(&event) |
| 53 | .ok() |
| 54 | .as_ref() |
| 55 | .and_then(event_session_id); |
| 56 | if let Some(digest) = |
| 57 | memory_inject::session_memory_digest(root, session_id.as_deref()).await |
| 58 | { |
| 59 | append_context_block(&mut context, &digest); |
| 60 | } |
| 61 | } |
| 62 | if session_start_from_compaction(&event) { |
| 63 | append_context_recovery_hint(&mut context); |
| 64 | } |
| 65 | println!( |
| 66 | "{}", |
| 67 | codex_additional_context_json("SessionStart", &context) |
| 68 | ); |
| 69 | 0 |
| 70 | } |
| 71 | |
| 72 | /// Codex `UserPromptSubmit` hook handler. |
| 73 | /// |
no test coverage detected