makecindy / makecindy/cindy

Codex app-server 重连 120s 无进展后 generation 2 重建但旧进程未回收,导致会话持续连不上

Open
#2,642 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
2.7k
Forks
401
Avg merge
21h 48m
Merged PRs (30d)
776

Description

**提交人**: 用户0504
**客户端版本**: 0.1.46

---

## 问题

在 Cindy **0.1.44**(macOS)中,特定 Codex 会话的 app-server 进入重连死循环后,Cindy 触发 generation 2 重建并启动了新实例,但**旧 app-server 进程未被回收**,导致该会话持续无法连接,且其他 Codex/GPT 会话正常。

## 复现步骤

1. 在 Cindy 中打开一个 Codex 会话(模型 gpt-5.6-luna,providerId=openai)。
2. 使用过程中发生网络切换(本机日志出现 `ERR_NETWORK_CHANGED`,例如切换手机热点)。
3. app-server 进入重连状态,120 秒无进展后日志出现:
```
terminal error drain timed out; closing session for rebuild
generation : 2
graceMs : 250
```
4. Cindy 随即以新配置启动新 app-server 实例(startSession)。
5. 但**旧 generation 的 app-server 进程没有被终止/回收**,持续常驻(实测旧实例挂 4.7 小时、CPU 0%),同一会话残留多个实例,会话一直无法重连。

## 实际结果

- 旧 app-server 进程残留,不被回收;
- 受影响的会话长期处于 `Codex app-server has been reconnecting for 120s without making progress` 状态;
- 只有该会话受影响,其他会话可正常对话。

## 期望结果

- generation 2 重建时应先回收/终止旧 generation 的 app-server 进程,或将其标记为失效;
- 一个会话只应存在一个健康实例;
- 失败后应能从磁盘持久化的会话记录恢复正常连接。

## 已尝试

- 手动结束僵死的 app-server 进程后,会话可恢复;
- 当前版本:0.1.44;系统:macOS;复现场景:网络切换(手机热点)。
---
**版本区域**: CN
**OS**: darwin arm64 (25.4.0)
**界面语言**: zh-CN

Contributor guide

Open the contributing guide

Research direction

Start at the app-server reconnect and generation-rebuild flow described by the `terminal error drain timed out` log, including the `startSession` entry point. Reproduce the network-switch scenario and trace what happens to generation 1 when generation 2 starts. Done means the old process is terminated or invalidated, only one healthy instance remains, and the persisted session can reconnect.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, typescript
Domain
backend, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.