feat(hooks): emit gateway shutdown lifecycle events#12582
Open
vincentkoc wants to merge 8 commits intoopenclaw:mainfrom
Open
feat(hooks): emit gateway shutdown lifecycle events#12582vincentkoc wants to merge 8 commits intoopenclaw:mainfrom
vincentkoc wants to merge 8 commits intoopenclaw:mainfrom
Conversation
Member
Author
Member
Author
|
@greptile updated the tests as requested. Please update PR score if OK to merge |
Member
Author
|
@greptile I fixed the hooks.md as requested with wording. Everything should be good to merge, please update the PR socre |
This was referenced Feb 9, 2026
bfc1ccb to
f92900f
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
|
This pull request has been automatically marked as stale due to inactivity. |
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.
Why
Gateway shutdown/restart is an operationally sensitive boundary where lifecycle observability is important for uptime tooling. This PR emits explicit shutdown lifecycle events so monitoring and guardrail hooks can react consistently.
Detailed Changes
gateway:shutdowngateway:pre-restart(when restart is expected)Related Links and Issues
Greptile Overview
Greptile Summary
This PR adds two new internal hook emissions to the gateway shutdown flow (
gateway:shutdownand conditionalgateway:pre-restart) and updates the hooks documentation accordingly. It also introduces a focused unit test that mocks internal hook dispatch and asserts the emitted event contexts during a restart-oriented shutdown.The changes plug into the existing internal hook registry (
src/hooks/internal-hooks.ts) by constructingInternalHookEvents and callingtriggerInternalHook(...)early increateGatewayCloseHandler, before the rest of the shutdown teardown proceeds.Confidence Score: 5/5