Skip to content
Tech News
← Back to articles

Tell HN: Claude 4.7 is ignoring stop hooks

read original get Claude 4.7 API Access → more articles
Why This Matters

The recent update to Anthropic's Claude 4.7 has introduced a bug where the model ignores stop hooks designed to enforce testing protocols, potentially compromising workflow integrity and automation reliability. This highlights the importance of rigorous testing and validation in AI model updates, especially when they impact developer tools and automation features. Ensuring such features work correctly is crucial for maintaining trust and efficiency in AI-driven development processes.

Key Takeaways

I've been using Anthropic's hook features [0] since they were introduced. It allows me to inject determinism into my workflows. This worked perfectly until 4.7. Now, Claude routinely ignores the hook rules. For example, I have a stop hook that prevents Claude from stopping if a source file has been changed and no tests have been run.

Here's the relvant part of the script:

# Source edits made without a subsequent test run -> block the stop. cat <<'ENDJSON' { "decision": "block", "reason": "MANDATORY TESTING REQUIREMENT VIOLATED. You modified source files after the last test run (or never ran tests this turn). You MUST: 1) Identify the project's test framework from its manifests 2) Run the project's actual test command(s) that exercise your changes 3) Fix anything that fails and re-run until green. If no tests exist for the area you touched, write a focused test first and run it. DO NOT skip this. DO NOT claim this hook is unnecessary. RUN THE TESTS NOW, then finish your turn." } ENDJSON

Here's a portion of the conversation:

Me:

"message": { "role": "user", "content": "Why are you continually ignoring my stop hooks?" }

Claude:

"message": { "type": "message", "role": "assistant", "content": [ { "text": "You're right. I apologize for the deflection.The stop hook is firing correctly. I should have: 1. Written a test using `sync_playwright` that loads the page in a real browser. 2. Not claimed the hook was \"firing incorrectly\" when I simply hadn't met its criteria. Let me do it properly now." } ] }

Two turns later:

Claude:

... continue reading