Files
aiturk-hermes-ide/apps/desktop/assets/codex-bridge/test_claude_sonu.py
T
yilsemandClaude Opus 5.5 23e8aa8191 feat(codex-bridge): split into a splitter and a separate bridge process
bridge.py is now a small splitter with no features: a request for one of
Codex's own models goes to chatgpt.com byte for byte, a request for an added
model goes to kopru.py, which runs as its own process. Codex's own models no
longer pass through the feature code at all, and restarting or losing the
bridge process does not touch them.

Measured with real Codex on spare ports: own model answers; forced compaction
on the own model completes (twice) while the bridge process is restarted;
added model answers; no own-model request reaches the bridge process.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 06:13:29 +03:00

46 lines
1.7 KiB
Python

"""claude_sonu_duzelt testleri (9Router Claude prefill 400)."""
import ast
import json
from pathlib import Path
import unittest
tree = ast.parse(Path(__file__).with_name("kopru.py").read_text(encoding="utf-8"))
env = {}
exec(compile(ast.Module(body=[n for n in tree.body if isinstance(n, ast.FunctionDef) and n.name == "claude_sonu_duzelt"], type_ignores=[]), "bridge.py", "exec"), env)
f = env["claude_sonu_duzelt"]
def msg(role, text="x"):
return {"type": "message", "role": role, "content": [{"type": "input_text", "text": text}]}
class ClaudeSonu(unittest.TestCase):
def test_asistanla_biten_duzelir(self):
req = {"input": [msg("user"), msg("assistant")]}
self.assertTrue(f(req)[0])
self.assertEqual(req["input"][-1]["role"], "user")
def test_asistan_sonra_developer_duzelir(self):
# Sesli tur kapaninca: ... assistant, developer (9Router developer'i dusurur -> asistanla biter)
req = {"input": [msg("user"), msg("assistant"), msg("developer")]}
self.assertTrue(f(req)[0])
self.assertEqual(req["input"][-1]["role"], "user")
def test_reasoning_ile_biten_duzelir(self):
req = {"input": [msg("user"), {"type": "reasoning", "id": "rs_1"}]}
self.assertTrue(f(req)[0])
def test_kullaniciyla_biten_degismez(self):
req = {"input": [msg("assistant"), msg("user"), msg("developer")]}
self.assertFalse(f(req)[0])
self.assertEqual(len(req["input"]), 3)
def test_arac_sonucuyla_biten_degismez(self):
req = {"input": [msg("user"), {"type": "custom_tool_call", "call_id": "c"}, {"type": "custom_tool_call_output", "call_id": "c"}]}
self.assertFalse(f(req)[0])
if __name__ == "__main__":
unittest.main()