fix(device-link): 减少手机恢复重复同步和误报中断 - #3326
Conversation
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
|
| Filename | Overview |
|---|---|
| apps/mobile/app/sessions/[sessionId].tsx | 会话页将订阅、元数据、消息、待处理交互和输入投影拆分恢复,并用连接代次控制中断横幅判定。 |
| apps/mobile/src/device-link/sessionSnapshotSingleFlight.ts | 新增带完整请求语义和本地权限栅栏的会话快照 single-flight,实现相同读取合并与结算后清理。 |
| apps/mobile/src/device-link/remoteSyncTask.ts | 新增单轮同步内的 peer reopen 协调器,使同一故障代次的错峰失败共享恢复动作。 |
| apps/mobile/src/device-link/DeviceLinkContext.tsx | 同步推进连接代次,接入全局快照 single-flight,并提供可刷新已结算 link-open 的 reopenLink。 |
| packages/device-link/src/client.ts | peer 路由事件增加 link generation,并为最终 ACK timeout 输出不含用户内容的分类诊断。 |
| apps/desktop/src/main/device-link/dispatch.ts | 桌面端记录活跃控制链路代次,忽略来自旧连接或旧 link 的迟到离线事件。 |
| apps/mobile/src/session/sessionTailBannerModel.ts | 中断状态仅在当前连接的会话元数据完成同步后参与推导,避免使用旧时间戳误报。 |
Sequence Diagram
sequenceDiagram
participant P as 手机会话页
participant G as 全局 Rehydrate
participant S as Snapshot Single-flight
participant L as Device Link
participant D as 桌面端
P->>S: 按设备/会话/连接代请求快照
G->>S: 请求相同范围的快照
alt key 与权限栅栏一致
S->>L: 合并为一次物理读取
else 请求语义不同
S->>L: 分别读取
end
L->>D: invoke
D-->>L: snapshot
L-->>S: 返回结果
S-->>P: 页面按当前权限栅栏提交
S-->>G: rehydrate 按当前权限栅栏提交
opt 单项读取瞬时失败
P->>L: 协调一次 peer reopen
P->>S: 仅重试失败项
end
Reviews (15): Last reviewed commit: "fix(device-link): release route ledger e..." | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ce1e4f488
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: edd480e1f0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 89232ac5a0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 825cf0203d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cbf80d83bf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 14a070586a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0a2ac0288
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f392f5a9f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c199c8e339
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7797bd91a1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@zqchris 👋 这个 PR 还有 2 条 review conversation 没 resolve(apps/mobile/src/device-link/remoteSyncTask.ts / packages/device-link/src/client.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7018a7a564
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00657059a3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
|
命中 UI 路径(mobile sessions / DeviceLinkContext 等)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面,便于确认界面符合 DESIGN.md 设计规范。本条不阻断合并。 |
|
@zqchris 👋 这个 PR 目前与 请在本地 merge 最新的 |
…recovery Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com> # Conflicts: # apps/desktop/src/main/device-link/__tests__/dispatchWeakNetwork.test.ts # apps/desktop/src/main/device-link/dispatch.ts # packages/device-link/src/__tests__/client.test.ts # packages/device-link/src/client.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 16ed7803c2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
|
合了。手机恢复不再把一次超时当成整条链路断掉,重复同步也会少很多。 |
#3309 应先合并。本 PR 当前临时包含其 peer lifecycle 清理提交;#3309 合入 main 后,本分支会 merge 最新 main,PR diff 自动收敛为第二批手机恢复止血净增量。
这次改了什么
摘要
手机从新连接进入任务时,页面加载与全局恢复不再重复拉取同一份快照;某一个读取超时只重试自己,不再重放整组请求。当前连接代的任务元数据尚未同步完成时,不再用旧时间戳误报“任务中断”。同时补充不含用户内容的 ACK timeout 归因日志,便于发布后区分线路未推进与本地发送异常。
变更类型
feat新功能fix缺陷修复refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
故障半径:本 PR 处理的是单个任务快照读取与手机本地状态判定,恢复动作限定在失败的单项请求;不新增连接级 teardown,不扩大到共享 relay socket。多 peer 共享连接行为由 #3284 的既有回归覆盖,本 PR 不改变该路径。
UI 变化
不涉及视觉、布局、颜色或文案变化;只在当前连接元数据未同步完成时抑制旧状态推导的中断横幅,继续沿用现有同步界面。
怎么验证的
自动验证
手工验证
不涉及视觉手工验收;完成代码路径与并发顺序自审。
未执行的验证
未启动 Desktop DEV、Electron、Vite 或 CDP。未执行真实手机 + relay + VPN E2E;发布包含本 PR 的手机 JS/OTA 与桌面版本后,需要对比任务首屏等待、ACK timeout 归因和误报中断数量。
风险
风险分类
影响与回滚
提交前检查
git commit -s,见 DCO)