github alexgreensh/token-optimizer v2.4.7
v2.4.7 - SessionEnd Fix + QA Hardening

latest releases: openclaw-v2.4.1, v5.6.4, v5.6.2...
one month ago

Bug Fixes (8)

  • SessionEnd hooks cancelled on exit — hooks now have async: true so they complete in the background instead of getting killed. Fixes #1.
  • cacheDir temporal dead zoneconst cacheDir was used before declaration in statusline.js. live-fill.json was never written, causing quality scores to silently fall back to less accurate char-count estimation. Fixed by moving declaration.
  • Hook duplication — plugin hooks.json and settings.json both registered the same commands, causing collect, dashboard, and quality-cache to run twice per event. Removed duplicates from settings.json; plugin hooks are now the single source of truth.
  • Statusline crash on out-of-range context % — negative or >100 used_percentage caused String.repeat() with negative count, silently killing the entire statusline. Fixed with clamping to [0, 100].
  • SQLite busy_timeout missing — all 4 sqlite3.connect() call sites now set PRAGMA busy_timeout=5000. Prevents SQLITE_BUSY errors during concurrent session endings.
  • Non-atomic live-fill.json write — replaced writeFileSync with tempfile + rename to prevent concurrent readers from seeing truncated JSON.
  • session_id path injection — session IDs are now sanitized to alphanumeric characters before use in filesystem paths.
  • SQLite connection leak_collect_trends_from_db() now uses try/finally to ensure connections are always closed.

New

  • /token-dashboard skill — one command to collect latest session data and open the dashboard in your browser.

Internal

  • setup_hook() and hooks-starter.json now include async: true for SessionEnd hooks.
  • Version synced across plugin.json and marketplace.json.

Don't miss a new token-optimizer release

NewReleases is sending notifications on new releases.