fix: resolve plugin registry via getter injection to fix LINE webhook 404#45150
fix: resolve plugin registry via getter injection to fix LINE webhook 404#45150masatohoshino wants to merge 0 commit intoopenclaw:mainfrom
Conversation
This comment was marked as spam.
This comment was marked as spam.
Greptile SummaryThis PR refactors how the plugin registry is supplied to However, the critical piece in
The new tests are well-structured and accurately cover the handler-level contract, but they don't catch the missing Confidence Score: 2/5
Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/gateway/server.impl.ts
Line: 481
Comment:
**`pluginRegistryCurrent` is never reassigned — getter always returns `initialPluginRegistry`**
`pluginRegistryCurrent` is declared with `let` on this line and the getter `() => pluginRegistryCurrent` is wired in at line 621, but there is no code anywhere in `server.impl.ts` that ever reassigns `pluginRegistryCurrent` to a new value. This means:
1. The getter `() => pluginRegistryCurrent` is functionally identical to using `registry: initialPluginRegistry` directly.
2. The "registry swap boundary" capability that the new `getRegistry` pattern enables in `createGatewayPluginRequestHandler` is never actually exercised at runtime.
If the root cause of the LINE webhook 404 regression is a stale plugin registry (e.g., because the registry is populated asynchronously after the HTTP server starts listening), the fix is incomplete — you need the code path that updates `pluginRegistryCurrent` to the post-load registry. Without it, callers will always see the registry as it was at startup.
If the intent is to wire in a future hot-reload mechanism, a comment explaining this would help avoid confusion. If `pluginRegistryCurrent` is genuinely expected to be mutated by some future call site, that reassignment is missing from this PR.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: src/gateway/server-runtime-state.ts
Line: 131-133
Comment:
**`shouldEnforcePluginGatewayAuth` and `handlePluginRequest` call `getRegistry` independently**
For a single incoming request, `shouldEnforcePluginGatewayAuth` (called during auth gate) and `handlePluginRequest` (called during dispatch) each invoke the getter independently. If `pluginRegistryCurrent` were ever mutated between these two calls on the same request, the auth check and the route-matching step could observe different registries — e.g., a route is deemed "does not require auth" by the auth gate but then matched to a gateway-auth route by the handler (or vice versa).
Consider capturing the registry once per request (e.g., pass the snapshot through to both) rather than calling the getter twice.
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: 222708f |
|
Thanks @George-Claw for the detailed analysis in #45445. This PR addresses Issue 1 (stale registry capture via getter injection). Issue 2 (httpRoutes lost on registry replacement in |
e491fb2 to
59cd980
Compare
Summary
Fixes the LINE webhook 404 regression by replacing direct global plugin registry access with getter-based injection.
Closes #34631
Supersedes #40224
What changed
createGatewayPluginRequestHandlerwithgetRegistryparam (getRegistry>registrypriority, fail-fast if both missing)pluginRegistryCurrentinserver.implwith getter-based injectionHow #40224 review feedback is addressed
registry:param still works;getRegistryis additiveTests added
getRegistryandregistryare missingNotes
2026.3.12— backport appreciatedplugins-http.test.tstests passpnpm tsgopasses clean