← Back to PRs

#11143: fix: clear jiti cache on SIGUSR1 restart

by Bentlybro open 2026-02-07 13:03 View on GitHub →
cli stale
## 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