Repository navigation
Run the closeout fingerprint through sh - #788
Merged
Merged
Conversation
onechendong
requested review from
ColtenOuO,
alanhc and
jserv
as code owners
November 19, 2026 15:30
onechendong
force-pushed
the
fix-closeout-tree-fingerprint
branch
from
November 19, 2026 16:46
e6eddc8 to
6924bc4
Compare
ColtenOuO
reviewed
Nov 19, 2026
ColtenOuO
left a comment
Collaborator
There was a problem hiding this comment.
The description's Approach and Validation predate the scripts/test.sh change: neither says the gate now takes its start tree through sh, and tests/test_gate_receipt.py is a third suite the diff touches.
The closeout Stop hook executed scripts/tree-fingerprint.sh directly, which Windows cannot do: every stop raised WinError 193 instead of printing its reminder, although the hook promises to exit 0. A checkout without the executable bit fails the same way, and scripts/test.sh, which takes the fingerprint its receipts are matched against, ran it directly too, so such a checkout wrote no receipt to match. Both now run it through sh, as check-pr-text.py and commit-draft.py already run git-commit-msg.sh, and the tests run each script through its interpreter as well, so the suite passes in such a checkout too. With no sh on PATH the hook still raises, which its docstring now says. Change-Id: I102babc02bd18450a383fe21cb30c8d617913945
onechendong
force-pushed
the
fix-closeout-tree-fingerprint
branch
from
November 19, 2026 17:12
6924bc4 to
2653883
Compare
Contributor
Author
|
@ColtenOuO The description is updated: Approach names the |
jserv
approved these changes
Nov 19, 2026
Contributor
|
Thank @onechendong for contributing! |
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.
Problem and behavior
On Windows, the Claude Code Stop hook
scripts/agent-closeout-check.pyraised at the end of every turn instead of printing its once-per-tree reminder:tree()executedscripts/tree-fingerprint.shdirectly, which Windows cannot do, and a checkout without the executable bit fails the same way.scripts/test.shtook the fingerprint its receipts are matched against the same way, so such a checkout wrote no receipt for the hook to match, and two tests intests/test_agent_workflow_hooks.pyexecuted a script directly too. With this change the hook computes the fingerprint and prints its reminder, the gate writes a receipt it can match, and the suite passes in such a checkout. The hook runs only under Claude Code with a workingpython3, so it stayed silent whereverpython3resolves to the Microsoft Store stub.Approach
Every caller of
scripts/tree-fingerprint.shruns it throughsh, ascheck-pr-text.pyandcommit-draft.pyalready rungit-commit-msg.sh:tree()in the hook, thereceipt_tree=line wherescripts/test.shtakes the start tree, and the tests. The test that runs the hook as a process runs it throughsys.executable, as.claude/settings.jsonruns it throughpython3. With noshon PATH, as in a PowerShell session outside Git Bash,tree()still raisesFileNotFoundError; the module docstring now says so instead of promising an exit status of 0. Claude Code runs the hook under Git Bash, whereshis present, so this change leaves that case alone.Validation
python:3.12container (Linux 6.6, Python 3.12.16, git 2.47.3),test_the_closeout_check_runs_the_fingerprint_through_shandtest_the_start_tree_is_taken_without_the_executable_bitpass. Withshremoved fromtree(), the first fails withPermissionError: [Errno 13] Permission denied; with it removed from thereceipt_tree=line inscripts/test.sh, the second fails with'' != '8d3a0beb...'.scripts/tree-fingerprint.shandscripts/agent-closeout-check.py, the previous head failedtest_a_directory_that_is_not_a_work_tree_has_no_fingerprintandtest_stop_hook_never_blocks_and_ignores_a_reentrant_stopwithPermissionError.scripts/run-python-tests.py tests/test_agent_workflow_hooks.py tests/test_gate_receipt.pynow runs 36 tests there, all passing.tests/test_agent_workflow_hooks.pynow passes in full, 14 tests. The receipt test passes on Windows either way, since Git Bash runs a script that starts with#!whatever its mode, so it is the Linux run above that shows it. Four other cases intests/test_gate_receipt.pyfail on Windows onmainas well and pass in the container.scripts/run-python-tests.pyruns cases in parallel and other cases patchtreeon the shared one. A probe holding that patch in another thread failed the shared-module version and passes this one.ruff format --checkandruff checkpass with ruff 0.15.2, the version CI pins;shfmt -d scripts/test.shis clean with shfmt 3.8.0, the version Ubuntu 24.04 ships to CI, andsh -n scripts/test.shparses.Summary by cubic
Fixes the Claude Code Stop hook
scripts/agent-closeout-check.pycrashing at the end of every turn on Windows instead of printing its once-per-tree reminder.The hook,
scripts/test.sh, and the test helpers now runscripts/tree-fingerprint.shthroughshinstead of executing it directly, which Windows cannot do and which also fails when a checkout lacks the executable bit. A checkout without the executable bit previously wrote no receipt to match, soscripts/test.shand the stop hook now take their fingerprints the same way. Tests now invoke each script through its interpreter as well, and the hook's docstring notes it still raises with noshon PATH. New regression tests cover both.Written for commit 2653883. Summary will update on new commits.