fix(codex-link): summarize with a subscription model, reject tiny summaries, describe added models
Model switch lost the conversation: on 10 Oct a 1 MB thread was compacted by the newly selected small model into 2201 characters. The compaction summary for a bridge model is now written by a subscription model (ozet_kopru.ozet_modeli, default gpt-6.1-sol); if that request is refused before it starts, the target model is used as before. A summary far shorter than the conversation warrants is not accepted: Codex gets response.failed and keeps the history. The line under each added model no longer repeats its name. Teams show their members, fallback chains their order, single models their provider and the traits readable from the name; the text fits one phone row (30 characters). Also normalizes tool call ids in the streamed response so Codex persists ids the subscription backend accepts (fc_ -> ctc_), and bumps the bridge protocol to 6. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ce49d6d1cc
commit
adf73eeedd
7 files changed
+248
-13
No files matched your search
@@ -62,6 +62,27 @@ class ModelSwitch(unittest.TestCase):
|
||||
self.assertEqual(rewritten["item"]["type"], "custom_tool_call")
|
||||
self.assertEqual(rewritten["item"]["input"], "remember-4827")
|
||||
self.assertEqual(rewritten["item"]["call_id"], "call_4827")
|
||||
self.assertEqual(rewritten["item"]["id"], "ctc_chatcmpl-probe")
|
||||
|
||||
def test_custom_stream_ids_are_valid_before_history_is_saved(self):
|
||||
# Real failure after disabling the bridge and returning to OpenAI:
|
||||
# input[32].id fc_call_... was saved as a custom_tool_call by Codex.
|
||||
item = {"type": "function_call", "id": "fc_call_3f427ecc539d4c779c1252077701216f",
|
||||
"call_id": "call_original", "name": "probe",
|
||||
"arguments": json.dumps({"input": "keep this exact tool input"})}
|
||||
adapter = env["SseRewriter"]({"probe"})
|
||||
converted = []
|
||||
for kind in ("response.output_item.added", "response.output_item.done"):
|
||||
converted.append(adapter._fix({"type": kind, "item": dict(item)})["item"])
|
||||
final = adapter._fix({"type": "response.completed", "response": {"output": [dict(item)]}})
|
||||
converted.append(final["response"]["output"][0])
|
||||
for result in converted:
|
||||
self.assertEqual(result["type"], "custom_tool_call")
|
||||
self.assertEqual(result["id"], "ctc_call_3f427ecc539d4c779c1252077701216f")
|
||||
self.assertEqual(result["call_id"], "call_original")
|
||||
self.assertEqual(result["input"], "keep this exact tool input")
|
||||
history = {"input": converted}
|
||||
self.assertEqual(env["fix_tool_ids"](history), 0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user