Skip to content

fix(desktop): 隐藏远端设备加载失败提示 - #3797

Merged
MagicLizi merged 10 commits into
mainfrom
dash/soften-remote-device-failure
Sep 4, 2026
Merged

fix(desktop): 隐藏远端设备加载失败提示#3797
MagicLizi merged 10 commits into
mainfrom
dash/soften-remote-device-failure

Conversation

@dashhuang

@dashhuang dashhuang commented Sep 2, 2026

Copy link
Copy Markdown
Member

这次改了什么

摘要

远端设备目录属于侧栏的后台增强能力。断网或远端设备列表读取失败时,不再用错误卡片、红色告警或重试按钮打断侧栏,继续展示本地与已缓存内容;请求会在 renderer 内以 2 秒起步、指数退避、30 秒封顶的方式静默自动重试,成功后自动复位,不增加任何提示 UI;退避中的后台请求保持已结算的选择态,不反复触发侧栏 loading 占位。

变更类型

  • fix 缺陷修复
  • feat 新功能
  • refactor / perf 重构或性能优化
  • docs / test / chore 文档、测试或工程维护
  • 其他:

范围

  • 关联 Issue / 需求:无
  • 本 PR 包含:移除设备目录失败的两处侧栏提示入口、重试按钮及五语废弃文案;在共享设备目录 hook 内加入无提示、无背景框的静默自动重试(2 秒起步、指数退避、30 秒封顶,成功后复位,relay stopped 时取消;后台请求不重置 initialRequestSettled);同步静态与行为回归断言。
  • 明确不包含:远程任务读取失败提示、IPC / wire protocol / Mobile 行为、relay 或 peer 的 teardown 逻辑;不新增用户可见的重试入口。设备目录请求本身仍保留,失败恢复只作用于这一共享 hook 的单请求。
  • 用户可见变化:断网或远端不可达时侧栏保持安静,已有本地和缓存内容照常显示;后台恢复成功后目录会自动更新。
  • 是否存在 breaking change:无

远程与多端适配结论

  • 故障半径:单次设备目录 listDevices 请求;失败不会清空已有快照,也不触发 relay / peer teardown。
  • 恢复半径:同一 renderer 共享 hook 的低频定时器;成功、online / connecting、presence 与 control-target 事件都可提前恢复,stopped 会取消定时器并清空目录。后台重试保持已结算选择态,前台 loading 只由用户/状态事件触发。
  • 多 peer:重试不携带 peer 操作、不改变 wire protocol;多个远端设备仍共享一次目录请求,不会按设备倍增定时器。

UI 变化

  • 引用的设计规范:docs/design-rules/DESIGN.md §1 Visual Theme & Atmosphere(内容克制、只保留必要信息);§2 Color Palette & Roles(语义色仅用于必要状态信号)。本次移除非必要的设备目录错误卡片和红色告警,避免后台增强能力抢占用户注意力。

UI 效果示意(Desktop)

<aside aria-label="Sidebar">
  <nav aria-label="Primary navigation">...</nav>
  <section aria-label="All sessions">
    <div class="session-list">
      <!-- local sessions and cached remote sessions remain visible -->
    </div>
  </section>
</aside>

断网或远端设备目录读取失败时,不渲染错误卡片、红色告警或重试按钮;读取中仅保留中性文字与轻量 spinner,不使用背景框;已有本地与缓存内容继续显示。该示意仅说明最终界面状态,不新增产品结构。

怎么验证的

自动验证

pnpm --filter desktop exec vitest run src/renderer/__tests__/machineSwitcherMenu.test.ts src/renderer/__tests__/dialogueSidebarSection.test.ts src/renderer/__tests__/deviceLinkDeviceListLoading.test.tsx
结果:62/62 通过

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

pnpm test:unit:related
结果:apps/desktop 相关单测通过

/Users/dash/Code/XD/dash/Skills/git/scripts/run-unit-gate.sh /Users/dash/Code/Cindy/cindy-soften-remote-device-failure
结果:通过(GATE_EXIT=0)

