fix(codex-bridge): strip a stray ide/ prefix from stored model names
Server CI and Windows package / verify (push) Successful in 4m30s
Server CI and Windows package / windows-package (push) Successful in 16m59s

A hand- or agent-edited jev-settings.json could store a model name that
already carries the gateway's own "ide/" prefix. The bridge adds "ide/"
again when it routes, producing "ide/ide/<model>" — an unknown model whose
context window the bridge reads as the 32768 default and then silently
drops the request, answering "." with a wrong "model seçildi" instead of
the chosen model. jev_settings.read()/_policy() now normalize every stored
model name (fallbackModel, watchModels, exemptModels, prefilter.target,
autoRoute.model/targets) by stripping a leading "ide/". No real
provider/model id begins with "ide/", so valid settings are unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
yilsemandClaude Opus 4.8 committed 2026-10-17 02:09:30 +03:00
1 parent 86a6621936
commit 65ce4be58b
2 files changed
+60

No files matched your search

@@ -42,6 +42,28 @@ class Settings(unittest.TestCase):
self.save(rejectionRules=[{'from': 'A', 'to': 'B'}, {'from': 'B', 'to': 'A'}])
self.assertEqual(jev_denetim.sonrakiler('A'), ['B'])
def test_stored_ide_prefix_on_model_names_is_stripped(self):
# A hand- or agent-edited settings file may store a model name carrying the gateway's own
# 'ide/' prefix. The bridge adds 'ide/' again when it routes, so a stored prefix would make
# 'ide/ide/...', an unknown model whose context window the bridge mis-reads before silently
# dropping the request. read() must strip the stray prefix so routing stays correct.
self.save(
fallbackModel='ide/abliteration-abliterated-model-large-v2',
exemptModels=['ide/claude-claude-opus-5-5', 'agnes-agnes-1.5-flash'],
prefilter={**self.settings['prefilter'], 'target': 'ide/ide/abliteration-abliterated-model-large-v2'},
)
settings, _ = jev_settings.read()
self.assertEqual(settings['fallbackModel'], 'abliteration-abliterated-model-large-v2')
self.assertEqual(settings['prefilter']['target'], 'abliteration-abliterated-model-large-v2')
self.assertEqual(settings['exemptModels'], ['claude-claude-opus-5-5', 'agnes-agnes-1.5-flash'])
self.assertTrue(jev_denetim.muaf_mi('claude-claude-opus-5-5'))
def test_strip_ide_leaves_normal_names_and_removes_only_prefix(self):
self.assertEqual(jev_settings._strip_ide('claude-claude-opus-5-5'), 'claude-claude-opus-5-5')
self.assertEqual(jev_settings._strip_ide('ide/x'), 'x')
self.assertEqual(jev_settings._strip_ide('ide/ide/x'), 'x')
self.assertEqual(jev_settings._strip_ide('provider-ide/x'), 'provider-ide/x')
def test_prompts_model_criteria_and_thresholds_are_applied(self):
self.save(model='jev-custom', questions={'ret': 'question A', 'sart': 'question B'}, thresholds={'ret': .9, 'sart': .8}, criteria={'ret': {'true': 'bad', 'false': 'good'}, 'sart': {'true': '', 'false': ''}})
captured = []