mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-14 02:42:24 +03:00
* feat(compression): make proactive context-compression threshold a live setting The proactive compression trigger ratio was a hardcoded COMPRESSION_THRESHOLD = 0.7 in chatCore. Operators could not move compression relative to a client's own compaction point (e.g. Codex Desktop self-compacts at ~0.85 of its window, so the 0.7 proxy threshold always preempts the client's compaction with the proxy's lossier one — see #8932 for what that produced before 3.8.50). New: key_value namespace 'compression', key 'proactiveConfig', {"thresholdRatio": 0.7}. Clamped [0.1, 0.99], 30s TTL cache, ipFilter persistence pattern (#6131), synchronous read stays in the hot path. Default unchanged; missing/invalid rows fall back to 0.7. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * test(compression): cover the live proactive-compression threshold (read, validity bounds, fallback, TTL) Locks in getProactiveCompressionRatio() (src/lib/db/compression.ts), the key_value-backed replacement for chatCore's hardcoded 0.7: - shipped default 0.7 when no compression/proactiveConfig row exists - 30s TTL cache: a fresh DB write stays invisible until the TTL lapses (clock mocked via node:test mock timers, Date API — the module keeps its cache private with no reset hook) - valid override read from key_value, boundary values 0.1/0.99 included - out-of-range ratios fall back to the DEFAULT (a validity window, not clamping to the nearest bound — matching the shipped comment) - broken JSON / non-numeric thresholdRatio: 0.7, without throwing Guard verified by mutation: switching the window to clamping fails the out-of-range case. --------- Co-authored-by: root-cli (Hermes ops) <info@livewellwith.us> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>