Skip to content

fix(autoCombo): match longest pattern first in lookupStaticFitnessTable (#8603) - #8651

Merged
diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.49from
Dingding-leo:pr/fix-lookup-static-fitness-table-8603
Jul 27, 2026
Merged

diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.49from
Dingding-leo:pr/fix-lookup-static-fitness-table-8603

Conversation

@Dingding-leo

Copy link
Copy Markdown
Contributor

Summary

Fixes #8603 (static table lookup pattern matching order).

Changes

  • Sort FITNESS_TABLE pattern entries by length descending before substring matching in lookupStaticFitnessTable().
  • Ensures specific model variants (e.g. gpt-4o-mini) match their exact score (0.8) rather than incorrectly falling through to shorter prefix keys like gpt-4o (0.9).
  • Added unit test in open-sse/services/autoCombo/__tests__/autoCombo.test.ts.

…le (#8603)

Sort FITNESS_TABLE pattern keys by length descending so specific model variants (e.g. gpt-4o-mini) match before broader prefixes (e.g. gpt-4o).
Copilot AI review requested due to automatic review settings July 26, 2026 08:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Hi @Dingding-leo — longest-pattern-first in lookupStaticFitnessTable is the right ordering, same fix as the regex matching pattern. Just confirm the sort is stable and bounded (no ReDoS on pathological inputs).

Approved as merge-ready (★3). /merge-prs will pick it up.

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Validated in local merge-train /tmp/train1d-20260727-090022-suite.log on .113 @ 029cdf4215cf465f0e1716ac9f84a84692b1e881 (full unit suite green on CI-equivalent host)

@diegosouzapw
diegosouzapw merged commit 9f5be22 into cheaper-inference:release/v3.8.49 Jul 27, 2026
14 of 15 checks passed
@diegosouzapw diegosouzapw mentioned this pull request Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(backend): static fitness table substring match returns wrong row for longer model ids (gpt-4o-mini scores as gpt-4o)

3 participants