diff options
Diffstat (limited to 'src/integration')
| -rw-r--r-- | src/integration/assets/codex/herdr-agent-state.ps1 | 4 | ||||
| -rw-r--r-- | src/integration/assets/codex/herdr-agent-state.sh | 8 | ||||
| -rw-r--r-- | src/integration/mod.rs | 2 | ||||
| -rw-r--r-- | src/integration/tests.rs | 3 |
4 files changed, 13 insertions, 4 deletions
diff --git a/src/integration/assets/codex/herdr-agent-state.ps1 b/src/integration/assets/codex/herdr-agent-state.ps1 index d837b78a..b578e7b9 100644 --- a/src/integration/assets/codex/herdr-agent-state.ps1 +++ b/src/integration/assets/codex/herdr-agent-state.ps1 @@ -2,7 +2,7 @@ # managed by herdr; reinstalling or updating the integration overwrites this file. # add custom hooks beside this file instead of editing it. # HERDR_INTEGRATION_ID=codex -# HERDR_INTEGRATION_VERSION=6 +# HERDR_INTEGRATION_VERSION=7 param([string]$Action = "") @@ -21,6 +21,8 @@ if ($payload.hook_event_name -and $payload.hook_event_name -ne "SessionStart") { $sessionId = $payload.session_id if ([string]::IsNullOrWhiteSpace($sessionId)) { exit 0 } +if ([string]::IsNullOrWhiteSpace($payload.transcript_path)) { exit 0 } +if (-not [string]::IsNullOrWhiteSpace($env:CODEX_THREAD_ID) -and $env:CODEX_THREAD_ID -ne $sessionId) { exit 0 } $seq = [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds() try { diff --git a/src/integration/assets/codex/herdr-agent-state.sh b/src/integration/assets/codex/herdr-agent-state.sh index b3b08a78..687a8181 100644 --- a/src/integration/assets/codex/herdr-agent-state.sh +++ b/src/integration/assets/codex/herdr-agent-state.sh @@ -3,7 +3,7 @@ # managed by herdr; reinstalling or updating the integration overwrites this file. # add custom hooks beside this file instead of editing it. # HERDR_INTEGRATION_ID=codex -# HERDR_INTEGRATION_VERSION=6 +# HERDR_INTEGRATION_VERSION=7 set -eu @@ -56,6 +56,12 @@ request_id = f"{source}:{int(time.time() * 1000)}:{random.randrange(1_000_000):0 report_seq = time.time_ns() session_id = hook_input.get("session_id") agent_session_id = session_id if isinstance(session_id, str) and session_id else None +transcript_path = hook_input.get("transcript_path") +if not isinstance(transcript_path, str) or not transcript_path.strip(): + raise SystemExit(0) +inherited_session_id = os.environ.get("CODEX_THREAD_ID") +if inherited_session_id and inherited_session_id != agent_session_id: + raise SystemExit(0) session_start_source = hook_input.get("source") if hook_event_name == "SessionStart" else None if not isinstance(session_start_source, str) or not session_start_source: session_start_source = None diff --git a/src/integration/mod.rs b/src/integration/mod.rs index 40189c64..77d8ddda 100644 --- a/src/integration/mod.rs +++ b/src/integration/mod.rs @@ -47,7 +47,7 @@ const CODEX_HOOK_ASSET: &str = if cfg!(windows) { } else { include_str!("assets/codex/herdr-agent-state.sh") }; -const CODEX_INTEGRATION_VERSION: u32 = 6; +const CODEX_INTEGRATION_VERSION: u32 = 7; const KIMI_HOOK_INSTALL_NAME: &str = if cfg!(windows) { "herdr-agent-state.ps1" } else { diff --git a/src/integration/tests.rs b/src/integration/tests.rs index 6e3c756c..ff616264 100644 --- a/src/integration/tests.rs +++ b/src/integration/tests.rs @@ -1238,7 +1238,7 @@ fn codex_v2_integration_status_is_outdated() { assert_eq!(codex.path, hook_path); assert_eq!(codex.installed_version, Some(2)); - assert_eq!(codex.expected_version, 6); + assert_eq!(codex.expected_version, 7); assert_eq!(codex.state, IntegrationStatusKind::Outdated); std::env::remove_var("HOME"); @@ -2709,6 +2709,7 @@ fn bundled_integration_assets_report_session_refs() { CODEX_HOOK_ASSET.contains("session_start_source") || CODEX_HOOK_ASSET.contains("--session-start-source") ); + assert!(CODEX_HOOK_ASSET.contains("CODEX_THREAD_ID")); assert!( CODEX_HOOK_ASSET.contains("pane.report_agent_session") || CODEX_HOOK_ASSET.contains("report-agent-session") |
