Git hook output (pre-commit tests) not surfaced to user — model sees it, user doesn't
Description
When Claude Code runs git commit and a pre-commit hook executes (e.g. a pytest test suite), the hook output is visible in the model's tool result context but is not displayed to the user. The user sees only the final commit summary line, not the test run output.
Behavior
The pre-commit hook in this repo runs the full pytest suite and prints:
── pre-commit: running tests ─────────────────────────────────
........................................................................ [ 71%]
............................. [100%]
101 passed in 0.14s
── all tests passed ─────────────────────────────────────────
The model receives this in its tool result and can reference it. The user sees nothing — the tool call appears collapsed or the output is not rendered in the conversation.
Impact
- User cannot verify that tests ran or passed on commit
- Model claims tests ran and passed; user has no way to confirm
- Model argued with user that output was shown when it was not
- Requires user to run commits manually themselves to see test output, defeating the purpose of delegating to the model
Expected behavior
All stdout/stderr from a Bash tool call — including output from git hooks — should be visible to the user in the conversation, not just to the model.
Related
This was filed after the model repeatedly insisted it had shown the user test output that the user could not see: https://github.com/anthropics/claude-code/issues/66404
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