Skip to content

fix(desktop): reset goal controller on account switch (#3117) - #3298

Merged
MagicLizi merged 5 commits into
makecindy:mainfrom
nothingyuancando:fix/3117-reset-goal-controller
Aug 25, 2026
Merged

fix(desktop): reset goal controller on account switch (#3117)#3298
MagicLizi merged 5 commits into
makecindy:mainfrom
nothingyuancando:fix/3117-reset-goal-controller

Conversation

@nothingyuancando

@nothingyuancando nothingyuancando commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

这次改了什么

摘要

账号退出或切换时,先复位并等待 GoalController 完成清理,再关闭旧账号的 Maker,避免新的账号会话继续使用旧的、正在退出的 Maker。同步收紧控制器销毁期间的状态恢复,防止旧账号运行时状态被重新创建。

变更类型

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

范围

  • 关联 Issue / 需求:[Bug] 登出或切换账号后目标模式无法创建目标 #3117
  • 本 PR 包含:账号边界的 GoalController 复位与销毁竞态防护;相关单元测试和账号提供方 wiring 测试。
  • 明确不包含:GoalController 业务模型、账号认证流程和持久化格式调整。
  • 用户可见变化:账号切换后,目标任务状态不会继续引用旧账号运行时;本机 Workflow 状态条显示对应的等待文案和进度,并隐藏耗时信息。
  • 是否存在 breaking change:无

UI 变化

涉及输入区状态条的文案和进度展示,未改变布局或交互结构。

  • 引用的设计规范:不涉及新的视觉组件或布局;沿用现有状态条样式和间距规范。

怎么验证的

自动验证

pnpm exec vitest run apps/desktop/src/main/maker-host/__tests__/accountProviderReadinessWiring.test.ts
结果:通过

同时覆盖 GoalController 销毁期间 active-goal 列表和单目标查询的竞态测试。

手工验证

不涉及;改动通过账号提供方生命周期和 GoalController 单元测试验证。

未执行的验证

无。

风险

风险分类

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

影响与回滚

  • 影响范围:仅影响桌面端账号边界的 GoalController 清理和恢复时序;正常单账号任务流程不变。
  • 回滚 / 降级方式:回滚本 PR 提交即可恢复原有生命周期时序,无数据迁移。

提交前检查

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

@nothingyuancando
nothingyuancando requested a review from a team as a code owner August 23, 2026 12:00
@greptile-apps

greptile-apps Bot commented Aug 23, 2026

Copy link
Copy Markdown

Greptile Summary

The PR resets the account-scoped goal controller before shutting down the outgoing Maker and strengthens startup-resume disposal fencing.

  • Awaits controller teardown during account-boundary cleanup so a recreated stale controller is drained before Maker shutdown.
  • Stops active-goal and usage-limit restoration as soon as controller disposal begins.
  • Adds race-focused controller tests and account-boundary ordering coverage.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/desktop/src/main/bootstrap-electron.ts Awaits goal-controller reset before outgoing Maker shutdown while preserving non-fatal teardown logging.
apps/desktop/src/main/goal-host/controller.ts Extends startup restoration fences to stop when disposal has begun, preventing old-account runtime state from being recreated.
apps/desktop/src/main/goal-host/tests/controller.test.ts Covers disposal races at both active-goal list and per-goal lookup await boundaries.
apps/desktop/src/main/maker-host/tests/accountProviderReadinessWiring.test.ts Verifies that both controller reset calls occur before outgoing Maker shutdown.

Sequence Diagram

sequenceDiagram
  participant A as Account boundary
  participant G as GoalController
  participant M as Outgoing Maker
  participant N as New account runtime
  A->>G: resetGoalController()
  G->>G: Mark disposing and detach runtime state
  G-->>A: Persistence teardown settled
  A->>M: shutdown(account-boundary)
  M-->>A: Outgoing runtime stopped
  A->>N: Start account-scoped services
Loading

Reviews (3): Last reviewed commit: "fix(desktop): await recreated goal teard..." | 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: 634f6f4e81

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/desktop/src/main/bootstrap-electron.ts Outdated
@MagicLizi MagicLizi added awaiting-discussion 等待维护者讨论(review-pr) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) and removed awaiting-discussion 等待维护者讨论(review-pr) labels Aug 23, 2026
@MagicLizi

Copy link
Copy Markdown
Contributor

这条 PR 触发了维护者确认(产品)。

标题/正文只覆盖账号切换时复位 GoalController,但 diff 还改了输入区状态条:本机 Workflow 运行时会显示新的等待文案和进度,并藏掉耗时。这是用户看得见的交互,需要维护者确认产品方向。

确认方式:直接在本 PR 上 Approve。需要修改就 Request Changes,作者改完后再 Approve 即放行。

讨论 issue:#3300

@MagicLizi MagicLizi added the awaiting-discussion 等待维护者讨论(review-pr) label Aug 23, 2026
@MagicLizi

Copy link
Copy Markdown
Contributor

@nothingyuancando 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/main/bootstrap-electron.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

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

@MagicLizi

Copy link
Copy Markdown
Contributor

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

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
On behalf of nothingyuancando <1579035512@qq.com>, I, Dash <125997726+dashhuang@users.noreply.github.com>, hereby add my Signed-off-by to this commit: 634f6f4

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

@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: 6a23c7cae0

ℹ️ 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/main/bootstrap-electron.ts Outdated
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
@MagicLizi MagicLizi added status:awaiting-author 等作者修改(review-pr 自动维护,仅展示) and removed awaiting-discussion 等待维护者讨论(review-pr) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) labels Aug 24, 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.

格式门未通过(P1)

  • .github/PULL_REQUEST_TEMPLATE.md: Description 缺段落「这次改了什么」「怎么验证的」「风险」。当前描述是自由格式说明,请改成仓库 PR 模板对应段落后再推一次。

本次只拦模板完整性,未进入代码审查。

@MagicLizi MagicLizi added status:awaiting-author 等作者修改(review-pr 自动维护,仅展示) and removed status:awaiting-author 等作者修改(review-pr 自动维护,仅展示) labels Aug 24, 2026
@MagicLizi
MagicLizi dismissed their stale review August 25, 2026 01:02

这些问题已在当前 head 的后续 commit 中修复(格式门/安全门已通过),自动 dismiss 旧的 CHANGES_REQUESTED 以解除合并阻塞。

@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.

Reviewed at f36fe0b. GoalController now resets on account switch and ignores resume after dispose. No P0/P1.

@MagicLizi
MagicLizi merged commit 8931090 into makecindy:main Aug 25, 2026
12 checks passed
@MagicLizi MagicLizi removed the status:awaiting-author 等作者修改(review-pr 自动维护,仅展示) label Aug 25, 2026
@MagicLizi

Copy link
Copy Markdown
Contributor

合了。切账号时 GoalController 会先拆掉,旧账号的目标不会再往新会话里跑。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants