openclaw - ✅(Solved) Fix [Bug]: subagent-registry.runtime.js missing from dist — run_task with runtime "subagent" silently fails [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#66189Fetched 2026-04-14 05:38:54
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
cross-referenced ×2

Error Message

subagent-registry-CflSFWBm.js imports subagent-registry.runtime.js as a static path, but that file does not exist in the dist folder. This crashes the subagent registry at startup and causes all run_task calls with runtime: "subagent" via the webhooks plugin to silently remain in queued / deliveryStatus: pending state with no error surfaced to the caller. Error (from gateway.log at every startup): [warn] subagent cleanup finalize failed: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/opt/homebrew/lib/node_modules/openclaw/dist/subagent-registry.runtime.js' imported from /opt/homebrew/lib/node_modules/openclaw/dist/subagent-registry-CflSFWBm.js

Fix Action

Fix / Workaround

Repro:

  1. Clean install: npm install -g openclaw@latest
  2. Configure a webhook route in the webhooks plugin
  3. Send create_flow then run_task with runtime: "subagent"
  4. Task is created in the DB but never dispatched — stays queued / deliveryStatus: pending indefinitely

PR fix notes

PR #66205: fix(build): include subagent-registry.runtime.js in dist output

Description (problem / solution / changelog)

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: The build configuration failed to generate subagent-registry.runtime.js in the dist folder, causing a module resolution error at runtime.
  • Why it matters: This prevented the subagent registry from initializing, causing run_task calls with runtime: "subagent" to hang indefinitely in a queued state without surfacing errors to the user.
  • What changed: Updated vite.config.ts to include a manualChunks rule for subagent-registry.runtime, ensuring the file is properly emitted during the build process.
  • What did NOT change (scope boundary): No changes to runtime logic, API contracts, or other build configurations.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #66189

User-visible / Behavior Changes

run_task calls with runtime: "subagent" will now execute successfully instead of hanging indefinitely in a queued state. The gateway will no longer log ERR_MODULE_NOT_FOUND warnings regarding subagent-registry.runtime.js on startup.

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation: N/A

Repro + Verification

Environment

  • OS: macOS arm64
  • Runtime/container: Node v25.9.0
  • Model/provider: N/A
  • Integration/channel (if any): Webhooks
  • Relevant config (redacted): N/A

Steps

  1. Build the project using the updated vite.config.ts.
  2. Verify dist/subagent-registry.runtime.js exists in the output directory.
  3. Verify dist/subagent-registry-CflSFWBm.js imports the generated file correctly.
  4. Run the gateway and check logs for the absence of ERR_MODULE_NOT_FOUND.
  5. Trigger a run_task with runtime: "subagent" and confirm it transitions out of queued.

Expected

subagent-registry.runtime.js is present in dist. Gateway starts without module errors. Subagent tasks execute successfully.

Actual

Prior to the fix, the file was missing, resulting in Error [ERR_MODULE_NOT_FOUND] on startup and silent task failures. After the fix, the file is generated and tasks run.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios: local scoped validation and targeted checks for the changed area passed
  • Edge cases checked: relevant changed-path scenarios covered by selected validation
  • What you did not verify: full repository integration coverage beyond the selected validation scope

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps: N/A

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: Revert the changes to vite.config.ts and rebuild.
  • Files/config to restore: vite.config.ts
  • Known bad symptoms reviewers should watch for: If the regex in manualChunks is incorrect, the file might still be missing or named incorrectly, causing the original runtime error to persist.

Risks and Mitigations

Low risk. The change mirrors the existing logic for install.runtime. If the chunk name changes, it might break imports, but the fix explicitly targets the missing filename.

--- END TEMPLATE

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/infra/tsdown-config.test.ts (modified, +1/-0)
  • tsdown.config.ts (modified, +1/-0)

PR #66266: fix(build): ship subagent registry runtime sidecar

Description (problem / solution / changelog)

Summary

  • Problem: npm installs can ship dist/subagent-registry-*.js without the stable dist/agents/subagent-registry.runtime.js sidecar that src/agents/subagent-registry.ts imports at runtime.
  • Why it matters: subagent runs can stay queued forever behind ERR_MODULE_NOT_FOUND instead of dispatching.
  • What changed: add the missing stable dist entry in tsdown.config.ts, lock it into the tsdown config test, and add the user-facing changelog note.
  • What did NOT change (scope boundary): no subagent runtime logic changed; this is build-entry and release artifact wiring only.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #66189
  • Related #66205
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: subagent-registry.ts lazy-loads ./subagent-registry.runtime.js, but buildCoreDistEntries() never emitted that stable runtime entry.
  • Missing detection / guardrail: the tsdown entry invariant test covered sibling runtime sidecars but not this one.
  • Contributing context (if known): the original contributor PR correctly found the missing artifact but patched an unused root Vite config instead of the tsdown build graph.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/infra/tsdown-config.test.ts
  • Scenario the test should lock in: the unified dist graph includes agents/subagent-registry.runtime alongside the other stable runtime sidecars.
  • Why this is the smallest reliable guardrail: the bug is an omitted build entry, so the most direct invariant is the tsdown entry map itself.
  • Existing test that already covers this (if any): the same file already covers the neighboring stable runtime entries.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

  • npm-installed builds now ship the stable subagent registry runtime sidecar required for subagent dispatch.

Diagram (if applicable)

N/A

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: local repo checkout
  • Model/provider: N/A
  • Integration/channel (if any): subagent runtime packaging
  • Relevant config (redacted): N/A

Steps

  1. Run pnpm test:serial src/infra/tsdown-config.test.ts
  2. Run pnpm build
  3. Verify dist/agents/subagent-registry.runtime.js exists

Expected

  • The build emits the stable runtime sidecar and the config test includes the entry.

Actual

  • Before this PR, the build graph omitted the stable sidecar entry.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios: tsdown config test passed; full pnpm build passed; confirmed dist/agents/subagent-registry.runtime.js exists after build.
  • Edge cases checked: kept the change limited to the stable runtime entry list already used for sibling lazy runtime boundaries.
  • What you did not verify: a live webhook/subagent end-to-end dispatch after npm global install.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps:

Risks and Mitigations

  • Risk: none beyond emitting one additional stable dist artifact already referenced by runtime code.
    • Mitigation: covered by the tsdown entry test and full build verification.

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/infra/tsdown-config.test.ts (modified, +1/-0)
  • tsdown.config.ts (modified, +1/-0)

Code Example

[warn] subagent cleanup finalize failed: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/opt/homebrew/lib/node_modules/openclaw/dist/subagent-registry.runtime.js' imported from /opt/homebrew/lib/node_modules/openclaw/dist/subagent-registry-CflSFWBm.js
RAW_BUFFERClick to expand / collapse

Environment:

  • macOS arm64
  • Node v25.9.0
  • OpenClaw 2026.4.12 (1c0672b), installed via npm install -g openclaw

Bug: subagent-registry-CflSFWBm.js imports subagent-registry.runtime.js as a static path, but that file does not exist in the dist folder. This crashes the subagent registry at startup and causes all run_task calls with runtime: "subagent" via the webhooks plugin to silently remain in queued / deliveryStatus: pending state with no error surfaced to the caller.

Repro:

  1. Clean install: npm install -g openclaw@latest
  2. Configure a webhook route in the webhooks plugin
  3. Send create_flow then run_task with runtime: "subagent"
  4. Task is created in the DB but never dispatched — stays queued / deliveryStatus: pending indefinitely

Error (from gateway.log at every startup):

[warn] subagent cleanup finalize failed: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/opt/homebrew/lib/node_modules/openclaw/dist/subagent-registry.runtime.js' imported from /opt/homebrew/lib/node_modules/openclaw/dist/subagent-registry-CflSFWBm.js

Note: This appears related to the hashed chunk import fix in the latest release (dist/install.runtime-*.js), but the same fix was not applied to the subagent registry module specifically. The file subagent-registry-CflSFWBm.js exists but its internal import references the un-hashed static path which does not exist in dist.

Files present in dist:

  • subagent-registry-CflSFWBm.js
  • subagent-registry-read-DpozRxeB.js
  • subagent-registry-state-BdkWjAs7.js
  • subagent-registry-steer-runtime-DlsbxWM7.js
  • subagent-registry.runtime.jsmissing

extent analysis

TL;DR

The most likely fix is to update the subagent-registry-CflSFWBm.js file to import subagent-registry.runtime.js with a hashed chunk name to match the actual file name in the dist folder.

Guidance

  • Verify that the subagent-registry.runtime.js file is not present in the dist folder, as indicated by the error message and the "Files present in dist" section.
  • Check the import statement in subagent-registry-CflSFWBm.js to confirm it is referencing the non-existent static path subagent-registry.runtime.js.
  • Consider applying the same hashed chunk import fix that was applied to dist/install.runtime-*.js to the subagent registry module.
  • Investigate whether the missing subagent-registry.runtime.js file can be generated or replaced with a compatible alternative.

Example

No code snippet is provided as the issue does not contain sufficient information to generate a specific code fix.

Notes

The issue appears to be related to a recent release change that introduced hashed chunk imports, but this change was not applied consistently to all modules, including the subagent registry.

Recommendation

Apply a workaround by manually updating the import statement in subagent-registry-CflSFWBm.js to reference the correct hashed chunk name, if possible, or wait for an official fix from the OpenClaw maintainers.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING