Commit 6ec9f33
authored
fix: change stop hook from blocking to warning to prevent auto-commits (microsoft#1451)
## 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`1 parent b0cca4e commit 6ec9f33
1 file changed
+5
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | | - | |
119 | | - | |
| 118 | + | |
120 | 119 | | |
121 | 120 | | |
122 | 121 | | |
| |||
128 | 127 | | |
129 | 128 | | |
130 | 129 | | |
131 | | - | |
| 130 | + | |
132 | 131 | | |
133 | 132 | | |
134 | | - | |
| 133 | + | |
135 | 134 | | |
136 | 135 | | |
137 | 136 | | |
| |||
0 commit comments