From d8debc618289e47885232e7b37b2adf2864c4840 Mon Sep 17 00:00:00 2001 From: Menghuan Date: Mon, 1 Dec 2025 10:29:53 +0800 Subject: [PATCH] =?UTF-8?q?v0.7.4=EF=BC=9A=E5=BF=BD=E7=95=A5`Reconnecting.?= =?UTF-8?q?..=20X/Y`=E7=B1=BB=E5=9E=8B=E7=9A=84=E9=94=99=E8=AF=AF(?= =?UTF-8?q?=E9=87=8D=E8=BF=9E=E5=B0=9D=E8=AF=95=E8=AD=A6=E5=91=8A)=20(#23)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 2 +- src/codexmcp/server.py | 8 ++++++-- uv.lock | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 98e87b5..593d19a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "codexmcp" -version = "0.1.0" +version = "0.7.4" description = "FastMCP server wrapping the Codex CLI." readme = "README.md" requires-python = ">=3.12" diff --git a/src/codexmcp/server.py b/src/codexmcp/server.py index fb5c805..73a1e3b 100644 --- a/src/codexmcp/server.py +++ b/src/codexmcp/server.py @@ -5,6 +5,7 @@ from __future__ import annotations import json import os import queue +import re import subprocess import threading import uuid @@ -219,8 +220,11 @@ async def codex( success = False if len(agent_messages) == 0 else success err_message = "codex error: " + line_dict.get("error", {}).get("message", "") if "error" in line_dict.get("type", ""): - success = False if len(agent_messages) == 0 else success - err_message = "codex error: " + line_dict.get("message", "") + error_msg = line_dict.get("message", "") + is_reconnecting = bool(re.match(r'^Reconnecting\.\.\.\s+\d+/\d+$', error_msg)) + if not is_reconnecting: + success = False if len(agent_messages) == 0 else success + err_message = "codex error: " + error_msg except json.JSONDecodeError as error: # Improved error handling: include problematic line err_message = line diff --git a/uv.lock b/uv.lock index 3653891..5a6176b 100644 --- a/uv.lock +++ b/uv.lock @@ -114,7 +114,7 @@ wheels = [ [[package]] name = "codexmcp" -version = "0.1.0" +version = "0.7.4" source = { editable = "." } dependencies = [ { name = "mcp", extra = ["cli"] },