chore(hooks): re-sync vendored session hooks to attune-ai canonical#68
Merged
Conversation
Bring attune-author's vendored Claude Code session hooks up to current attune-ai canonical (closure grew 7 -> 8 files). The key change is the new _sdk_gate.py helper and its exit_if_sdk_subprocess() call at the top of each portable hook's __main__: an SDK-spawned `claude` subprocess is not an interactive session, and SessionStart hook stdout poisons the Agent SDK's stream-json channel (the failure that broke SDK workflows for subscription users). The hooks vendored at P2 (#59) predate this fix. - Re-vendor all 8 hooks byte-identical from attune-ai/plugin/hooks - Add _sdk_gate.py to the closure + Makefile HOOK_FILES + .canonical-sha256 - Neutralize SDK markers in the behavior-test harness so security_guard exercises its blocking path regardless of the runner's environment Refs specs/sibling-claude-hooks (canonical-drift re-sync follow-up). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Jun 17, 2026
Merged
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.
What
Re-sync attune-author's vendored Claude Code session hooks to current attune-ai canonical. The closure grows 7 → 8 files (adds
_sdk_gate.py).The hooks vendored at P2 (#59) predate the sdk-subprocess-isolation fix. Each portable hook now calls
_sdk_gate.exit_if_sdk_subprocess()first in__main__: an SDK-spawnedclaudesubprocess is not an interactive session, and SessionStart hook stdout poisons the Agent SDK's stream-json channel — the failure that broke every SDK workflow for subscription users. Without this, attune-author's hooks carry that bug.Changes
attune-ai/plugin/hooks/(verified 8/8)_sdk_gate.pyadded to the closure,MakefileHOOK_FILES, and.canonical-sha256(now 8 entries)ATTUNE_SDK_SUBPROCESS/CLAUDE_CODE_ENTRYPOINTsosecurity_guardexercises its blocking path regardless of the runner env (the hooks now self-gate on those markers)_sdk_gate.pyis stdlib-only (os,sys) — closure stays stdlib-only at the boundaryVerification
tests/test_claude_hooks_drift.py+tests/test_claude_hooks_behavior.py: 17 passedruff check .claude/hooks/ tests/: clean (no reformat → byte-identity preserved).gitattributesLF pin already covers.claude/hooks/*.py(no change needed)Context
Part of
specs/sibling-claude-hooks(attune umbrella workspace). This is a canonical-drift re-sync discovered while reconciling spec status: P0 (#500) and P2 (#59) are both merged but the spec still marked them pending. attune-rag (#151) carries the same drift and needs the same re-sync (separate follow-up). P3 (attune-help) / P4 (attune-gui) remain and should vendor this 8-file canonical.🤖 Generated with Claude Code