[Feature] Mobile App 在后台或锁屏时接收 Agent 任务完成通知
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 395
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
### 问题描述
手机锁屏或 Mobile App 位于后台时,桌面 Agent 完成任务后,手机不会收到系统通知。用户只有重新打开 App 后,才能通过 Device Link 重连和数据补齐看到最新状态。
本问题已于 2026-07-16 在 TC-5 手机版验证中复现,对应待执行用例 `DEFERRED_MOB_PUSH_001~004`。
### 复现步骤
1. 桌面端和手机端登录同一账号,并完成设备连接。
2. 从手机端进入一个桌面会话并发起 Agent 任务。
3. 将 Mobile App 切到后台,或锁定手机屏幕。
4. 等待桌面 Agent 完成任务。
5. 查看手机系统通知。
### 实际结果
手机没有收到任务完成通知。重新打开 App 后,才会通过重连和数据同步看到任务已完成。
### 期望结果
- Mobile App 位于后台时,Agent 完成任务后能够收到系统通知。
- 手机锁屏时,Agent 完成任务后能够收到系统通知。
- 通知内容能够标识对应会话。
- 点击通知后进入对应会话。
- 冷启动和 App 已在后台两种情况下,通知跳转均能正常工作。
### 当前实现分析
桌面端已经能够生成 `completed` 会话活动事件,Mobile App 在前台时也能通过 Device Link WebSocket 消费该事件并更新会话状态。
Mobile App 进入后台后,会在短暂宽限后停止 Device Link 连接。当前仓库尚未接入完整的系统推送能力,包括:
- APNs / FCM 通知能力和权限配置。
- Push token 获取、更新和注销。
- Push token 上报及服务端存储。
- Agent 完成后的系统推送投递。
- 系统通知接收和点击事件处理。
- 通知 payload 到 `/sessions/[sessionId]` 路由的跳转。
现有会话路由已经支持通过 `sessionId` 和 `deviceId` 打开对应会话,可以作为通知点击后的目标页面。
服务端位于独立的 `cindy-server` 仓库,完整实现预计需要客户端和服务端协同。
### 验收标准
- [ ] App 位于后台时,Agent 完成任务后能收到系统通知。
- [ ] 手机锁屏时,Agent 完成任务后能收到系统通知。
- [ ] 点击通知可以进入正确的设备和会话。
- [ ] App 冷启动、后台唤起两种通知点击路径均正常。
- [ ] 同一次任务完成不会产生重复通知。
- [ ] 通知权限被拒绝或 Push token 失效时,不影响现有前台 Device Link 功能。
- [ ] App 回到前台后的重连和数据补齐行为保持正常。
- [ ] 补充自动化测试或提供真机验证记录,覆盖 `DEFERRED_MOB_PUSH_001~004`。
Contributor guide
Research direction
Start by tracing the existing Device Link WebSocket event flow and the `/sessions/[sessionId]` route in the mobile app, then review the coordinated changes needed in the separate `cindy-server` repository. Use `DEFERRED_MOB_PUSH_001~004` as the validation target, covering background and locked-screen delivery, notification navigation, duplicate prevention, and foreground resynchronization.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, ios, react-native, typescript
- Domain
- api, backend, mobile
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100