fix: Crof multi-turn tool calls + auto-trim long conversations

Root cause: Codex sends function_call items with id=None, causing
tool_call_id mismatch between tool calls and tool results. Proxy now
resolves IDs by call_id + positional fallback.

Auto-trim: conversations exceeding 30 items are trimmed automatically,
keeping system messages, original user query, and most recent items.
This prevents context overflow on providers with smaller context
windows (Crof mimo-v2.5-pro stops responding at ~40 items).

- Fix None tool IDs in oa_input_to_messages with positional matching
- Auto-trim input to 30 items max (keeps head + tail)
- Add request/response logging to ~/.cache/codex-proxy/requests.log
- Proxy stderr visible in launcher terminal for debugging
- v2.1.2
This commit is contained in:
admin
2026-05-19 21:25:35 +04:00
Unverified
parent cb6381afe4
commit aa377024d9
4 changed files with 108 additions and 17 deletions

View File

@@ -25,10 +25,11 @@ model_catalog_json = ""
CHANGELOG = [
("2.1.2", "2026-05-19", [
"Fixed Crof.ai and other providers stopping after first tool call",
"Proxy now stores and resolves previous_response_id for multi-turn conversations",
"Codex Desktop uses previous_response_id to chain turns — proxy reconstructs full context",
"Fixed orphan message output item when response is only tool calls (no text)",
"Fixed Crof.ai and providers stopping after first tool call (root cause: None tool IDs)",
"Codex sends function_call items with id=None — proxy now matches tool results to calls by position",
"Fixed orphan message output item when response has only tool calls (no text)",
"Auto-trims long conversations (>30 items) to prevent context overflow on providers like Crof",
"Added request/response logging to ~/.cache/codex-proxy/requests.log",
]),
("2.1.1", "2026-05-19", [
"Fixed proxy: map 'developer' role to 'system' for Chat Completions providers",
@@ -437,7 +438,7 @@ def _start_proxy_for(endpoint, logfn):
_proxy_proc = subprocess.Popen(
["python3", str(PROXY), "--config", str(pcfg_path)],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
preexec_fn=os.setsid,
)
@@ -526,7 +527,7 @@ class LauncherWin(Gtk.Window):
# header row
hdr = Gtk.Box(spacing=8)
vbox.pack_start(hdr, False, False, 0)
lbl = Gtk.Label(label="<b>Codex Launcher v2.2.0</b>")
lbl = Gtk.Label(label="<b>Codex Launcher v2.1.2</b>")
lbl.set_use_markup(True)
hdr.pack_start(lbl, False, False, 0)
changelog_btn = Gtk.Button(label="Changelog")