fix!: activate hooks only in initialized repositories - #27
Merged
Conversation
Hooks fired in any repository with a detected language, so a repository that never ran `forgeguard init` was gated, blocked, and written to. That turned unrelated work into blocked agent turns and contradicted the documented contract that global hooks pass silently outside initialized repositories. - Activation now requires `.forgeguard/config.toml`. The stop hook checks it too; it previously had no project guard at all. Nested repositories inside an initialized workspace still inherit gating. - Retry and no-progress budgets both reset when the worktree or task state advances. A session that progressed every turn could previously exhaust the retry budget and be stopped. - A stop decision is replayed for a short window when repository and task state are unchanged, so a duplicated hook registration cannot consume the retry, no-progress, or auto-poke budget. - A blocked task releases its auto-poke budget when the session registers a different objective, instead of stopping the next objective on its first turn. - Stop-hook gates skip the configured commands when every changed path is documentation or an asset. Removed paths and files under test trees still run them. - `forgeguard init` writes a stop-hook timeout that covers the configured command budget, and repairs existing entries whose timeout is too short. BREAKING CHANGE: repositories without `.forgeguard/config.toml` are no longer gated. Run `forgeguard init` to keep enforcement.
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.
Hooks fired in any repository with a detected language, so a repository that never ran
forgeguard initwas gated, blocked, and written to. That contradicteddocs/ARCHITECTURE.md, which states global hooks pass silently outside initialized repositories.Changes
is_hook_projectnow requires.forgeguard/config.toml; a detected language is no longer treated as consent.evaluate_stop_hookuses the guard too — it previously had none. Nested repositories inside an initialized workspace still inherit gating.continue: false.test/,tests/,spec/,fixtures/,testdata/still run them.forgeguard initwrites a stop-hook timeout covering the configured command budget and repairs existing entries whose timeout is too short.Verification
Manual reproduction in a scratch repository:
.forgeguard/,.gitignoreuntouchedforgeguard init, source changedecision: blockforgeguard init, markdown-only changedecision: blockattempt 1/3each turn, no stopBreaking change
Repositories without
.forgeguard/config.tomlare no longer gated. Runforgeguard initto keep enforcement.