mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-19 21:32:20 +03:00
filterTargetsByRequestCompatibility ranked combo targets solely on the chars/4 estimateTokens() heuristic. On a repetitive agent-session body the estimate overstates real usage several-fold, so a manually-overridden primary sized correctly for the real request got marked context-incompatible and was reordered behind an unconfirmed catalog "emergency" member with a large but unverified limit_context. Fix: when the reorder branch promotes known-context-compatible targets, split them by whether their pass came from an operator-set model_context_override (trusted) or bare catalog metadata (advisory), and also trust a near-boundary override rejection (required tokens within 5x the override — covering the ~3.7x overestimate the issue measured) over a catalog-only pass. An override target keeps or regains priority over an unconfirmed catalog-only "known compatible" target; two override targets or two catalog-only targets keep resolving purely on their own fit as before. Regression test: tests/unit/combo-13870-chars4-overdrops-override-primary.test.ts (RED before the fix — emergency member promoted to position 0 ahead of the override primary; GREEN after). ⚠️ base-red inherited: #14004 — docs env/docs contract (fixed separately in #14022), chatHelpers file-size drift. Not touched by this branch.