pnpm check:i18n && pnpm check:i18n-glossary
结果:通过;仅报告仓库既有告警

git diff --check
结果:通过

手工验证

不涉及:本轮未启动 Desktop 实机预览;改动通过静态回归和自动门禁验证。

未执行的验证

Desktop 实机目检未执行,原因是本轮只收敛已有失败提示逻辑,且当前会话未要求启动预览实例。

风险

风险分类

  • 无已知风险
  • SQLite / migration
  • system prompt
  • 协议兼容
  • 权限 / 安全 / 用户数据
  • 存量插件兼容(批准状态 / 指纹 / manifest 校验 / 安装布局 / 包格式)
  • 原生层 / fingerprint / OTA
  • 跨平台差异
  • 其他:

影响与回滚

  • 影响范围:仅 Desktop renderer 的共享设备目录请求与侧栏呈现;失败时仍保留本地 / 缓存快照,按退避重试,且后台重试不改变已结算的机器选择或侧栏 loading 状态,成功后恢复正常状态。使用标准 renderer 定时器,不改变 macOS / Windows 的协议或 IPC 行为。
  • 回滚 / 降级方式:回滚本轮新增的静默重试提交即可恢复此前仅由 push / online / 手动入口触发的恢复路径;已有的无提示侧栏收敛改动不受影响。

提交前检查

  • 已 review 完整 diff
  • 每个 commit 都带 DCO 签名(git commit -s,见 DCO
  • UI 改动已在「UI 变化」注明引用的设计规范章节
  • 未提交凭证、令牌或授权文件
  • 已补充必要文档
  • 已确认测试结果或说明未执行原因

@dashhuang
dashhuang requested a review from a team as a code owner September 2, 2026 08:51
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-04T05:05:16.725106Z cae9e9f New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown

Greptile Summary

本 PR 隐藏 Desktop 侧栏中的远端设备目录失败提示,并移除手动重试按钮及五种语言的废弃文案。

  • 保留设备目录加载状态和远程任务失败提示
  • 删除设备目录完整失败及部分失败的两处 UI 分支
  • 更新静态回归断言,确认错误文案与重试入口不再出现
  • 同步移除五种语言中不再使用的三个翻译键

Confidence Score: 4/5

合并前应恢复设备目录请求失败后的确定性重试路径,否则一次独立 REST 故障就可能让远端设备目录长期为空或过期。

设备目录 REST 请求可能在连接 WebSocket 仍在线时失败,而现有 hook 没有轮询,删除唯一手动重试入口后也不保证会收到触发下一次刷新的状态事件。

Files Needing Attention: apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx

Important Files Changed

Filename Overview
apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx 删除设备目录错误提示和唯一手动重试入口后,独立 REST 瞬时失败可能使目录长期保持空或过期。
apps/desktop/src/renderer/tests/dialogueSidebarSection.test.ts 静态断言已与隐藏设备目录错误 UI 的预期同步,但没有覆盖失败后的恢复能力。
apps/desktop/src/renderer/tests/machineSwitcherMenu.test.ts 更新标题覆盖分支断言,明确设备目录 error 不再产生占位提示。
apps/desktop/src/renderer/i18n/locales/en/common.json 删除三项已无生产引用的设备目录失败与重试文案,其他语言文件保持同步。
Prompt To Fix All With AI
### Issue 1
apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx:3430
**设备目录失去恢复路径**

当 WebSocket 仍在线而设备目录 REST 请求单次返回 503 或网络错误,底层会进入 `error` 且不会定时重试;这里删除唯一的 `retryDeviceLinkDeviceList` 入口后,也没有状态事件保证再次刷新,导致远端设备目录一直为空或过期,直到无关状态变化或应用重启。

---

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

Reviews (1): Last reviewed commit: "fix(desktop): hide remote device load fa..." | Re-trigger Greptile

Comment thread apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
@MagicLizi MagicLizi added the touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) label Sep 2, 2026
@MagicLizi

Copy link
Copy Markdown
Contributor

命中 UI 路径(apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面(```html 代码块、.html 附件或在线预览链接),便于确认界面符合 DESIGN.md 设计规范。本次是隐藏远端设备加载失败提示,有侧栏相关截图更好。

@dashhuang

Copy link
Copy Markdown
Member Author

已在 PR 描述的「UI 变化」补充自包含 HTML 示意,明确断网或远端设备目录失败时不显示错误卡片、红色告警或重试按钮,同时保留本地与缓存内容。

@MagicLizi MagicLizi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码重审通过:侧栏不再用设备目录失败告警打断本地/缓存内容;任务失败提示仍在。当前 head 没有 P0/P1。

@dashhuang
dashhuang force-pushed the dash/soften-remote-device-failure branch from c6806e4 to 8743074 Compare September 2, 2026 10:47

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8743074cfb

ℹ️ 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".

Comment thread apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
@MagicLizi

Copy link
Copy Markdown
Contributor

@dashhuang 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aaf341a6c2

ℹ️ 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".

Comment thread apps/desktop/src/renderer/features/device-link/useDeviceLinkDeviceList.ts Outdated
@MagicLizi

Copy link
Copy Markdown
Contributor

@dashhuang 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/renderer/features/device-link/useDeviceLinkDeviceList.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@MagicLizi MagicLizi added the status:awaiting-bot-review 等外部审查机器人表态(review-pr 自动维护,仅展示) label Sep 4, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fc802c50bb

ℹ️ 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".

Comment thread apps/desktop/src/renderer/features/device-link/useDeviceLinkDeviceList.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b6b019b0f5

ℹ️ 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".

Comment thread apps/desktop/src/renderer/features/device-link/useDeviceLinkDeviceList.ts Outdated
@MagicLizi MagicLizi added status:ci-running CI 还在跑(review-pr 自动维护,仅展示) and removed status:awaiting-bot-review 等外部审查机器人表态(review-pr 自动维护,仅展示) labels Sep 4, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f1d5a9765

ℹ️ 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".

Comment thread apps/desktop/src/renderer/features/device-link/useDeviceLinkDeviceList.ts Outdated
Comment thread apps/desktop/src/renderer/features/device-link/useDeviceLinkDeviceList.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c659d04e63

ℹ️ 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".

@MagicLizi

Copy link
Copy Markdown
Contributor

@dashhuang 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/renderer/features/device-link/useDeviceLinkDeviceList.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@MagicLizi MagicLizi added status:awaiting-bot-review 等外部审查机器人表态(review-pr 自动维护,仅展示) and removed status:ci-running CI 还在跑(review-pr 自动维护,仅展示) labels Sep 4, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5a1edb7ad0

ℹ️ 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".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d52b8e873

ℹ️ 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".

@MagicLizi

Copy link
Copy Markdown
Contributor

@dashhuang 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/renderer/features/device-link/useDeviceLinkDeviceList.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
@dashhuang
dashhuang force-pushed the dash/soften-remote-device-failure branch from 9d52b8e to cae9e9f Compare September 4, 2026 05:01
@MagicLizi MagicLizi added status:ci-running CI 还在跑(review-pr 自动维护,仅展示) and removed status:awaiting-bot-review 等外部审查机器人表态(review-pr 自动维护,仅展示) status:ci-running CI 还在跑(review-pr 自动维护,仅展示) labels Sep 4, 2026

@MagicLizi MagicLizi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

独立代码审查通过:远端设备目录加载失败改为静默重试,任务失败告警仍保留。没有 P0/P1。

@MagicLizi
MagicLizi merged commit 53c0888 into main Sep 4, 2026
25 of 27 checks passed
@MagicLizi
MagicLizi deleted the dash/soften-remote-device-failure branch September 4, 2026 06:53
@MagicLizi

Copy link
Copy Markdown
Contributor

合了。设备目录加载失败不再弹一张吓人的错误卡,后台自己重试;真正的远端任务失败告警还在。

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.

3 participants