fix(#3263): provider-compatible default match — reject same-bare-name on different providers (Codex over-match MUST-FIX)
Prior round stripped provider prefixes from both sides and matched bare-only, which over-matched: openai/gpt-4o would match default openrouter/gpt-4o. Now the matcher compares bare model ids AND rejects when both sides identify DIFFERENT providers (from provider/ prefix, @provider: qualifier, or the explicit provider arg). Same-provider / unknown-session-provider still match. Added cross-provider rejection regression tests. Co-authored-by: allenliang2022 <allenliang2022@users.noreply.github.com>
This commit is contained in:
1 parent
4147e7f3df
commit
7e9f674edf
2 files changed
+52
-21
No files matched your search
@@ -130,6 +130,17 @@ def test_default_match_distinct_models_do_not_match():
|
||||
assert _matcher()("gpt-5.5", "claude-opus-4.8", "openai") is False
|
||||
|
||||
|
||||
def test_default_match_same_bare_different_provider_does_NOT_match():
|
||||
"""Same bare model id on a DIFFERENT provider is NOT the configured default
|
||||
and must not receive its cap (Codex final-gate over-match finding)."""
|
||||
assert _matcher()("openai/gpt-4o", "openrouter/gpt-4o", "openai") is False
|
||||
assert _matcher()("@openai:gpt-4o", "@openrouter:gpt-4o") is False
|
||||
assert _matcher()("gpt-4o", "openrouter/gpt-4o", "openai") is False
|
||||
# but the SAME provider (or unknown session provider) still matches:
|
||||
assert _matcher()("openrouter/gpt-4o", "openrouter/gpt-4o") is True
|
||||
assert _matcher()("gpt-4o", "openrouter/gpt-4o", "openrouter") is True
|
||||
|
||||
|
||||
def test_default_match_empty_inputs_are_false():
|
||||
assert _matcher()("claude-opus-4.8", "") is False
|
||||
assert _matcher()("", "claude-opus-4.8") is False
|
||||
|
||||
Reference in new issue
Block a user