Skip to content

fix(desktop): 自动任务失败红点可处理,系统中止不再粘红 - #3291

Merged
MagicLizi merged 5 commits into
mainfrom
dash/automations-mark-all-read-menu
Aug 25, 2026
Merged

fix(desktop): 自动任务失败红点可处理,系统中止不再粘红#3291
MagicLizi merged 5 commits into
mainfrom
dash/automations-mark-all-read-menu

Conversation

@dashhuang

Copy link
Copy Markdown
Member

这次改了什么

摘要

自动任务侧栏红点有两套逻辑:失败未读会涂红,但点进任务后往往没有可忽略的横幅;组头点击还一律打开最新一次运行。账号切换或暂停计划把进行中的 run 掐成 aborted 时,红点会一直粘着。

这次把「标为已读」放到自动任务组头的更多菜单(有未读才出现),失败/中断打开后给出横幅;系统主动中止的 aborted 生而已读,不再当失败未读。

变更类型

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

范围

  • 关联 Issue / 需求:无
  • 本 PR 包含:
    • 组头 / 整行右键提供「标为已读」,只清这一组
    • failed / interrupted 未读打开后出现「这次自动任务没有完成」横幅,点「标为已读」才消红
    • 成功未读仍可看过即已读;失败未读不再被打开任务偷偷清掉
    • 收起且整组是红时,点组头打开贡献红点的那条,不再打开后来成功的巡检
    • 暂停 / 删除 / 调度器 stop 写成 aborted 时带上 readAt;存量未读 aborted 也不再涂红
  • 明确不包含:
    • 不伪造 error 消息行
    • 不把失败未读写进 sessionAttentionStore(避免污染 Dock)
    • 不做全库「全部自动任务标已读」的导航栏隐形菜单
  • 用户可见变化:自动任务组菜单多一项「标为已读」;真失败点进去有横幅;系统掐断不再留下消不掉的红点
  • 是否存在 breaking change:无

UI 变化

Desktop 侧栏自动任务组头菜单,以及任务输入框上方的失败未读横幅。未附截图。

  • 引用的设计规范:
    • docs/design-rules/DESIGN.md §2 Semantic & Accent:横幅复用已有 error token(--error-bg / --error-border / --error-fg / --error-fg-strong),与中断横幅同组,不新增语义色
    • docs/design-rules/DESIGN.md §10 Theme System:颜色只走 token,Light / Dark 随主题切换
    • docs/design-rules/DESIGN.md §1 Extreme content restraint:失败横幅只有一句说明 + 一个「标为已读」,没有「继续」
    • 组菜单复用既有 DropdownMenu 与组头 pill 行,不再用 0 尺寸隐形 trigger

怎么验证的

自动验证

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

pnpm --filter @cindy/maker-scheduler exec vitest run
结果:6 files / 208 tests 通过

pnpm --filter desktop exec vitest run \
  src/main/__tests__/interruptedContinuationContract.test.ts \
  src/renderer/__tests__/automationGeneratedSessions.test.ts \
  src/renderer/__tests__/mainListModel.test.ts \
  src/renderer/__tests__/projectCollapsedAttention.test.ts \
  src/renderer/features/cc-agent/sidebar/__tests__/automationGroupCollapsedAlerts.test.tsx
结果:通过

pnpm check:i18n-glossary
结果:无新增违规

bash /Users/dash/Code/XD/dash/Skills/git/scripts/run-unit-gate.sh <worktree>
结果:maker-scheduler 等 workspace 通过;desktop 仅 ghostInstallReceipt.test.ts 2 例失败。
该失败在当前 origin/main 干净基线同样复现,与本 PR diff 无关,交给 CI 给权威结论。

手工验证

不涉及。未启动 Desktop 实机点选组菜单 / 横幅(worktree 改动不会热更到正在跑的实例)。

未执行的验证

Desktop Light / Dark 实机目检未做。横幅与菜单复用已有 themed 组件和 error token,双模式实现已落地,但未目检。

风险

风险分类

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

影响与回滚

  • 影响范围:Desktop 自动任务侧栏红点、组菜单、任务内横幅;scheduler aborted 落库带 readAt
  • 回滚 / 降级方式:revert 本 PR。已写出的 aborted.readAt 只让那些 run 保持已读,不影响后续失败未读

提交前检查

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

@dashhuang
dashhuang requested a review from a team as a code owner August 23, 2026 08:38
@greptile-apps

greptile-apps Bot commented Aug 23, 2026

Copy link
Copy Markdown

Greptile Summary

此 PR 调整了 Desktop 自动任务失败状态的已读与展示流程,使失败任务可以显式处理,并避免系统中止产生持续红点。

  • 为自动任务组菜单增加“标为已读”,并在折叠组头优先打开贡献红点的运行
  • 为未读的 failed/interrupted 运行增加会话内横幅及单次运行已读处理
  • 将 aborted 运行视为已读,并在调度器取消路径写入 readAt
  • 扩展侧栏索引、分组状态、项目折叠提示和相关多语言资源与测试

Confidence Score: 5/5

当前未发现仍会阻止合并的故障,PR 看起来可以安全合并。

未发现仍然存在的阻塞性故障。

Important Files Changed

Filename Overview
packages/maker-scheduler/src/engine/scheduler.ts 在自动和手动运行的取消收尾路径中为 aborted 结果写入 readAt,并补充对应生命周期测试。
apps/desktop/src/renderer/features/scheduler/lib/runUnread.ts 统一定义运行未读及失败未读判定,使 aborted 不再进入未读集合。
apps/desktop/src/renderer/features/cc-agent/hooks/useAutomationScheduleSessionIndex.ts 扩展自动任务会话索引,向侧栏和会话视图提供失败未读运行及最新失败运行信息。
apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx 将未读失败运行横幅接入既有错误和中断处理界面,并支持仅处理当前失败运行。
apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx 接入自动任务组级“标为已读”操作,并协调运行未读与会话告警状态。
apps/desktop/src/renderer/features/cc-agent/sidebar/AutomationSessionGroupItem.tsx 增加组头更多菜单和右键入口,并在折叠红点状态下选择对应运行。
apps/desktop/src/main/scheduler-host/storage.ts 在侧栏轻量运行索引中补充 firedAt,以支持稳定的失败运行排序与选择。

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[自动任务运行结束] --> B{运行状态}
  B -->|success| C[打开后自动标为已读]
  B -->|failed / interrupted| D[侧栏红点与会话横幅]
  D --> E[用户显式标为已读]
  B -->|aborted| F[生而已读,不显示红点]
  C --> G[刷新侧栏索引]
  E --> G
  F --> G
Loading

Reviews (5): Last reviewed commit: "fix(desktop): 会话横幅只清当前失败 run,并等待标记结果" | Re-trigger Greptile

@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: c8b3ec5305

ℹ️ 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/i18n/locales/zh-CN/common.json 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: 3a8eff14c9

ℹ️ 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 Outdated
@MagicLizi MagicLizi added status:threads-open 还有未 resolve 的评审讨论(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) labels Aug 23, 2026
@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。

@dashhuang
dashhuang force-pushed the dash/automations-mark-all-read-menu branch from 3a8eff1 to 5b870ab Compare August 23, 2026 09:39

@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: 5b870abd72

ℹ️ 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/CCAgentSessionView.tsx
Comment thread apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx Outdated
@MagicLizi

Copy link
Copy Markdown
Contributor

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

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

@dashhuang
dashhuang force-pushed the dash/automations-mark-all-read-menu branch from 5b870ab to 9631a03 Compare August 23, 2026 11:28

@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: 9631a03c3f

ℹ️ 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/CCAgentSessionView.tsx Outdated
Comment thread apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx Outdated
@MagicLizi

Copy link
Copy Markdown
Contributor

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

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

@MagicLizi

Copy link
Copy Markdown
Contributor

命中 UI 路径(apps/desktop/src/renderer/components/chat/InterruptedTurnBanner.tsx / apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx / apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx 等)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面(```html 代码块、.html 附件或在线预览链接),便于确认界面符合 DESIGN.md 设计规范

把「标为已读」放到自动任务组头菜单;失败/中断打开后出横幅;
暂停、删除或切账号造成的 aborted 生而已读,不再留下消不掉的红点。

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Automation 不带「任务」;这条横幅说的是 schedule run,按命名规则用有前缀的「定时任务」。

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
markScheduleRunsReadAndSync 用 allSettled 吞掉单条 IPC 失败后,
原先仍按请求数提示已读。现在返回 processed/failed,只对成功条数 toast。

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
继续/忽略中断或错误横幅时一并 mark 该会话的未读失败 run,避免再弹出第二条横幅。
会话视图改为订阅侧栏已发布的索引,不再各自拉全量 listSidebarIndexRuns。

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
持久 session 上可能叠了多条未读失败。横幅和中断处置只 mark 最近一次;
标记失败时不隐藏原横幅。清整组仍走组菜单。

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
@dashhuang
dashhuang force-pushed the dash/automations-mark-all-read-menu branch from 9631a03 to 61ecdfa Compare August 23, 2026 12:48
@MagicLizi MagicLizi added status:ci-failed CI 失败(review-pr 自动维护,仅展示) and removed status:threads-open 还有未 resolve 的评审讨论(review-pr 自动维护,仅展示) status:ci-failed CI 失败(review-pr 自动维护,仅展示) labels Aug 23, 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.

按维护者指示批准;合并仍需通过 review-pr 的代码审查与其余安全门。

@MagicLizi
MagicLizi merged commit 2e3a11c into main Aug 25, 2026
25 of 27 checks passed
@MagicLizi
MagicLizi deleted the dash/automations-mark-all-read-menu branch August 25, 2026 02:03
@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.

2 participants