fix(hooks): clear internal hooks before plugins register#20541
Closed
ramarnat wants to merge 5 commits intoopenclaw:mainfrom
Closed
fix(hooks): clear internal hooks before plugins register#20541ramarnat wants to merge 5 commits intoopenclaw:mainfrom
ramarnat wants to merge 5 commits intoopenclaw:mainfrom
Conversation
d900e67 to
32bcbfc
Compare
Author
|
@greptileai check latest push. Nothing's changed just rebasing for latest main |
32bcbfc to
d783f11
Compare
ffa8cd3 to
07524d6
Compare
Plugins may register internal hooks during plugin registration. The gateway previously cleared internal hooks while loading file-based hooks, wiping plugin-registered hooks like session:start. Clear once before plugin loading and keep hook discovery additive. Adds a regression test covering plugin-registered internal hooks surviving gateway sidecar hook loading.
07524d6 to
142fa9c
Compare
This was referenced Mar 1, 2026
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing 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.
Summary
Describe the problem and fix in 2–5 bullets:
session:start) were being cleared during gateway startup when file-based internal hooks were loaded.clearInternalHooks()now runs once before plugin loading insrc/gateway/server.impl.ts; clearing was removed from sidecar hook loading insrc/gateway/server-startup.ts; regression coverage added insrc/gateway/server-startup.plugin-internal-hooks.test.ts.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:Repro + Verification
Environment
Steps
Expected
Actual
Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
pnpm checkpasses on branch.pnpm test -- src/gateway/server-startup.plugin-internal-hooks.test.tspasses.pnpm test -- src/docker-setup.test.tspasses (Windows-related test portability nudge included on this branch).Compatibility / Migration
Yes)No)No)Failure Recovery (if this breaks)
pr/internal-hooks-clear-before-plugins.src/gateway/server.impl.tssrc/gateway/server-startup.tssrc/gateway/server-startup.plugin-internal-hooks.test.tsRisks and Mitigations
Greptile Summary
Fixed plugin-registered internal hooks being cleared during gateway startup. Previously,
clearInternalHooks()was called during file-based internal hook discovery, which wiped out hooks that plugins had registered during their initialization. The fix moves the clear operation to run once before plugin loading insrc/gateway/server.impl.ts:272, ensuring plugin-registered hooks survive the startup sequence.clearInternalHooks()fromserver-startup.tstoserver.impl.tsto run before plugins loadConfidence Score: 5/5
Last reviewed commit: 32bcbfc