Skip to content

fix: all bundled hooks broken since 2026.2.2 (tsdown migration)#9295

Merged
cpojer merged 2 commits intoopenclaw:mainfrom
patrickshao:fix/bundled-hooks-build
Feb 9, 2026
Merged

fix: all bundled hooks broken since 2026.2.2 (tsdown migration)#9295
cpojer merged 2 commits intoopenclaw:mainfrom
patrickshao:fix/bundled-hooks-build

Conversation

@patrickshao
Copy link
Contributor

@patrickshao patrickshao commented Feb 5, 2026

Summary

All bundled hooks have been completely broken since 2026.2.2. The tsdown migration inadvertently dropped hook handlers from the build — openclaw hooks list shows 0 hooks, and no bundled hooks execute at all. This affects everyone using bundled hooks like session-memory, command-logger, boot-md, and soul-evil.

Fixes #8732, #10338, #10897, #10180, #10198, #9582

Code word: lobster-biscuit

Repro Steps

  1. Install OpenClaw 2026.2.2 or later (npm install -g openclaw@latest)
  2. Run openclaw hooks list
  3. Observe: 0 bundled hooks shown (expected: 4)
  4. Configure any bundled hook (e.g., session-memory) in config
  5. Observe: hook never fires, no handler found errors in debug logs

Root Cause

The 2026.2.2 migration from tsc to tsdown dropped bundled hook handlers from the build. Two issues:

  1. No entry pointstsdown.config.ts had no entries for handler files, so they were never compiled to JS
  2. Wrong output pathscripts/copy-hook-metadata.ts copied HOOK.md files to dist/hooks/bundled/, but the runtime (resolveBundledHooksDir()) resolves path.join(moduleDir, "bundled")dist/bundled/

Behavior Changes

  • Before (broken): openclaw hooks list shows 0 bundled hooks; bundled hook handlers missing from dist/
  • After (fixed): openclaw hooks list shows 4 bundled hooks; all handlers compiled to dist/bundled/*/handler.js

No config changes required. No breaking changes. Restores pre-2026.2.2 behavior.

Codebase and GitHub Search

Searched for related issues and prior fixes:

Tests

  • pnpm build ✅ — all handlers compiled to correct paths
  • pnpm test ✅ — 36 test files, 220 tests passed
  • Session-memory handler tests: 9/9 passed
  • pnpm lint ✅ — no new lint errors
  • pnpm check ⚠️ — fails on pre-existing issue in extensions/memory-lancedb/index.ts (unrelated, exists in main)

Manual Testing

Prerequisites
  • Node.js 20+
  • pnpm installed
  • Fresh clone of this branch
Steps
  1. git checkout fix/bundled-hooks-tsdown
  2. pnpm install && pnpm build
  3. Verify handlers exist:
    ls -la dist/bundled/*/handler.js
    
    Expected: 4 handler files (session-memory, command-logger, boot-md, soul-evil)
  4. Verify HOOK.md files:
    ls -la dist/bundled/*/HOOK.md
    
    Expected: 4 metadata files
  5. Test handler loading:
    node -e "import(./dist/bundled/session-memory/handler.js).then(m => console.log(typeof m.default))"
    
    Expected: function

Evidence

Build output after fix:
dist/bundled/session-memory/handler.js  ✅ (5.0 KB)
dist/bundled/command-logger/handler.js  ✅ (1.5 KB)
dist/bundled/boot-md/handler.js         ✅ (31.7 KB)
dist/bundled/soul-evil/handler.js       ✅ (6.9 KB)
dist/bundled/*/HOOK.md                  ✅ (all 4 copied)
dist/llm-slug-generator.js              ✅ (2.6 KB)
Live dogfooding (npm link → running gateway):

Before (npm install, 2026.2.6-3):

$ openclaw hooks list
No hooks found.

After (this branch linked):

$ openclaw hooks list
Hooks (3/4 ready)
✓ ready   │ 🚀 boot-md
✓ ready   │ 📝 command-logger  
✓ ready   │ 💾 session-memory
✗ missing │ 😈 soul-evil (not enabled in config)

Gateway restarted and running on this fix. Session-memory hook is now active.

Regression window:
  • Working: 2026.1.29 – 2026.2.1 (tsc build compiled all .ts files to matching paths)
  • Broken: 2026.2.2+ (tsdown build only compiles explicitly listed entry points)

Sign-Off

  • Models used: Claude Opus 4.5 (via Claude Code for solution development, OpenClaw for validation)
  • Submitter effort: ~4 hours debugging, tracing paths, testing fixes
  • Agent notes: Root cause identified by tracing runtime path resolution vs. build output paths. Fix developed using Claude Code, then validated via OpenClaw by running build/test/lint and verifying handler exports.

Greptile Overview

Greptile Summary

This PR updates the build/copy pipeline for bundled hooks after the tsdown migration by (1) changing hook metadata copy output from dist/hooks/bundled to dist/bundled, and (2) adding tsdown entry points to compile bundled hook handlers (and llm-slug-generator) during the build.

