#11143: fix: clear jiti cache on SIGUSR1 restart
cli
stale
Cluster:
Gateway and System Fixes
## Problem
TypeScript plugins compiled via jiti cache their output to disk. This cache persists across SIGUSR1 restarts, causing modified plugins to not take effect until the cache is manually cleared.
This is a footgun for anyone developing or modifying plugins — changes appear to not work, leading to confusion.
## Solution
1. **Use an OpenClaw-specific cache directory** (`~/.openclaw/cache/jiti`) instead of the shared `/tmp/jiti`
2. **Clear this cache before restarting** the gateway on SIGUSR1
This ensures:
- Plugin changes are always picked up on restart
- We don't affect other processes that may share `/tmp/jiti` on the same system
- Normal startup performance is unaffected (cache only cleared on restart, not first start)
## Changes
- `src/plugins/loader.ts`: Export `OPENCLAW_JITI_CACHE_DIR` constant and configure jiti to use it
- `src/cli/gateway-cli/run-loop.ts`: Clear the OpenClaw-specific cache directory on SIGUSR1 restart
## Testing
- [x] Build passes
- [x] Lint passes
- [x] Manual verification: modified plugin, restarted, changes took effect without manual cache clear
Most Similar PRs
#9156: fix(status): refresh version/commit on gateway restart
by gavinbmoore · 2026-02-04
66.2%
#9603: fix: initialize global hook runner on plugin registry cache hit
by kevins88288 · 2026-02-05
61.6%
#12475: fix(logging): use Symbol.for for externalTransports to survive jiti...
by Yida-Dev · 2026-02-09
60.7%
#13840: perf(cli): skip plugin loading during completion generation
by lailoo · 2026-02-11
60.4%
#13127: perf(gateway): reduce idle CPU by increasing config and manifest ca...
by VintLin · 2026-02-10
60.1%
#15611: fix(gateway): invalidate hook transform cache on config reload
by AI-Reviewer-QS · 2026-02-13
60.1%
#17657: fix: clear QMD manager cache on in-process restart (SIGUSR1)
by IrriVisionTechnologies · 2026-02-16
59.8%
#13109: fix(plugins): inject globalThis.require for CJS interop in jiti-loa...
by mcaxtr · 2026-02-10
59.7%
#20541: fix(hooks): clear internal hooks before plugins register
by ramarnat · 2026-02-19
59.5%
#9460: fix(gateway): clean up lock file on service stop
by zenchantlive · 2026-02-05
58.8%