-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
bug(plugin-sdk): normalizeDiagnosticEventsModule hardcodes stale minified export alias #87082
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Type
Fields
Priority
None yet
Summary
src/plugin-sdk/root-alias.cjs:normalizeDiagnosticEventsModulehardcodesmod.ras the fallback alias foronDiagnosticEventwhen the named export isn't found on the loaded diagnostic-events chunk. As of 2026.5.25-beta.1, the bundler assignsrtoemitFailoverEventandutoonDiagnosticEvent, so the fallback maps the wrong function.This causes
TypeError: unsubscribeDiagnosticEvents is not a functionon every gateway stop/restart for any plugin that subscribes to diagnostic events via the SDK wrapper.Root cause
The function correctly checks for the named export first, but the single-letter fallback
mod.ris fragile — the bundler reassigns export aliases across builds.Impact
onDiagnosticEvent(listener)in the SDK wrapper callsemitFailoverEvent(listener)instead, which returns a non-function value.onDiagnosticEvent()(lines 164-168) correctly subscribes the listener viaonDiagnosticEventFromSharedState, so data collection works.unsubscribeDiagnosticEvents()on the non-function return value →TypeError.onDiagnosticEventfrom the SDK gets this error on stop.Suggested fix
Replace the hardcoded
mod.rcheck withFunction.nameintrospection:JavaScript functions retain their original
.nameproperty regardless of export aliasing, so this works across all builds without tracking which letter the bundler assigns.Reproduction
Any plugin that calls
onDiagnosticEventfromopenclaw/plugin-sdkon OpenClaw 2026.5.25-beta.1 will seeTypeError: unsubscribeDiagnosticEvents is not a functionin the gateway journal on every stop/restart.Environment