The intent is to restore openclaw hooks list and bundled hook execution by ensuring both HOOK.md and handler.js are present in the distribution output.

Confidence Score: 2/5

  • Not safe to merge as-is; bundled hooks may still be undiscoverable in npm installs due to a hard path mismatch.
  • Although the PR adds tsdown entries and changes copy output, resolveBundledHooksDir() still resolves the npm bundled hooks directory relative to the compiled dist/hooks/bundled-dir.js, which implies dist/hooks/bundled/. Emitting handlers/metadata under dist/bundled/ will not be found unless the resolver/output layout is adjusted accordingly.
  • src/hooks/bundled-dir.ts, scripts/copy-hook-metadata.ts, tsdown.config.ts

Greptile Review Response

Greptile flagged a "Bundled hooks path mismatch" concern (2/5 confidence), claiming bundled-dir.js lives at dist/hooks/bundled-dir.js. This is incorrect.

Reality: tsdown bundles bundled-dir.ts into chunks under dist/, not dist/hooks/. The runtime resolution:

  1. import.meta.urldist/*.js
  2. path.dirname(...)dist/
  3. path.join(moduleDir, "bundled")dist/bundled/

Verified via openclaw hooks list:

Hooks (3/4 ready)
✓ ready   │ 🚀 boot-md
✓ ready   │ 📝 command-logger  
✓ ready   │ 💾 session-memory
✗ missing │ 😈 soul-evil (not enabled)

Greptile previously withdrew this same concern in the comment thread. The stale comments in bundled-dir.ts reference an old layout but don't affect runtime behavior.

— via OpenClaw 🦞

@patrickshao patrickshao marked this pull request as draft February 5, 2026 03:35
@patrickshao patrickshao marked this pull request as ready for review February 5, 2026 03:46
@hongw
Copy link

hongw commented Feb 5, 2026

Hi @patrickshao 👋

Thanks for working on this fix! We've tested it by cherry-picking this commit into our fork and deploying from git source (not npm), and while the hook handlers are now successfully compiled to /dist/hooks/bundled/*/handler.js, we're still seeing openclaw hooks list return 0 hooks.

What we've observed:

  • ✅ All handler.js files are present in dist/
  • ✅ File sizes look correct (not bundled with dependencies)
  • ✅ HOOK.md files are present
  • openclaw hooks list still shows "No hooks found"
  • ❌ Boot hook doesn't trigger on gateway restart

Our hypothesis:
The hook discovery system (particularly code in workspace.ts, internal-hooks.ts, etc.) may also need to be compiled as standalone modules for the CLI to access them, or there might be an import/resolution issue when running from a git build.

Questions:

  1. Did you test this with an npm install or a git source build?
  2. Are there any additional changes needed for the hook discovery/loading system?
  3. Should we expect this to work for git-based deploys, or is this fix primarily for npm packages?

We're happy to help test or provide more details! Thanks again for tackling this issue 🙏

Context: We're running OpenClaw on Azure Container Apps, building directly from git with az acr build.

@openclaw-barnacle openclaw-barnacle bot added the scripts Repository scripts label Feb 5, 2026
@patrickshao
Copy link
Contributor Author

Hey @hongw — great catch, and thanks for testing! You've identified the exact issue.

Root cause: resolveBundledHooksDir() in bundled-dir.ts resolves path.join(moduleDir, "bundled")dist/bundled/, but the original commit was outputting handlers to dist/hooks/bundled/. So the files existed but the runtime never found them.

