From 92a10fc044d42b216317696a4e8e6f70d7cc7a7d Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Sun, 21 Jun 2026 02:38:14 +0300 Subject: fix: protect root agent restore sessions refs #712 --- src/integration/assets/claude/herdr-agent-state.ps1 | 3 ++- src/integration/assets/claude/herdr-agent-state.sh | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/integration/assets/claude') diff --git a/src/integration/assets/claude/herdr-agent-state.ps1 b/src/integration/assets/claude/herdr-agent-state.ps1 index dc78efd2..dcc9d4df 100644 --- a/src/integration/assets/claude/herdr-agent-state.ps1 +++ b/src/integration/assets/claude/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=claude -# HERDR_INTEGRATION_VERSION=6 +# HERDR_INTEGRATION_VERSION=7 param([string]$Action = "") @@ -17,6 +17,7 @@ try { exit 0 } +if (-not [string]::IsNullOrWhiteSpace($payload.agent_id)) { exit 0 } if ($payload.hook_event_name -eq "SubagentStop") { exit 0 } $sessionId = $payload.session_id diff --git a/src/integration/assets/claude/herdr-agent-state.sh b/src/integration/assets/claude/herdr-agent-state.sh index ce072189..cb5e840d 100644 --- a/src/integration/assets/claude/herdr-agent-state.sh +++ b/src/integration/assets/claude/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=claude -# HERDR_INTEGRATION_VERSION=6 +# HERDR_INTEGRATION_VERSION=7 set -eu @@ -50,6 +50,8 @@ if hook_input_file: hook_event_name = str(hook_input.get("hook_event_name") or "") is_subagent = bool(hook_input.get("agent_id")) +if is_subagent: + raise SystemExit(0) if hook_event_name == "SubagentStop": # SubagentStop is a completion event. Older Herdr integrations mapped it # to durable working, but Claude recap/away-summary can emit it after the -- cgit v1.2.3