I have set up a `pre-commit.sh` script, which is r...
# questions
w
I have set up a
pre-commit.sh
script, which is really helpful, but OpenHands doesn’t seem to run it before creating a pull request unless I tell it to. When I do tell it to run the script, it behaves as intended. I placed the script in
.openhands/pre-commit.sh
(in the root of my project). Am I doing something wrong?
w
Hmm no this sounds like a bug. It should be getting set as a git hook, so
git commit
should always run it
sometimes the agent gets lazy and adds
--no-verify
though
are you running OH yourself? anything in the logs when the workspace is getting set up?
w
I’m running OH locally (using
claude-sonnet-4-20250514
as the LLM). I didn’t see anything in the logs when setting up the workspace. I also haven’t tried to reproduce the bug.
l
Are you running the CLI or GUI?
w
GUI
I haven’t yet reached CLI-level proficiency in OH
l
@nutritious-balloon-65098 Based on the above report, open an issue on the All-Hands-AI/OpenHands repo, and tag it with the
openhands
tag.
n
I'm on it! Graham Neubig can track my progress here.
Summary I have successfully created a GitHub issue on the All-Hands-AI/OpenHands repository based on the conversation you provided about the pre-commit hook bug. Issue Details: Issue #11409: "Pre-commit hooks not automatically executed before agent creates pull requests" • URL: https://github.com/All-Hands-AI/OpenHands/issues/11409 • Label:
openhands
(automatically applied) • Status: Open Issue Content: The issue documents the bug where: 1. Users place a pre-commit script at
.openhands/pre-commit.sh
in their project 2. OpenHands correctly installs it as a git hook during workspace setup 3. However, the agent doesn't automatically execute this hook when making commits before creating PRs 4. The hook only runs when explicitly instructed by the user The issue includes: • Clear description of the problem • Detailed reproduction steps • Expected vs actual behavior • Environment information (GUI interface, claude-sonnet-4-20250514) • Additional context with possible causes (e.g., agent might be using
--no-verify
, timing issues) • References to relevant code locations in the OpenHands codebase • Impact statement explaining why this matters for users The issue has been automatically tagged with the
openhands
label as requested, which means the OpenHands GitHub App will attempt to work on fixing this issue automatically. No code changes were made in this task - this was purely about documenting and reporting the issue on GitHub. <sub>View full conversation</sub>