fix(issues): pull hook exits on subagent input, delta stays with the head agent - #551
Merged
Merged
Conversation
… to the head agent PostToolUse fires inside subagents. When a subagent ran `gh issue view`, the hook force-pulled under the parent's session id, whispered the delta into the subagent's context, and deleted the previous snapshot. The head agent never saw the "opened" line (session 51270d38, 2026-09-19). The hook now reads agent_id from the hook input and exits before touching the store when it is set. The test drives issues-pull.sh with subagent and head inputs: the subagent run leaves snapshot.prev.json in place and the delta still whispers to the head; the head run gets the PostToolUse context.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gh issue viewran the issues hook under the parent's session id, whispered the delta into the subagent, and consumed the previous snapshot. The head agent never sawopened #532on 2026-09-19 (session 51270d38).issues-pull.shnow exits before touching the store when the hook input carriesagent_id. SessionStart and UserPromptSubmit do not fire in subagents, so the guard's live effect is the PostToolUsegh issue *lane.Test plan
tests/gh-tasks-test.shdrives the hook script with subagent and head inputs: 94 passed. Against the pre-fix hook the five new assertions fail./code-review mediumon the diff: no findings.ways lintandscripts/check-portability.shclean.Residual
A forced pull rotates the previous snapshot before the whisper reads it. A head agent's
gh issuecommand landing while an earlier pull's delta is unread loses that delta the same way. Filed separately.