BigPizzaV3/CodexPlusPlus · error · TimeoutError
超时
Error message
{method} 超时 What it means
_request gives up when time exceeds the deadline (timeout seconds from config, or the explicit timeout used by initialize) without receiving the matching response and while the process is still alive. The app-server accepted the request but never answered in time.
Solutions
- Increase codex.timeout_seconds in the config if turns legitimately take long.
- Check whether the app-server is stuck (CPU/idle) and restart it; inspect reader-thread logs for dropped notifications.
- For initialize keep the 20s timeout but verify the binary starts quickly; for long turns use the turn-level timeout rather than a short one.
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at tools/codex-wechat/codex_wechat.py:457 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/fed55ad35cacf2e3.
Report an issue: GitHub.
Appendix: source
Thrown at tools/codex-wechat/codex_wechat.py:457
def _request(self, method: str, params: Any, timeout: int | None = None) -> dict[str, Any]:
req_id = self.next_id
self.next_id += 1
self._send({"id": req_id, "method": method, "params": params})
deadline = time.time() + (timeout or self.cfg.codex.timeout_seconds)
while time.time() < deadline:
try:
msg = self.messages.get(timeout=0.5)
except queue.Empty:
if self.proc and self.proc.poll() is not None:
raise RuntimeError(f"app-server 已退出,退出码 {self.proc.returncode}")
continue
if msg.get("id") == req_id:
if "error" in msg:
raise RuntimeError(f"{method} 失败:{msg['error']}")
return msg.get("result") or {}
# 其它通知留给当前请求外的事件循环自然丢弃。
raise TimeoutError(f"{method} 超时")
def _ensure_thread(self, user_id: str) -> str:
thread_id = self.threads.get(user_id)
if thread_id:
return thread_id
params: dict[str, Any] = {
"cwd": self.cfg.codex.workspace,
"approvalPolicy": self.cfg.codex.approval_policy,
"sandbox": self.cfg.codex.sandbox,
"ephemeral": True,
"baseInstructions": "你是运行在微信里的 Codex 助手。全程中文,只把最终答复发给微信用户。",
}
if self.cfg.codex.model:
params["model"] = self.cfg.codex.model
result = self._request("thread/start", params, timeout=60)
thread_id = result["thread"]["id"]
self.threads[user_id] = thread_idView on GitHub (pinned to b1ed92e5e4)