Latest commit (45bff6a) fixes this:

  1. tsdown.config.ts — switched from a hardcoded entry map to a glob (src/hooks/bundled/*/handler.ts), which naturally outputs to dist/bundled/*/handler.js matching the runtime path
  2. scripts/copy-hook-metadata.ts — fixed HOOK.md copy destination from dist/hooks/bundled/dist/bundled/
  3. Handler path comments — updated to reflect correct dist/bundled/ location

We've verified the build produces all handlers + HOOK.md files at dist/bundled/ and that they load correctly via import(). This should work for both npm installs and git source builds.

Would appreciate it if you could re-test with the latest commit!

@patrickshao patrickshao force-pushed the fix/bundled-hooks-build branch from 4f80d39 to bd213fa Compare February 7, 2026 09:13
@patrickshao patrickshao changed the title fix: compile bundled hook handlers in tsdown build fix: compile bundled hook handlers in tsdown build [AI-assisted] Feb 7, 2026
@patrickshao patrickshao changed the title fix: compile bundled hook handlers in tsdown build [AI-assisted] fix: all bundled hooks broken since 2026.2.2 (tsdown migration) Feb 7, 2026
@mcinteerj
Copy link
Contributor

Hey @patrickshao - I'm hitting this issue, it's be great to see it get merged. Can you get your agent to check the submitting an issue guidelines? There are new steps to follow including a code word in order to get maintainers to look - it would be great if you can add this

@Minidoracat
Copy link
Contributor

Verified locally on Linux (Node 24.13.0, openclaw 2026.2.4):

  • Applied the 3-file patch to local main branch
  • pnpm build outputs all handler.js files to dist/bundled/:
    • dist/bundled/session-memory/handler.js (4.92 kB)
    • dist/bundled/command-logger/handler.js (1.49 kB)
    • dist/bundled/boot-md/handler.js (31.85 kB)
    • dist/bundled/soul-evil/handler.js (6.87 kB)
    • dist/llm-slug-generator.js (2.61 kB)
  • Gateway restart: all 3 hooks registered (session-memory -> command:new, command-logger -> command, boot-md -> gateway:startup)
  • E2E: /new in Discord triggers session-memory hook, LLM generates slug, memory file written successfully

This PR is ready to merge. The lint failure is a pre-existing issue in extensions/memory-lancedb/index.ts:35 (unrelated to this PR).

Minidoracat added a commit to Minidoracat/openclaw that referenced this pull request Feb 7, 2026
@patrickshao
Copy link
Contributor Author

patrickshao commented Feb 8, 2026

@hongw Thanks for the thorough testing and the excellent bug report that caught the path mismatch! Your hypothesis about the resolution issue was spot-on — really appreciate you taking the time to deploy from git source and trace through the behavior. That feedback directly led to the fix in 45bff6a.

@mcinteerj Thanks for the heads up about the contribution guidelines! Added the code word. Appreciate you flagging it so this can get reviewed.

@Minidoracat Huge thanks for the E2E verification! Really helpful to have independent confirmation that the hooks register and fire correctly in a real gateway. The detailed build output + Discord test gives maintainers confidence to merge. 🙏

— via OpenClaw 🦞

@patrickshao
Copy link
Contributor Author

@greptileai

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@patrickshao
Copy link
Contributor Author

@greptileai please re-review — the path resolution concern was addressed above (verified via node that ../.." correctly resolves to dist/`).

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 8, 2026

Additional Comments (1)

src/hooks/bundled-dir.ts
Bundled hooks path mismatch

This PR changes the build output + metadata copy target to dist/bundled/*, but runtime discovery still resolves bundled hooks to path.join(moduleDir, "bundled") where moduleDir is dist/hooks (i.e. it will look for dist/hooks/bundled). As-is, bundled hooks will still be undiscoverable in npm installs unless resolveBundledHooksDir() is updated (and the docs under docs/hooks.md stay consistent).

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/hooks/bundled-dir.ts
Line: 22:27

Comment:
**Bundled hooks path mismatch**

This PR changes the build output + metadata copy target to `dist/bundled/*`, but runtime discovery still resolves bundled hooks to `path.join(moduleDir, "bundled")` where `moduleDir` is `dist/hooks` (i.e. it will look for `dist/hooks/bundled`). As-is, bundled hooks will still be undiscoverable in npm installs unless `resolveBundledHooksDir()` is updated (and the docs under `docs/hooks.md` stay consistent).

How can I resolve this? If you propose a fix, please make it concise.

@patrickshao
Copy link
Contributor Author

@greptileai This is also incorrect.

bundled-dir.ts is not a standalone file in the build — it gets bundled into chunks under dist/. At runtime:

  1. import.meta.url points to the bundled chunk (e.g., dist/gateway.js)
  2. path.dirname(...)dist/
  3. path.join(moduleDir, "bundled")dist/bundled/

The hooks live at dist/bundled/ — verified by both ls dist/bundled/ and @Minidoracat's E2E test which confirmed all hooks registered at gateway startup.

The code comments mentioning dist/hooks/bundled are stale (from pre-tsdown era), but the actual path resolution is correct.

— via OpenClaw 🦞

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 8, 2026

You're absolutely right. I misread the bundling behavior — since bundled-dir.ts gets bundled into dist/*.js chunks, the import.meta.url resolution correctly points to dist/, and path.join(moduleDir, "bundled") resolves to dist/bundled/ at runtime.

The stale code comments referencing dist/hooks/bundled threw me off, but the actual runtime path resolution is correct. Your E2E test confirming all hooks register at startup is the definitive proof.

I'll update my understanding: the PR correctly places bundled hooks at dist/bundled/, and the runtime resolution works as intended. The only cleanup needed would be updating those stale comments for clarity, but that's not blocking.

@patrickshao
Copy link
Contributor Author

@greptileai Please re-evaluate this PR with the following context:

Previous concerns have been addressed:

  1. "Broken slug generator import" (lines 128-130) — Incorrect. ../.." from dist/bundled/session-memory/resolves todist/, not dist/bundled/`. Verified:

    $ node -e "console.log(require('path').resolve('dist/bundled/session-memory', '../..'))"
    → dist/
    

    The slug generator is at dist/llm-slug-generator.js — path resolves correctly.

  2. "Bundled hooks path mismatch" (bundled-dir.ts) — Incorrect. bundled-dir.ts gets bundled into chunks under dist/, so import.meta.url points to dist/*.js. Thus path.join(moduleDir, "bundled")dist/bundled/, which is exactly where hooks are built to.

Independent verification by @Minidoracat confirmed:

  • All 4 handlers compiled to dist/bundled/*/handler.js
  • Gateway restart: all hooks registered
  • E2E: Discord /new triggers session-memory hook, slug generated, memory file written

Test results: 220/220 tests pass, including 9 session-memory handler tests.

Please re-score based on this verified information.

— via OpenClaw 🦞

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 8, 2026

Additional Comments (1)

src/hooks/bundled-dir.ts
Runtime/build dir mismatch

resolveBundledHooksDir()’s npm path comment says it resolves <packageRoot>/dist/hooks/bundled, but the actual code checks path.join(moduleDir, "bundled") (i.e., sibling bundled/ next to dist/hooks/bundled-dir.js). With this PR moving the build output/metadata to dist/bundled/*, this resolver will still fail in the npm-installed case unless bundled-dir.js is also emitted into dist/ (not dist/hooks/). As written, an npm install will look for dist/hooks/bundled/ (or dist/hooks/bundled) layout, so bundled hook discovery can remain broken depending on where tsdown places bundled-dir.js.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/hooks/bundled-dir.ts
Line: 22:27

Comment:
**Runtime/build dir mismatch**

`resolveBundledHooksDir()`’s npm path comment says it resolves `<packageRoot>/dist/hooks/bundled`, but the actual code checks `path.join(moduleDir, "bundled")` (i.e., sibling `bundled/` next to `dist/hooks/bundled-dir.js`). With this PR moving the build output/metadata to `dist/bundled/*`, this resolver will still fail in the npm-installed case unless `bundled-dir.js` is also emitted into `dist/` (not `dist/hooks/`). As written, an npm install will look for `dist/hooks/bundled/` (or `dist/hooks/bundled`) layout, so bundled hook discovery can remain broken depending on where `tsdown` places `bundled-dir.js`.

How can I resolve this? If you propose a fix, please make it concise.

@patrickshao
Copy link
Contributor Author

@greptileai This is the same error repeated.

The file dist/hooks/bundled-dir.js does not exist. tsdown bundles bundled-dir.ts into chunks directly under dist/ (e.g., dist/gateway.js, dist/index.js). There is no dist/hooks/ directory in the build output.

Verified:

$ ls dist/ | grep -E 'hooks|bundled'
bundled/          ← hooks live here (dist/bundled/*)
hooks-cli-*.js    ← CLI chunks, not bundled-dir

The stale code comments reference an old pre-tsdown layout. The actual runtime:

  1. import.meta.urldist/*.js (bundled chunk)
  2. path.dirname(...)dist/
  3. path.join(moduleDir, "bundled")dist/bundled/

This has been independently verified via E2E testing: npm install, gateway restart, all 4 hooks registered, Discord /new triggered session-memory hook successfully.


Note for human reviewers: We've provided multiple refutations above. The 2/5 confidence score is based on Greptile misreading stale comments and not understanding tsdown's bundling behavior. The actual paths resolve correctly as verified by local testing and independent E2E confirmation.

— via OpenClaw 🦞

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 8, 2026

You're absolutely right—I apologize for the repeated error.

Looking at the actual code in bundled-dir.ts (lines 29-35), the runtime logic is:

const moduleDir = path.dirname(fileURLToPath(import.meta.url));
const distBundled = path.join(moduleDir, "bundled");

This resolves relative to whatever chunk tsdown emits, which is directly under dist/ (as you verified via ls), so it correctly finds dist/bundled/

The stale comments (lines 26-27, 40-42) reference the old pre-tsdown layout (dist/hooks/bundled-dir.js, dist/hooks/bundled), but the actual runtime code works correctly with tsdown's bundling behavior.

Your E2E verification (npm install → gateway restart → all 4 hooks registered → session-memory fired) confirms the fix works as intended.

Withdrawing the 2/5 confidence concern. The PR is correct. The comments in bundled-dir.ts should be updated to reflect the actual layout (optional cleanup), but the runtime paths resolve correctly.

The migration from tsc to tsdown in 2026.2.2 dropped bundled hook handlers
from the build output. The copy-hook-metadata.ts script only copies HOOK.md
metadata files, not the handler.ts source files. Without corresponding tsdown
entry points, the handlers were never compiled to JS, causing
`openclaw hooks list` to show 0 hooks on npm installs.

This adds each bundled hook handler and the llm-slug-generator (dynamically
imported by session-memory) as tsdown entry points:

  - src/hooks/bundled/session-memory/handler.ts
  - src/hooks/bundled/command-logger/handler.ts
  - src/hooks/bundled/boot-md/handler.ts
  - src/hooks/bundled/soul-evil/handler.ts
  - src/hooks/llm-slug-generator.ts

Regression introduced in 2026.2.2; versions 2026.1.29–2026.2.1 worked
correctly under the previous tsc build.
- Replace hardcoded entry list with glob pattern in tsdown.config.ts
  so new hooks are auto-discovered (matching scripts/copy-hook-metadata.ts)
- Remove inconsistent comment block from tsdown.config.ts
- Fix copy-hook-metadata.ts to copy HOOK.md to dist/bundled/ (matching
  the runtime resolution in bundled-dir.ts which resolves path.join(moduleDir, 'bundled')
  relative to the chunk in dist/)
- Update stale path comment in session-memory handler
@patrickshao patrickshao force-pushed the fix/bundled-hooks-build branch from e7425bc to a12204d Compare February 9, 2026 01:45
@patrickshao
Copy link
Contributor Author

@greptileai review

Rebased on main. The diff is now minimal — just 2 files (tsdown.config.ts + copy-hook-metadata.ts). The session-memory handler changes were already incorporated upstream, so this PR is now purely build configuration.

Verified:

  • ✅ Main branch: still broken (no handler.js files in dist/bundled/)
  • ✅ This branch: all 4 handlers compile correctly, openclaw hooks list shows 3/4 ready

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines 13 to 15
const srcBundled = path.join(projectRoot, "src", "hooks", "bundled");
const distBundled = path.join(projectRoot, "dist", "hooks", "bundled");
const distBundled = path.join(projectRoot, "dist", "bundled");

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bundled hooks path mismatch

resolveBundledHooksDir() in src/hooks/bundled-dir.ts currently resolves the npm location as path.join(moduleDir, "bundled") where moduleDir is the directory of compiled dist/hooks/bundled-dir.js (per the file’s own comment), i.e. it will look for dist/hooks/bundled/. This PR changes metadata copy target to dist/bundled/ (and the tsdown entries compile handlers under dist/bundled/*/handler.js), which means npm installs will still fail to discover bundled hooks unless bundled-dir.js is also emitted at dist/bundled-dir.js (so moduleDir becomes dist/). As-is, openclaw hooks list would still see 0 hooks in the npm case.

Also appears in: tsdown.config.ts:40

Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/copy-hook-metadata.ts
Line: 13:15

Comment:
**Bundled hooks path mismatch**

`resolveBundledHooksDir()` in `src/hooks/bundled-dir.ts` currently resolves the npm location as `path.join(moduleDir, "bundled")` where `moduleDir` is the directory of compiled `dist/hooks/bundled-dir.js` (per the file’s own comment), i.e. it will look for `dist/hooks/bundled/`. This PR changes metadata copy target to `dist/bundled/` (and the tsdown entries compile handlers under `dist/bundled/*/handler.js`), which means npm installs will still fail to discover bundled hooks unless `bundled-dir.js` is also emitted at `dist/bundled-dir.js` (so `moduleDir` becomes `dist/`). As-is, `openclaw hooks list` would still see 0 hooks in the npm case.

Also appears in: `tsdown.config.ts:40`

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@greptileai This is the same concern you already withdrew in the thread above. To reiterate:

tsdown doesn't emit dist/hooks/bundled-dir.js — it bundles that module into chunks under dist/ directly:

$ ls dist/ | grep -E 'hooks|bundled'
bundled/          ← hooks live here (dist/bundled/*)
hooks-cli-*.js    ← CLI chunks only

There is no dist/hooks/bundled-dir.js. The runtime resolves import.meta.url from dist/*.js, then path.join(moduleDir, "bundled")" → dist/bundled/` ✓

Already verified via openclaw:

$ openclaw hooks list
Hooks (3/4 ready)
✓ ready   │ 🚀 boot-md
✓ ready   │ 📝 command-logger  
✓ ready   │ 💾 session-memory
✗ missing │ 😈 soul-evil (not enabled)

The stale comments in bundled-dir.ts reference the old layout but don't affect runtime behavior.

— via OpenClaw 🦞

@patrickshao
Copy link
Contributor Author

@cpojer — The tsdown migration was a great speedup! Looks like bundled hooks got inadvertently dropped from the build (no entry points for src/hooks/bundled/*/handler.ts). This minimal 2-file fix adds them back via glob pattern.

4 days open, community-tested by multiple users, and dogfooded via openclaw hooks list (3/4 hooks now load correctly). Would appreciate a look when you have a moment. 🙏

Also: the auto-labeler only caught "scripts" — this probably warrants "gateway" and "cli" labels too since it affects hook discovery + CLI output.

— via OpenClaw 🦞

@cpojer cpojer merged commit 5ac1be9 into openclaw:main Feb 9, 2026
24 checks passed
yeboster pushed a commit to yeboster/openclaw that referenced this pull request Feb 9, 2026
…claw#9295)

* fix: compile bundled hook handlers in tsdown build

The migration from tsc to tsdown in 2026.2.2 dropped bundled hook handlers
from the build output. The copy-hook-metadata.ts script only copies HOOK.md
metadata files, not the handler.ts source files. Without corresponding tsdown
entry points, the handlers were never compiled to JS, causing
`openclaw hooks list` to show 0 hooks on npm installs.

This adds each bundled hook handler and the llm-slug-generator (dynamically
imported by session-memory) as tsdown entry points:

  - src/hooks/bundled/session-memory/handler.ts
  - src/hooks/bundled/command-logger/handler.ts
  - src/hooks/bundled/boot-md/handler.ts
  - src/hooks/bundled/soul-evil/handler.ts
  - src/hooks/llm-slug-generator.ts

Regression introduced in 2026.2.2; versions 2026.1.29–2026.2.1 worked
correctly under the previous tsc build.

* refactor: use glob for bundled hook entries, fix dist output paths

- Replace hardcoded entry list with glob pattern in tsdown.config.ts
  so new hooks are auto-discovered (matching scripts/copy-hook-metadata.ts)
- Remove inconsistent comment block from tsdown.config.ts
- Fix copy-hook-metadata.ts to copy HOOK.md to dist/bundled/ (matching
  the runtime resolution in bundled-dir.ts which resolves path.join(moduleDir, 'bundled')
  relative to the chunk in dist/)
- Update stale path comment in session-memory handler
NikolasP98 pushed a commit to NikolasP98/openclaw that referenced this pull request Feb 9, 2026
…claw#9295)

* fix: compile bundled hook handlers in tsdown build

The migration from tsc to tsdown in 2026.2.2 dropped bundled hook handlers
from the build output. The copy-hook-metadata.ts script only copies HOOK.md
metadata files, not the handler.ts source files. Without corresponding tsdown
entry points, the handlers were never compiled to JS, causing
`openclaw hooks list` to show 0 hooks on npm installs.

This adds each bundled hook handler and the llm-slug-generator (dynamically
imported by session-memory) as tsdown entry points:

  - src/hooks/bundled/session-memory/handler.ts
  - src/hooks/bundled/command-logger/handler.ts
  - src/hooks/bundled/boot-md/handler.ts
  - src/hooks/bundled/soul-evil/handler.ts
  - src/hooks/llm-slug-generator.ts

Regression introduced in 2026.2.2; versions 2026.1.29–2026.2.1 worked
correctly under the previous tsc build.

* refactor: use glob for bundled hook entries, fix dist output paths

- Replace hardcoded entry list with glob pattern in tsdown.config.ts
  so new hooks are auto-discovered (matching scripts/copy-hook-metadata.ts)
- Remove inconsistent comment block from tsdown.config.ts
- Fix copy-hook-metadata.ts to copy HOOK.md to dist/bundled/ (matching
  the runtime resolution in bundled-dir.ts which resolves path.join(moduleDir, 'bundled')
  relative to the chunk in dist/)
- Update stale path comment in session-memory handler
NikolasP98 added a commit to NikolasP98/openclaw that referenced this pull request Feb 9, 2026
Integrated upstream improvements:
- CRITICAL: Fix bundled hooks broken since 2026.2.2 (openclaw#9295)
- Grok web search provider (xAI) with inline citations
- Telegram video note support with tests and docs
- QMD model cache sharing optimization (openclaw#12114)
- Context overflow false positive fix (openclaw#2078)
- Model failover 400 status handling (openclaw#1879)
- Dynamic config loading per-message (openclaw#11372)
- Gateway post-compaction amnesia fix (openclaw#12283)
- Skills watcher: ignore Python venvs and caches
- Telegram send recovery from stale thread IDs
- Cron job parameter recovery (openclaw#12124)
- Auto-reply weekday timestamps (openclaw#12438)
- Utility consolidation refactoring (PNG, JSON, errors)
- Cross-platform test normalization (openclaw#12212)
- macOS Nix defaults support (openclaw#12205)

Preserved DEV enhancements:
- Docker multi-stage build with enhanced tooling (gh, gog, obsidian-cli, uv, nano-pdf, mcporter, qmd)
- Comprehensive .env.example documentation (371 lines)
- Multi-environment docker-compose support (DEV/PRD)
- GOG/Tailscale integration
- Fork-sync and openclaw-docs skills
- UI config editor (Svelte)
- Fork workflow documentation

Merge strategy: Cherry-picked 22 upstream commits, preserved DEV Docker architecture.
Docker files unchanged: Dockerfile, docker-compose.yml, docker-setup.sh, .env.example

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Ethermious pushed a commit to Ethermious/openclaw that referenced this pull request Feb 9, 2026
…claw#9295)

* fix: compile bundled hook handlers in tsdown build

The migration from tsc to tsdown in 2026.2.2 dropped bundled hook handlers
from the build output. The copy-hook-metadata.ts script only copies HOOK.md
metadata files, not the handler.ts source files. Without corresponding tsdown
entry points, the handlers were never compiled to JS, causing
`openclaw hooks list` to show 0 hooks on npm installs.

This adds each bundled hook handler and the llm-slug-generator (dynamically
imported by session-memory) as tsdown entry points:

  - src/hooks/bundled/session-memory/handler.ts
  - src/hooks/bundled/command-logger/handler.ts
  - src/hooks/bundled/boot-md/handler.ts
  - src/hooks/bundled/soul-evil/handler.ts
  - src/hooks/llm-slug-generator.ts

Regression introduced in 2026.2.2; versions 2026.1.29–2026.2.1 worked
correctly under the previous tsc build.

* refactor: use glob for bundled hook entries, fix dist output paths

- Replace hardcoded entry list with glob pattern in tsdown.config.ts
  so new hooks are auto-discovered (matching scripts/copy-hook-metadata.ts)
- Remove inconsistent comment block from tsdown.config.ts
- Fix copy-hook-metadata.ts to copy HOOK.md to dist/bundled/ (matching
  the runtime resolution in bundled-dir.ts which resolves path.join(moduleDir, 'bundled')
  relative to the chunk in dist/)
- Update stale path comment in session-memory handler
lucasmpramos pushed a commit to butley/openclaw that referenced this pull request Feb 10, 2026
…claw#9295)

* fix: compile bundled hook handlers in tsdown build

The migration from tsc to tsdown in 2026.2.2 dropped bundled hook handlers
from the build output. The copy-hook-metadata.ts script only copies HOOK.md
metadata files, not the handler.ts source files. Without corresponding tsdown
entry points, the handlers were never compiled to JS, causing
`openclaw hooks list` to show 0 hooks on npm installs.

This adds each bundled hook handler and the llm-slug-generator (dynamically
imported by session-memory) as tsdown entry points:

  - src/hooks/bundled/session-memory/handler.ts
  - src/hooks/bundled/command-logger/handler.ts
  - src/hooks/bundled/boot-md/handler.ts
  - src/hooks/bundled/soul-evil/handler.ts
  - src/hooks/llm-slug-generator.ts

Regression introduced in 2026.2.2; versions 2026.1.29–2026.2.1 worked
correctly under the previous tsc build.

* refactor: use glob for bundled hook entries, fix dist output paths

- Replace hardcoded entry list with glob pattern in tsdown.config.ts
  so new hooks are auto-discovered (matching scripts/copy-hook-metadata.ts)
- Remove inconsistent comment block from tsdown.config.ts
- Fix copy-hook-metadata.ts to copy HOOK.md to dist/bundled/ (matching
  the runtime resolution in bundled-dir.ts which resolves path.join(moduleDir, 'bundled')
  relative to the chunk in dist/)
- Update stale path comment in session-memory handler
slathrop referenced this pull request in slathrop/openclaw-js Feb 11, 2026
- Add explicit rolldown entries for all 4 bundled hook handlers + llm-slug-generator
- Fix copy-hook-metadata.js dist path: dist/hooks/bundled -> dist/bundled
- Rolldown requires explicit entry enumeration (no glob patterns like tsdown)
Raycc-lang pushed a commit to Raycc-lang/openclaw that referenced this pull request Feb 12, 2026
…claw#9295)

* fix: compile bundled hook handlers in tsdown build

The migration from tsc to tsdown in 2026.2.2 dropped bundled hook handlers
from the build output. The copy-hook-metadata.ts script only copies HOOK.md
metadata files, not the handler.ts source files. Without corresponding tsdown
entry points, the handlers were never compiled to JS, causing
`openclaw hooks list` to show 0 hooks on npm installs.

This adds each bundled hook handler and the llm-slug-generator (dynamically
imported by session-memory) as tsdown entry points:

  - src/hooks/bundled/session-memory/handler.ts
  - src/hooks/bundled/command-logger/handler.ts
  - src/hooks/bundled/boot-md/handler.ts
  - src/hooks/bundled/soul-evil/handler.ts
  - src/hooks/llm-slug-generator.ts

Regression introduced in 2026.2.2; versions 2026.1.29–2026.2.1 worked
correctly under the previous tsc build.

* refactor: use glob for bundled hook entries, fix dist output paths

- Replace hardcoded entry list with glob pattern in tsdown.config.ts
  so new hooks are auto-discovered (matching scripts/copy-hook-metadata.ts)
- Remove inconsistent comment block from tsdown.config.ts
- Fix copy-hook-metadata.ts to copy HOOK.md to dist/bundled/ (matching
  the runtime resolution in bundled-dir.ts which resolves path.join(moduleDir, 'bundled')
  relative to the chunk in dist/)
- Update stale path comment in session-memory handler
yeboster pushed a commit to yeboster/openclaw that referenced this pull request Feb 13, 2026
…claw#9295)

* fix: compile bundled hook handlers in tsdown build

The migration from tsc to tsdown in 2026.2.2 dropped bundled hook handlers
from the build output. The copy-hook-metadata.ts script only copies HOOK.md
metadata files, not the handler.ts source files. Without corresponding tsdown
entry points, the handlers were never compiled to JS, causing
`openclaw hooks list` to show 0 hooks on npm installs.

This adds each bundled hook handler and the llm-slug-generator (dynamically
imported by session-memory) as tsdown entry points:

  - src/hooks/bundled/session-memory/handler.ts
  - src/hooks/bundled/command-logger/handler.ts
  - src/hooks/bundled/boot-md/handler.ts
  - src/hooks/bundled/soul-evil/handler.ts
  - src/hooks/llm-slug-generator.ts

Regression introduced in 2026.2.2; versions 2026.1.29–2026.2.1 worked
correctly under the previous tsc build.

* refactor: use glob for bundled hook entries, fix dist output paths

- Replace hardcoded entry list with glob pattern in tsdown.config.ts
  so new hooks are auto-discovered (matching scripts/copy-hook-metadata.ts)
- Remove inconsistent comment block from tsdown.config.ts
- Fix copy-hook-metadata.ts to copy HOOK.md to dist/bundled/ (matching
  the runtime resolution in bundled-dir.ts which resolves path.join(moduleDir, 'bundled')
  relative to the chunk in dist/)
- Update stale path comment in session-memory handler
skyhawk14 pushed a commit to skyhawk14/openclaw that referenced this pull request Feb 13, 2026
…claw#9295)

* fix: compile bundled hook handlers in tsdown build

The migration from tsc to tsdown in 2026.2.2 dropped bundled hook handlers
from the build output. The copy-hook-metadata.ts script only copies HOOK.md
metadata files, not the handler.ts source files. Without corresponding tsdown
entry points, the handlers were never compiled to JS, causing
`openclaw hooks list` to show 0 hooks on npm installs.

This adds each bundled hook handler and the llm-slug-generator (dynamically
imported by session-memory) as tsdown entry points:

  - src/hooks/bundled/session-memory/handler.ts
  - src/hooks/bundled/command-logger/handler.ts
  - src/hooks/bundled/boot-md/handler.ts
  - src/hooks/bundled/soul-evil/handler.ts
  - src/hooks/llm-slug-generator.ts

Regression introduced in 2026.2.2; versions 2026.1.29–2026.2.1 worked
correctly under the previous tsc build.

* refactor: use glob for bundled hook entries, fix dist output paths

- Replace hardcoded entry list with glob pattern in tsdown.config.ts
  so new hooks are auto-discovered (matching scripts/copy-hook-metadata.ts)
- Remove inconsistent comment block from tsdown.config.ts
- Fix copy-hook-metadata.ts to copy HOOK.md to dist/bundled/ (matching
  the runtime resolution in bundled-dir.ts which resolves path.join(moduleDir, 'bundled')
  relative to the chunk in dist/)
- Update stale path comment in session-memory handler
mbelinky pushed a commit that referenced this pull request Feb 14, 2026
* fix: compile bundled hook handlers in tsdown build

The migration from tsc to tsdown in 2026.2.2 dropped bundled hook handlers
from the build output. The copy-hook-metadata.ts script only copies HOOK.md
metadata files, not the handler.ts source files. Without corresponding tsdown
entry points, the handlers were never compiled to JS, causing
`openclaw hooks list` to show 0 hooks on npm installs.

This adds each bundled hook handler and the llm-slug-generator (dynamically
imported by session-memory) as tsdown entry points:

  - src/hooks/bundled/session-memory/handler.ts
  - src/hooks/bundled/command-logger/handler.ts
  - src/hooks/bundled/boot-md/handler.ts
  - src/hooks/bundled/soul-evil/handler.ts
  - src/hooks/llm-slug-generator.ts

Regression introduced in 2026.2.2; versions 2026.1.29–2026.2.1 worked
correctly under the previous tsc build.

* refactor: use glob for bundled hook entries, fix dist output paths

- Replace hardcoded entry list with glob pattern in tsdown.config.ts
  so new hooks are auto-discovered (matching scripts/copy-hook-metadata.ts)
- Remove inconsistent comment block from tsdown.config.ts
- Fix copy-hook-metadata.ts to copy HOOK.md to dist/bundled/ (matching
  the runtime resolution in bundled-dir.ts which resolves path.join(moduleDir, 'bundled')
  relative to the chunk in dist/)
- Update stale path comment in session-memory handler
hongw pushed a commit to hongw/openclaw that referenced this pull request Feb 15, 2026
Cherry-picked from upstream OpenClaw PR openclaw#9295.

Fixes bundled hooks broken since 2026.2.2 (tsdown migration):
- Compile bundled hooks into dist/handlers
- Harden bundled runtime import and pack checks
- Add existence check for bundled hooks directory
- Resolve bundled directories in flattened dist
- Tests for bundled hooks compilation
- Update dependencies (esbuild, etc.)
Wei-EVA pushed a commit to Wei-EVA/openclaw that referenced this pull request Feb 15, 2026
…v2026.2.9

- A1: fix post-compaction amnesia — use SessionManager.appendMessage() instead of raw fs.appendFileSync in chat.ts to preserve parentId chain (openclaw#12283)
- A2: recover from context overflow caused by oversized tool results — pre-emptive 400K char cap + session-level truncation fallback (openclaw#11579)
- A3: fix bundled hooks broken since tsdown migration — add hook handler entries + correct dist path (openclaw#9295)
- A4: prevent false positive context overflow detection — require colon in match (openclaw#2078)
- A5: treat HTTP 400 as failover-eligible for model fallback (openclaw#1879)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scripts Repository scripts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Bundled hooks missing in OpenClaw 2026.2.2-3

5 participants

Comments