-
Notifications
You must be signed in to change notification settings - Fork 248
Fix: Disable agent hooks when Entire is not active #656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ import ( | |
| "github.com/entireio/cli/cmd/entire/cli/agent/types" | ||
| "github.com/entireio/cli/cmd/entire/cli/logging" | ||
| "github.com/entireio/cli/cmd/entire/cli/paths" | ||
| "github.com/entireio/cli/cmd/entire/cli/settings" | ||
| "github.com/entireio/cli/cmd/entire/cli/strategy" | ||
| "github.com/entireio/cli/perf" | ||
|
|
||
|
|
@@ -53,6 +54,9 @@ func newAgentHooksCmd(agentName types.AgentName, handler agent.HookSupport) *cob | |
| Short: handler.Description() + " hook handlers", | ||
| Hidden: true, | ||
| PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { | ||
| if !settings.IsSetUpAndEnabled(cmd.Context()) { | ||
| return nil | ||
| } | ||
|
Comment on lines
56
to
+59
|
||
| agentHookLogCleanup = initHookLogging(cmd.Context()) | ||
|
Comment on lines
56
to
60
|
||
| return nil | ||
| }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agent hooks still execute when Entire never set up
Medium Severity
The new
IsSetUpAndEnabledguard inPersistentPreRunEonly skips logging initialization but doesn't prevent the child command'sRunEfrom running. Unlike the git hooks pattern which uses agitHooksDisabledflag checked in each child command, agent hooks have no equivalent. When Entire was never set up,executeAgentHook'sIsEnabled()returns(true, err)with non-nilerr, so the conditionerr == nil && !enabledis false and the hook proceeds to execute (parsing events, dispatching lifecycle, etc.). The fix doesn't achieve its stated goal for the "never set up" case.Additional Locations (1)
cmd/entire/cli/hook_registry.go#L104-L109