Skip to content

fix(knowledge): start workers on Bun and standalone builds - #183771

Merged
steipete merged 3 commits into
mainfrom
steipete/knowledge-bun-worker-resolver
Oct 25, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/knowledge-bun-worker-resolver

Conversation

@steipete

@steipete steipete commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Knowledge's registry and storage workers fail on Bun with Export named 'registerHooks' not found in module 'node:module'. Standalone images also omit both workers because they were missing from the canonical runtime-process manifest.

User Impact

Removes Knowledge's Bun startup blocker and includes its registry and storage workers in standalone builds. Node behavior and the host's selected SDK modules are preserved. Signed AOT artifact qualification remains pending.

Why This Change Was Made

Both workers install SDK aliases through the selected runtime's native resolver before loading storage code. Their declarations and generated runtime inventories are kept in sync. Their clients use the existing declared-worker URL contract for source, packaged, and standalone layouts. The asset-location module stays free of SDK imports so worker bootstrap does not need those aliases before installing them.

Evidence

  • Before the fix, both actual worker entries fail under the experimental Bun compiler at the named registerHooks import.
  • After the fix, the actual host resolver and sdkUrls() feed real registry/storage clients successfully on Node and Bun: registry snapshot and storage partitions complete, including the worker-side authority check.
  • 30 focused Node tests pass, including manifest admission, source/package worker URLs, emitted worker entrypoints, and the existing mid-operation authority-revocation regression. The complete command took 63.86 s including compiled-test setup; the new worker-entry tests took 260 ms.
  • The forced-SDK-alias emitted-worker regression passes on the production-pinned Bun and the existing repaired compiler candidate. The original experimental compiler still fails it because of its separately tracked bare-import onResolve limitation; this PR does not change compiler code or suppress that test.
  • Initial CI exposed two stale generated runtime assets after the manifest change. Canonical regeneration updates only the Knowledge worker declarations; the exact failed script-freshness test and runtime:scripts:check now pass. The browser CI failure occurred at that same pre-test gate.
  • CI also required the Bun global assertion to document its public-runtime invariant, matching the existing core resolver. The assertion-safety ratchet passes after that comment-only repair.
  • Targeted production, test, and tooling typechecks, file-scoped lint, formatting, and fresh independent review pass. CI provides broad proof.
  • The final signed-artifact replay must invoke knowledge_ontology, which provisions an isolated store and starts both embedded workers; knowledge_status alone does not exercise storage startup.

Use runtime-owned SDK alias resolution inside both workers and declare their client-owned entrypoints in the canonical process manifest. Resolve worker URLs through the existing SDK contract so source, package, and embedded builds use the same worker inventory.
@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 25, 2026 18:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T18:54:33.296570Z 58c12b7 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Regenerate the daemon runtime probe and its script inventory after declaring Knowledge registry and storage workers. This repairs the script freshness gate that stopped both compact tests and browser bootstrap CI before their runtime checks.
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 25, 2026
@clawsweeper

clawsweeper Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds Bun-compatible SDK resolution to Knowledge workers and declares both workers for standalone packaging.

Example: An agent invokes knowledge_ontology with Knowledge enabled under Bun.

  • Before: Worker startup fails with "Export named 'registerHooks' not found in module 'node:module'".
  • After: The workers install SDK aliases through Bun's native resolver before loading their storage modules.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch appears correct and has useful boundary tests, but supplied evidence does not demonstrate the changed behavior through a signed standalone product entry point.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor-proof gate; its body reports successful Node/Bun registry and storage operations, while the added tests exercise emitted bootstrap with fixture hosts and signed standalone qualification remains pending.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Knowledge cannot start its registry and storage workers on Bun, and standalone builds omit those worker programs.
Reason: This maintainer-authored repair restores supported runtime behavior using the existing worker contracts.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a current-main Knowledge startup failure with a focused change; no actionable introduced defect was found.

Priority: P2
Reviewed head: 58c12b7787c3852c32667329f506750a8ed63994

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: A signed standalone knowledge_ontology run exercising both embedded workers is not supplied; the body explicitly leaves that qualification pending.
Agent review details

How this fits together

Knowledge clients dispatch registry and vault operations to worker threads, which load the host-selected SDK modules and return operation results; the runtime manifest supplies their build and packaging identities.

flowchart LR
  A[Knowledge tool request] --> B[Registry and storage clients]
  C[Runtime process manifest] --> B
  C --> D[Standalone worker inventory]
  B --> E[Worker SDK resolver]
  E --> F[Registry and storage hosts]
  F --> G[Knowledge stores]
Loading

Technical review

Best possible solution:

Use the existing runtime manifest for worker identity and install the host-selected SDK aliases with each runtime's native resolver.

Do we have a high-confidence way to reproduce the issue?

Current source confirms the Node-only worker bootstrap and missing standalone declarations; the body reports the matching Bun failure, but no independent runtime reproduction was performed.

Is this the best way to solve the issue?

The patch addresses both causes through existing owners, preserves SDK selection and authority checks, and removes the replaced URL helper without adding configuration or persistent state.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 763ae526e3fb.

Provenance checked

  • Knowledge worker SDK bootstrap keeps the original intent (65ad180: The bundled plugin installed the host-selected SDK aliases before loading worker storage code.)
  • Knowledge worker URL resolution keeps the original intent (65ad180: Worker and asset locations followed the host-selected plugin entry because bundled modules can move into shared chunks.)
  • Standalone worker inventory keeps the original intent (012d92f: The canonical runtime-process manifest replaced scattered worker declarations and filename discovery while retaining package ownership.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Josh Lehman: Raw commit 65ad180 adds extensions/knowledge/src/registry-worker.ts:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 65ad18005286; files: extensions/knowledge/src/registry-worker.ts)
  • Peter Steinberger: Raw commit 012d92f adds src/infra/runtime-process-manifest.ts:445 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 012d92f53781; files: src/infra/runtime-process-manifest.ts)

PR surface

Source +50, Tests +92, Docs +5, Generated 0. Total +147 across 12 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 7 73 23 +50
Tests 2 92 0 +92
Docs 1 5 0 +5
Config 0 0 0 0
Generated 2 2 2 0
Other 0 0 0 0
Total 12 172 25 +147

Labels

Label changes:

  • add P2: Knowledge worker startup is broken on Bun and incomplete in standalone packaging, with impact limited to this optional memory plugin.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Knowledge worker startup is broken on Bun and incomplete in standalone packaging, with impact limited to this optional memory plugin.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 25, 2026, 3:07 PM ET / 19:07 UTC.

@steipete
steipete merged commit a4cfee8 into main Oct 25, 2026
151 of 153 checks passed
@steipete
steipete deleted the steipete/knowledge-bun-worker-resolver branch October 25, 2026 19:08
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 26, 2026
…183771)

* fix(knowledge): start workers on Bun and standalone builds

Use runtime-owned SDK alias resolution inside both workers and declare their client-owned entrypoints in the canonical process manifest. Resolve worker URLs through the existing SDK contract so source, package, and embedded builds use the same worker inventory.

* chore(knowledge): refresh generated worker inventories

Regenerate the daemon runtime probe and its script inventory after declaring Knowledge registry and storage workers. This repairs the script freshness gate that stopped both compact tests and browser bootstrap CI before their runtime checks.

* chore(knowledge): document Bun worker runtime invariant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. plugin: knowledge rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant