fix(xai): align migrate retirement map with docs
This commit is contained in:
@ -21,15 +21,13 @@ RETIREMENT_DATE = "May 15, 2026"
|
|||||||
# have a one-to-one replacement: ``grok-4.3`` reasons by default, so emulating
|
# have a one-to-one replacement: ``grok-4.3`` reasons by default, so emulating
|
||||||
# ``*-non-reasoning`` behavior on it requires ``reasoning_effort="none"``.
|
# ``*-non-reasoning`` behavior on it requires ``reasoning_effort="none"``.
|
||||||
_RETIRED_MODELS: Dict[str, Dict[str, Optional[str]]] = {
|
_RETIRED_MODELS: Dict[str, Dict[str, Optional[str]]] = {
|
||||||
"grok-4": {"replacement": "grok-4.3", "reasoning_effort": None, "note": "ambiguous (reasoning vs non-reasoning) — defaulting to grok-4.3"},
|
|
||||||
"grok-4-0709": {"replacement": "grok-4.3", "reasoning_effort": None, "note": None},
|
"grok-4-0709": {"replacement": "grok-4.3", "reasoning_effort": None, "note": None},
|
||||||
"grok-4-fast": {"replacement": "grok-4.3", "reasoning_effort": None, "note": "ambiguous variant — verify reasoning vs non-reasoning intent"},
|
|
||||||
"grok-4-fast-reasoning": {"replacement": "grok-4.3", "reasoning_effort": None, "note": None},
|
"grok-4-fast-reasoning": {"replacement": "grok-4.3", "reasoning_effort": None, "note": None},
|
||||||
"grok-4-fast-non-reasoning": {"replacement": "grok-4.3", "reasoning_effort": "none", "note": None},
|
"grok-4-fast-non-reasoning": {"replacement": "grok-4.3", "reasoning_effort": "none", "note": None},
|
||||||
"grok-4-1-fast": {"replacement": "grok-4.3", "reasoning_effort": None, "note": "ambiguous variant — verify reasoning vs non-reasoning intent"},
|
|
||||||
"grok-4-1-fast-reasoning": {"replacement": "grok-4.3", "reasoning_effort": None, "note": None},
|
"grok-4-1-fast-reasoning": {"replacement": "grok-4.3", "reasoning_effort": None, "note": None},
|
||||||
"grok-4-1-fast-non-reasoning": {"replacement": "grok-4.3", "reasoning_effort": "none", "note": None},
|
"grok-4-1-fast-non-reasoning": {"replacement": "grok-4.3", "reasoning_effort": "none", "note": None},
|
||||||
"grok-code-fast-1": {"replacement": "grok-4.3", "reasoning_effort": None, "note": None},
|
"grok-code-fast-1": {"replacement": "grok-4.3", "reasoning_effort": None, "note": None},
|
||||||
|
"grok-3": {"replacement": "grok-4.3", "reasoning_effort": None, "note": None},
|
||||||
"grok-imagine-image-pro": {"replacement": "grok-imagine-image-quality", "reasoning_effort": None, "note": None},
|
"grok-imagine-image-pro": {"replacement": "grok-imagine-image-quality", "reasoning_effort": None, "note": None},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ def trap_config(tmp_path: Path) -> Path:
|
|||||||
"auxiliary:\n"
|
"auxiliary:\n"
|
||||||
" vision:\n"
|
" vision:\n"
|
||||||
" provider: xai\n"
|
" provider: xai\n"
|
||||||
" model: grok-4-fast # retiring\n"
|
" model: grok-4-fast-reasoning # retiring\n"
|
||||||
" compression:\n"
|
" compression:\n"
|
||||||
" provider: openai # not affected\n"
|
" provider: openai # not affected\n"
|
||||||
" model: gpt-4o-mini\n"
|
" model: gpt-4o-mini\n"
|
||||||
@ -89,7 +89,7 @@ class TestNoOpPaths:
|
|||||||
apply_migration(tmp_path / "absent.yaml", issues=[
|
apply_migration(tmp_path / "absent.yaml", issues=[
|
||||||
RetirementIssue(
|
RetirementIssue(
|
||||||
config_path="principal.model",
|
config_path="principal.model",
|
||||||
current_model="grok-4",
|
current_model="grok-3",
|
||||||
replacement="grok-4.3",
|
replacement="grok-4.3",
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
|
|||||||
@ -87,7 +87,12 @@ class TestFindRetiredEdgeCases:
|
|||||||
def test_xai_valid_model_not_flagged(self):
|
def test_xai_valid_model_not_flagged(self):
|
||||||
cfg = {
|
cfg = {
|
||||||
"principal": {"model": "grok-4.3"},
|
"principal": {"model": "grok-4.3"},
|
||||||
"auxiliary": {"vision": {"model": "grok-4.20-0309-reasoning"}},
|
"auxiliary": {
|
||||||
|
"vision": {"model": "grok-4.20-0309-reasoning"},
|
||||||
|
"fast": {"model": "grok-4-fast"},
|
||||||
|
"fast_1": {"model": "grok-4-1-fast"},
|
||||||
|
"bare": {"model": "grok-4"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
assert find_retired_xai_refs(cfg) == []
|
assert find_retired_xai_refs(cfg) == []
|
||||||
|
|
||||||
@ -113,7 +118,7 @@ class TestFindRetiredPerSlot:
|
|||||||
def test_auxiliary_multiple_slots(self):
|
def test_auxiliary_multiple_slots(self):
|
||||||
cfg = {
|
cfg = {
|
||||||
"auxiliary": {
|
"auxiliary": {
|
||||||
"vision": {"model": "grok-4-fast"},
|
"vision": {"model": "grok-4-fast-reasoning"},
|
||||||
"compression": {"model": "grok-code-fast-1"},
|
"compression": {"model": "grok-code-fast-1"},
|
||||||
"curator": {"model": "grok-4.3"}, # not retired
|
"curator": {"model": "grok-4.3"}, # not retired
|
||||||
"approval": {"model": "gpt-4o-mini"}, # not xAI
|
"approval": {"model": "gpt-4o-mini"}, # not xAI
|
||||||
@ -126,7 +131,7 @@ class TestFindRetiredPerSlot:
|
|||||||
]
|
]
|
||||||
|
|
||||||
def test_auxiliary_unknown_slot_still_scanned(self):
|
def test_auxiliary_unknown_slot_still_scanned(self):
|
||||||
cfg = {"auxiliary": {"future_slot_xyz": {"model": "grok-4"}}}
|
cfg = {"auxiliary": {"future_slot_xyz": {"model": "grok-3"}}}
|
||||||
issues = find_retired_xai_refs(cfg)
|
issues = find_retired_xai_refs(cfg)
|
||||||
assert len(issues) == 1
|
assert len(issues) == 1
|
||||||
assert issues[0].config_path == "auxiliary.future_slot_xyz.model"
|
assert issues[0].config_path == "auxiliary.future_slot_xyz.model"
|
||||||
@ -157,9 +162,9 @@ class TestFindRetiredPerSlot:
|
|||||||
def test_full_trap_config(self):
|
def test_full_trap_config(self):
|
||||||
cfg = {
|
cfg = {
|
||||||
"principal": {"model": "grok-4-1-fast-non-reasoning"},
|
"principal": {"model": "grok-4-1-fast-non-reasoning"},
|
||||||
"auxiliary": {"vision": {"model": "grok-4-fast"}},
|
"auxiliary": {"vision": {"model": "grok-4-fast-reasoning"}},
|
||||||
"delegation": {"model": "grok-code-fast-1"},
|
"delegation": {"model": "grok-code-fast-1"},
|
||||||
"tts": {"xai": {"model": "grok-4"}}, # nonsense but valid path
|
"tts": {"xai": {"model": "grok-3"}}, # text model in TTS slot, but valid path
|
||||||
"plugins": {"image_gen": {"xai": {"model": "grok-imagine-image-pro"}}},
|
"plugins": {"image_gen": {"xai": {"model": "grok-imagine-image-pro"}}},
|
||||||
}
|
}
|
||||||
issues = find_retired_xai_refs(cfg)
|
issues = find_retired_xai_refs(cfg)
|
||||||
@ -181,11 +186,10 @@ class TestMigrationSemantics:
|
|||||||
issue = find_retired_xai_refs(cfg)[0]
|
issue = find_retired_xai_refs(cfg)[0]
|
||||||
assert issue.reasoning_effort is None
|
assert issue.reasoning_effort is None
|
||||||
|
|
||||||
def test_ambiguous_short_name_has_note(self):
|
def test_grok_3_maps_to_grok_4_3(self):
|
||||||
cfg = {"principal": {"model": "grok-4-fast"}}
|
cfg = {"principal": {"model": "grok-3"}}
|
||||||
issue = find_retired_xai_refs(cfg)[0]
|
issue = find_retired_xai_refs(cfg)[0]
|
||||||
assert issue.note is not None
|
assert issue.replacement == "grok-4.3"
|
||||||
assert "ambiguous" in issue.note.lower()
|
|
||||||
|
|
||||||
def test_imagine_pro_maps_to_imagine_quality(self):
|
def test_imagine_pro_maps_to_imagine_quality(self):
|
||||||
cfg = {"plugins": {"image_gen": {"xai": {"model": "grok-imagine-image-pro"}}}}
|
cfg = {"plugins": {"image_gen": {"xai": {"model": "grok-imagine-image-pro"}}}}
|
||||||
@ -205,12 +209,12 @@ class TestFormatIssue:
|
|||||||
def test_basic_format(self):
|
def test_basic_format(self):
|
||||||
issue = RetirementIssue(
|
issue = RetirementIssue(
|
||||||
config_path="principal.model",
|
config_path="principal.model",
|
||||||
current_model="grok-4",
|
current_model="grok-3",
|
||||||
replacement="grok-4.3",
|
replacement="grok-4.3",
|
||||||
)
|
)
|
||||||
s = format_issue(issue)
|
s = format_issue(issue)
|
||||||
assert "principal.model" in s
|
assert "principal.model" in s
|
||||||
assert "'grok-4'" in s
|
assert "'grok-3'" in s
|
||||||
assert "'grok-4.3'" in s
|
assert "'grok-4.3'" in s
|
||||||
|
|
||||||
def test_includes_reasoning_effort_when_set(self):
|
def test_includes_reasoning_effort_when_set(self):
|
||||||
@ -236,7 +240,7 @@ class TestFormatIssue:
|
|||||||
def test_includes_note_when_set(self):
|
def test_includes_note_when_set(self):
|
||||||
issue = RetirementIssue(
|
issue = RetirementIssue(
|
||||||
config_path="principal.model",
|
config_path="principal.model",
|
||||||
current_model="grok-4",
|
current_model="grok-3",
|
||||||
replacement="grok-4.3",
|
replacement="grok-4.3",
|
||||||
note="ambiguous variant",
|
note="ambiguous variant",
|
||||||
)
|
)
|
||||||
@ -259,15 +263,13 @@ class TestModuleConstants:
|
|||||||
def test_retired_models_keyset_matches_doc(self):
|
def test_retired_models_keyset_matches_doc(self):
|
||||||
# Snapshot test: if xAI's list changes we want CI to flag it.
|
# Snapshot test: if xAI's list changes we want CI to flag it.
|
||||||
expected = {
|
expected = {
|
||||||
"grok-4",
|
|
||||||
"grok-4-0709",
|
"grok-4-0709",
|
||||||
"grok-4-fast",
|
|
||||||
"grok-4-fast-reasoning",
|
"grok-4-fast-reasoning",
|
||||||
"grok-4-fast-non-reasoning",
|
"grok-4-fast-non-reasoning",
|
||||||
"grok-4-1-fast",
|
|
||||||
"grok-4-1-fast-reasoning",
|
"grok-4-1-fast-reasoning",
|
||||||
"grok-4-1-fast-non-reasoning",
|
"grok-4-1-fast-non-reasoning",
|
||||||
"grok-code-fast-1",
|
"grok-code-fast-1",
|
||||||
|
"grok-3",
|
||||||
"grok-imagine-image-pro",
|
"grok-imagine-image-pro",
|
||||||
}
|
}
|
||||||
assert set(_RETIRED_MODELS.keys()) == expected
|
assert set(_RETIRED_MODELS.keys()) == expected
|
||||||
|
|||||||
Reference in New Issue
Block a user