diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-08-28 18:03:07 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-28 18:03:07 +0300 |
| commit | c5051933f812a07e8014cd11dde2e2caac3af84c (patch) | |
| tree | d079d040ea59d98fdb0e5e8bc48be33eeda3b7b0 /tests | |
| parent | f457cff4f2648eee85d176f8a41861241d4e8428 (diff) | |
fix: ignore cursor events in claude hooks (#3342)
refs #2832
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/cli/hooks.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/cli/hooks.rs b/tests/cli/hooks.rs index 21e7036b..de2bb271 100644 --- a/tests/cli/hooks.rs +++ b/tests/cli/hooks.rs @@ -84,6 +84,7 @@ fn run_shell_hook_with_env( .env("HERDR_SOCKET_PATH", &socket_path) .env("HERDR_PANE_ID", "p_test") .env_remove("CODEX_THREAD_ID") + .env_remove("CURSOR_VERSION") .stdin(Stdio::piped()) .stdout(Stdio::piped()) .stderr(Stdio::piped()); @@ -151,6 +152,31 @@ fn claude_hook_reports_session_id_from_stdin() { } #[test] +fn claude_hook_ignores_cursor_compatibility_payloads() { + assert!(run_claude_hook( + "session", + r#"{"hook_event_name":"sessionStart","session_id":"cursor-session"}"#, + ) + .is_none()); + + assert!(run_claude_hook( + "session", + r#"{"hook_event_name":"SessionStart","session_id":"cursor-session","cursor_version":"2026.08.11-e8db854"}"#, + ) + .is_none()); + + for cursor_version in ["2026.08.11-e8db854", ""] { + assert!(run_shell_hook_with_env( + "src/integration/assets/claude/herdr-agent-state.sh", + &["session"], + r#"{"hook_event_name":"SessionStart","session_id":"cursor-session"}"#, + &[("CURSOR_VERSION", cursor_version)], + ) + .is_none()); + } +} + +#[test] fn codex_hook_reports_persisted_root_session_and_ignores_ephemeral_or_nested_sessions() { let request = run_codex_hook( "session", |
