Skip to content

fix: change stop hook from blocking to warning to prevent auto-commits#1451

Open
StellaHuang95 wants to merge 1 commit intomicrosoft:mainfrom
StellaHuang95:stopHook
Open

fix: change stop hook from blocking to warning to prevent auto-commits#1451
StellaHuang95 wants to merge 1 commit intomicrosoft:mainfrom
StellaHuang95:stopHook

Conversation

@StellaHuang95
Copy link
Copy Markdown
Contributor

Summary

Changes the stop hook from "decision": "block" to "decision": "warn" so the agent asks the user before committing instead of auto-committing.

Background

The stop_hook.py is a pre-session stop hook that runs when an agent (maintainer) session ends. It checks the git state for:

  1. Uncommitted TypeScript changes (staged, modified, or untracked .ts/.tsx files) — reminds the agent to run pre-commit checks (lint, type-check, tests)
  2. Staged but uncommitted changes — reminds the agent that work hasn't been committed

Problem

Previously, both checks used "decision": "block", which prevented the agent from ending the session until the condition was resolved. The reason text explicitly told the agent to commit changes (e.g., "If checks pass and changes are ready, commit them"). This combination caused the agent to auto-commit every time without asking the user, which is undesirable when the user wants to review changes before committing.

Changes

  • "decision": "block""decision": "warn" for both the TS changes check and the staged changes check. The agent sees the warning but is no longer forced to act on it.
  • Removed commit instructions from the reason text (e.g., "commit them", "Either commit them with a proper message") so the agent doesn't interpret them as required actions.
  • Added explicit user-consent escape: reason text now says "Ask the user whether to commit or leave changes uncommitted", ensuring the agent defers to the user.

Files Changed

  • .github/hooks/scripts/stop_hook.py

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