Skip to content

fix(mobile): consume each schedule mirror invalidation once - #5235

Closed
nothingyuancando wants to merge 2 commits into
makecindy:mainfrom
nothingyuancando:codex/fix-5227-mirror-loop
Closed

nothingyuancando wants to merge 2 commits into
makecindy:mainfrom
nothingyuancando:codex/fix-5227-mirror-loop

Conversation

@nothingyuancando

@nothingyuancando nothingyuancando commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

这次改了什么

摘要

修复 #5227:设备详情页会在同一个远程 schedule 镜像失效代次中,随着 session store 重渲而重复执行 setScheduleIndex,可能形成 React 更新循环。现在每个代次只消费尚未处理的会话;同一代次晚到的会话仍会被增量失效。

变更类型

  • fix 缺陷修复

范围

UI 变化

  • 引用的设计规范:不涉及:只改变已有离线状态的内部状态收敛,不新增或修改视觉、交互、文案。

怎么验证的

自动验证

pnpm test:unit:related
结果:通过(apps/mobile related)

pnpm --filter mobile run --if-present typecheck
结果:通过

pnpm check:dco
结果:通过

手工验证

未执行:未连接 Android 真机与远程设备;建议按 issue 场景覆盖连接、同步、主机断开及恢复。

未执行的验证

未执行真机离线/重连矩阵;改动不涉及原生层,未运行 fingerprint 对比。

风险

风险分类

  • 无已知风险

影响与回滚

  • 影响范围:仅移动端设备详情页的 schedule 镜像失效处理。
  • 回滚 / 降级方式:回退本次 effect 内的代次消费守卫。

提交前检查

  • 已 review 完整 diff
  • 每个 commit 都带 DCO 签名
  • 未提交凭证、令牌或授权文件
  • 已确认测试结果或说明未执行原因

@nothingyuancando
nothingyuancando requested a review from a team as a code owner September 29, 2026 08:16
@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Fixes duplicate state updates in device schedule refresh logic.

暂不宜合并;连续两次离线之间恢复设备时,详情页可能保留错误的运行中状态。

Findings

  1. P1 再次离线时跳过会话失效 ▶
Fix with agent prompt
### Issue 1
apps/mobile/app/devices/[deviceId].tsx:240-247
设备恢复后,`syncSessions` 会清除镜像失效记录,但这里保留已消费的会话 ID。下一次离线的代次又从 1 开始;如果详情页仍挂载且这些会话仍在列表中,它们就会被当作已处理而跳过,导致离线设备继续显示“运行中”。需要在恢复时清除消费记录,或避免跨恢复周期复用代次。

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary

本 PR 为移动端设备详情页增加按失效代次和会话 ID 去重的守卫,以避免重复写入 schedule 状态。

  • 同一代次中新出现的会话仍会参与失效处理。
  • 恢复后代次编号可能复用,而已消费记录仍保留,导致再次离线时漏处理已有会话。
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[首次离线:代次 1] --> B[记录已消费会话]
  B --> C[恢复:清除镜像失效代次]
  C --> D[再次离线:代次重置为 1]
  D --> E[旧消费记录匹配,跳过运行状态失效]
Loading

Reviews (1) · Last reviewed commit: "fix(mobile): consume each schedule mirro..."

Comment thread apps/mobile/app/devices/[deviceId].tsx
Signed-off-by: nothingyuancando <1579035512@qq.com>
Signed-off-by: nothingyuancando <1579035512@qq.com>
@nothingyuancando
nothingyuancando force-pushed the codex/fix-5227-mirror-loop branch from 4e86cbf to 8f2f768 Compare September 29, 2026 08:27
@MagicLizi MagicLizi added the touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) label Sep 29, 2026
@nothingyuancando

Copy link
Copy Markdown
Contributor Author

Closing this iteration; the fix will be reconsidered from a fresh issue/branch if needed.

@nothingyuancando
nothingyuancando deleted the codex/fix-5227-mirror-loop branch October 1, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants