Repository navigation
Share one step registry per process, whatever path ClawFlow was imported from - #57
Merged
Merged
Conversation
…ted from Node caches ES modules by resolved path, so a plugin importing ClawFlow from src/index.ts and a gateway running dist/index.js got two registries. Steps registered through the first never reached the engine, and flows failed validation with "Unknown node type". House plugins have flipped between the two paths more than once: agent-tools was fixed in July, openclaw-email was still wrong in September. The default registry now lives on globalThis under a registered symbol, so every module instance in the process reads and writes the same one. The test loads the module twice under different specifiers and checks a step registered through one is visible through the other.
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.
Problem
Plugins register custom steps by importing ClawFlow from an absolute path. Node caches ES modules by resolved path, so importing
src/index.tswhile the gateway runsdist/index.jsyields twodefaultRegistryobjects. Steps land in the one the engine never reads, and flows fail withUnknown node type. This has recurred across house plugins (agent-tools fixed in July, openclaw-email found broken today on a customer box).Fix
Hold
defaultRegistryonglobalThisunderSymbol.for("@clawnify/clawflow/step-registry"). Every module instance in the process shares it, so the importer's path no longer matters.Test
tests/registry-shared.test.tsimports the module twice under different specifiers and checks registration through one is visible through the other. Full suite 229 passing. 1.6.4 → 1.6.5.