bug: 手机端断网重连后 worktree 行一直停留在「连接恢复中,正在自动重试…」
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 401
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
### 问题描述 / What happened
手机端新建会话页在「断网 → 恢复网络」后,worktree 行的提示会永久停留在「连接恢复中,正在自动重试…」:
- 实际行为:手机断网时该行进入「连接恢复中,正在自动重试…」,开关禁用;恢复网络、与电脑端重新连通后,提示不消失,开关仍禁用,创建被 fail-closed 阻断,只能离开页面重新进入才可能恢复。
- 期望行为:链路恢复(设备恢复在线、探测可执行)后,提示应消失并回到可用状态(eligible);若确实仍不可用,应落到明确的可重试/失败提示,而不是一直停在自动重试中的中间态。
该现象在 0.1.80 灰度手机端真机验收 PR #4277(fix(mobile): worktree 默认值同步不再阻挡创建任务)用例 BH-022 时观察到:PR 目标是把 worktree 默认值同步与创建解耦,本条属于同一控件行仍会卡住用户的可观察状态。
疑似相关代码路径(未确认根因,需按日志定位):
- apps/mobile/app/sessions/new.tsx:worktree 资格探测 effect(约 2292-2363 行),其中 initialWorktreeProbeEligibility 在「设备与目录已选、链路非 online」时直接给出 recovering,且 deviceLinkStatus !== 'online' 时提前 return,不进入请求的 catch、也就不会安排恢复探测;recovering 的重探依赖 catch 分支里 1.5s 的 retryNonce 定时器。
- apps/mobile/src/session/newSessionWorktree.ts:worktreeEligibilityFromError(239 行)把瞬态错误与 DEVICE_UNRESPONSIVE 归并为 recovering;worktreeEligibilityCaptionKey(398 行)把 recovering 映射为 session.new.worktreeRecovering。
- 现有注释(new.tsx 2342-2343)描述的场景正是「换网后 relay 可能已 online,但旧 peer link 仍在握手恢复窗口、epoch/presence 未必再变化」,即需要定时重探才能自愈;本次观察到该中间态没有自愈。
### 环境 / Environment
- Cindy 版本或 commit: 0.1.80 灰度手机端;对应源码 https://github.com/makecindy/cindy.git @ 88f71211657420432ed956d91b2ef5a2564cd469(PR #4277 合并提交 6332d301f465b9c64f844d6a5b42b4c00458458e 的祖先);本地核对检出 8b98a83249c46936ad4a4f08f4033c75525f0893
- 平台与版本 / platform & OS version: 手机端真机(iOS/Android)+ Windows 桌面端被控;具体机型与系统版本未记录
- 安装方式 / install method: 灰度安装包,未改产品源码
### 复现步骤 / Steps to reproduce
1. 手机与电脑端均已登录并连通,电脑端准备一个 git 仓库项目目录(非 worktree 内)。
2. 手机进入新建会话页 → 选择该电脑 → 工作区选「项目」→ 选择该项目目录,确认 worktree 行出现且状态可用(无「连接恢复中」)。
3. 断开手机网络(关闭 Wi-Fi 与移动数据),观察 worktree 行出现「连接恢复中,正在自动重试…」,开关变为禁用。
4. 恢复手机网络,等待设备与链路重新连通(设备状态回到在线)。
5. 返回/停留在该新建会话页观察 worktree 行:提示仍为「连接恢复中,正在自动重试…」,不消失;开关仍禁用,发送被阻断。
备注:只在「断网时页面已经进入该状态」后才复现;未做修复前对照与 iOS/Android 双平台对照。
### 日志与截图 / Logs & screenshots
未采集手机端日志与截图(可补充);待复现时补充 worktree 行提示与设备状态。未包含任何凭证或用户数据。
Contributor guide
Research direction
Reproduce the network interruption flow on the mobile new-session page, then read the worktree eligibility effect in apps/mobile/app/sessions/new.tsx around lines 2292-2363. Trace the recovering mappings in apps/mobile/src/session/newSessionWorktree.ts, including worktreeEligibilityFromError and worktreeEligibilityCaptionKey. Done means the worktree row leaves the recovering state after the device link returns online, becoming eligible or showing a clear retry/failure state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100