mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
PR #8438 (session-dedup OOM-guard rewrite) was built against a stale local copy of scoring.ts/autoStrategy.ts predating #8008 and #7301: merging it as-is silently deleted the cacheAffinity scoring factor + normalizeScoringWeights (#8008), the cached getCachedProviderConnections read path, and the #COMBO-REF candidate-pool guard (#7301), breaking the TypeScript build. Restore all three while keeping the PR's own legitimate additions (computePoolMaxima/PoolMaxima pool-maxima memoization). Also fix a real perf regression the PR introduced in session-dedup's single-message intra-dedup path: dedupeWithinMessage dynamically built and ran a global RegExp per candidate suffix block to count/replace occurrences, which is pathologically slow on large single-message inputs (the exact "huge tool result" shape the #7849 O(n^2) guard targets). Replace it with indexOf-based counting/replacement (same semantics, no regex compile/match overhead). Update the #7849 regression suite's assertions to match the new MAX_SUFFIX_STARTS/MAX_TOTAL_BLOCK_BYTES bound (which truncates suffix-block enumeration silently/best-effort instead of failing the whole request open with the old "suffix work budget exceeded" warning) instead of asserting on the removed shared-budget mechanism. Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>