Skip to content

Share one step registry per process, whatever path ClawFlow was imported from - #57

Merged
pallaoro merged 1 commit into
mainfrom
fix/global-step-registry
Sep 16, 2026
Merged

pallaoro merged 1 commit into
mainfrom
fix/global-step-registry

Conversation

@pallaoro

Copy link
Copy Markdown
Member

Problem

Plugins register custom steps by importing ClawFlow from an absolute path. Node caches ES modules by resolved path, so importing src/index.ts while the gateway runs dist/index.js yields two defaultRegistry objects. Steps land in the one the engine never reads, and flows fail with Unknown node type. This has recurred across house plugins (agent-tools fixed in July, openclaw-email found broken today on a customer box).

Fix

Hold defaultRegistry on globalThis under Symbol.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.ts imports 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.

…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.
@pallaoro
pallaoro merged commit 3a79ace into main Sep 16, 2026
1 check passed
@pallaoro
pallaoro deleted the fix/global-step-registry branch September 16, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant