fix(codex-bridge): exempt the voice combo from Jev checks

This commit is contained in:
yilsem committed 2026-10-12 16:42:22 +03:00
1 parent 8bd662ea92
commit 017c6629d2
4 files changed
+73 -7

No files matched your search

@@ -12,7 +12,7 @@ import unittest
import urllib.error
import urllib.request
from pathlib import Path
from unittest.mock import Mock
from unittest.mock import Mock, patch
import ide_catalog
import is_hatti
@@ -364,6 +364,31 @@ class Zincir(unittest.TestCase):
self.env["MODEL_MAP"].update({"x/combo": ("r", "Takim", None), "x/tek": ("r", "cc/claude", None)})
self.env["urllib"].request.urlopen.side_effect = error
def test_resolved_voice_target_and_codex_instructions_reach_the_stream_guard(self):
self.env["ROUTES"]["aiturk-ide"] = {
"url": "https://example.invalid/v1/responses", "key": "test-only", "flatten_tools": True}
self.env["MODEL_MAP"]["ide/voice-alias"] = ("aiturk-ide", "Sesli-Hizli-Zeki", None)
req = {"model": "ide/voice-alias", "instructions": "Codex system instructions unchanged",
"input": [developer("Codex developer instructions unchanged"), user("selam")]}
for failure in (None, urllib.error.URLError(ConnectionResetError("reset")),
urllib.error.HTTPError("https://example.invalid", 400, "bad", {}, io.BytesIO(b"bad"))):
with self.subTest(failure=type(failure).__name__):
opener = self.env["urllib"].request.urlopen
opener.reset_mock()
opener.side_effect = failure
opener.return_value = Mock(status=200)
fake = Sahte()
fake._denetimli_akis = Mock()
with patch.object(self.env["jev_denetim"], "anahtar", return_value="test-only"):
fake._responses(1, "/responses", json.dumps(req).encode())
fake._denetimli_akis.assert_called_once()
self.assertEqual(fake._denetimli_akis.call_args.kwargs, {"hedef": "Sesli-Hizli-Zeki"})
self.assertEqual(fake._denetimli_akis.call_args.args[5], list(self.env["jev_denetim"].KATMAN))
sent = json.loads(opener.call_args.args[0].data)
self.assertEqual(sent["model"], "Sesli-Hizli-Zeki")
self.assertEqual(sent["instructions"], req["instructions"])
self.assertEqual(sent["input"][0], req["input"][0])
def test_combo_dropped_after_sending_is_not_resent_but_a_single_model_is(self):
import http.client
self.external(http.client.RemoteDisconnected("closed"))