Skip to content

install: link the shared hook folders into every tool - #772

Open
EdbertChan wants to merge 1 commit into
mainfrom
stack/EdbertChan/install/link-sdk-all-harnesses/link-sdk-markers-harness-hooks-dir--e4ec0204
Open

EdbertChan wants to merge 1 commit into
mainfrom
stack/EdbertChan/install/link-sdk-all-harnesses/link-sdk-markers-harness-hooks-dir--e4ec0204

Conversation

@EdbertChan

@EdbertChan EdbertChan commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Summary

Small checker scripts run before and after each reply. Some of them share one folder of helper code.

The installer does not link that shared folder next to the checkers, so two of them crash on every reply.

The installer now links the shared folder for all three tools. A new test installs into a throwaway folder and runs every checker to catch a missing piece.

Review Claim

Once set up, every checker script on the machine can load the shared helper code it needs, for all three tools.

Review Lane

behavior

Review Unit

engine-runtime

Safety Invariant

The installer only adds links to folders already in this repo; it removes or changes nothing else.

Slice Rationale

One fix and its test. On main, install.sh links _markers only for Claude and _sdk for no tool, while diu-stop, demo-freeze, llm-judge and four eval_dictionary.py tools add <hooks>/_sdk (and _markers) to their import path from their installed location. demo-freeze and diu-stop import from that path at load time, so on an installed machine they crash:

File "/Users/.../.claude/hooks/diu-stop/claude_stop_check.py", line 61, in <module>
  from finding import Finding  # noqa: E402
ModuleNotFoundError: No module named 'finding'

Non-goals

  • No change to any hook's own code or import lines.
  • No change to which hooks are installed.

Test Plan

Test Plan
  • python3 -m unittest tests.test_install.TestInstalledHookScriptsImport with install.sh from main: fails, listing 17 scripts (for example .claude/hooks/diu-stop/claude_stop_check.py: ModuleNotFoundError: No module named 'finding'); with this change:
    Ran 1 test in 55.379s
    OK
    
  • The same sweep over the real installed hooks after adding the two links by hand: checked=239 import-fail=0 unchecked=6 (the 6 are eval_dictionary.py command-line tools that ran past their imports and hit the 20s probe limit)
  • echo '{}' | python3 ~/.claude/hooks/diu-stop/claude_stop_check.pyexit=0
  • shellcheck install.sh → exit 0
  • python3 engine/skills/make-pr/scripts/preflight.py --base origin/mainunit engine-runtime, gates ok

Revert Plan

Revert Plan
  • Safe to revert? Yes, but the two crashing checkers come back.
  • Revert command: git revert <sha>
  • Post-revert steps: re-run ./install.sh
  • Data migration? No

🤖 Generated with Claude Code

Hooks moved onto the shared runtime (diu-stop, demo-freeze, llm-judge and
the eval_dictionary tools) reach engine/hooks/_sdk through their installed
path, but install.sh never linked _sdk, and linked _markers only for
Claude. After #731 and #732 merged, the diu-stop and demo-freeze hooks
crashed with ModuleNotFoundError on every run.

The new test installs into a fake HOME and runs every installed hook
script, failing on any import error.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Change-Id: Ie4ec0204ee5b8e82ff15138ad823fdcecf060ac3
@EdbertChan EdbertChan changed the title install: link _sdk and _markers into every harness hooks dir install: link the shared hook folders into every tool Sep 17, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 86b6691. Configure here.

Comment thread tests/test_install.py
capture_output=True,
text=True,
timeout=5,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test runs live judge scripts

Medium Severity

The new import check runs every installed hook *.py except install_*, test_*, detect.py, and state.py. That still includes eval_dictionary.py, whose __main__ path calls judge.ask and can start real model runners in a new session. The 5s timeout then kills only the parent, so those children can keep running.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 86b6691. Configure here.

@mergify

mergify Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@EdbertChan

Copy link
Copy Markdown
Owner Author

Mergify repair stopped: unresolved human review thread PRRT_kwDOT3uYWs6jT6ED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant