Skip to content

Conversation

@niechy
Copy link
Contributor

@niechy niechy commented Feb 11, 2026

Summary by Sourcery

允许已配置的实例在启用相应选项时,既可在系统自启动时自动运行,也可在手动启动应用时自动运行

Bug Fixes:

  • 确保当启用了“run on manual launch”选项时,在手动启动应用时任务也会自动运行,而不仅仅是在系统自启动时运行

Enhancements:

  • 统一自启动和手动启动的自动运行触发逻辑,并改进这些流程的日志记录信息
Original summary in English

Summary by Sourcery

Allow configured instances to auto-run both on system autostart and on manual app launch when the corresponding option is enabled

Bug Fixes:

  • Ensure tasks auto-run when the app is launched manually if the "run on manual launch" option is enabled, in addition to existing system autostart behavior

Enhancements:

  • Unify the auto-run trigger logic for autostart and manual launch and improve logging messages for these flows

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - 我在这里给出了一些总体反馈:

  • 在分发 mxu-start-tasks 事件时,你仍然将 { source: 'autostart' } 写死;建议使用你为日志消息计算出来的同一个 source 值,这样下游使用方就可以区分是开机自启动还是手动启动的自动运行。
  • 你现在在这一段代码中多次调用 useAppStore.getState()(分别读取 autoStartInstanceIdautoRunOnLaunchinstances);把 state 缓存到一个局部变量里可以简化代码并避免重复调用。
面向 AI Agent 的提示词
Please address the comments from this code review:

## Overall Comments
- When dispatching the `mxu-start-tasks` event you still hardcode `{ source: 'autostart' }`; consider using the same `source` value you compute for the log message so downstream consumers can distinguish between boot autostart and manual-launch auto-run.
- You now call `useAppStore.getState()` multiple times in this block (to read `autoStartInstanceId`, `autoRunOnLaunch`, and `instances`); caching the state in a local variable would simplify the code and avoid repeated calls.

Sourcery 对开源项目是免费的 —— 如果你觉得我们的代码评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈来改进后续的代码评审。
Original comment in English

Hey - I've left some high level feedback:

  • When dispatching the mxu-start-tasks event you still hardcode { source: 'autostart' }; consider using the same source value you compute for the log message so downstream consumers can distinguish between boot autostart and manual-launch auto-run.
  • You now call useAppStore.getState() multiple times in this block (to read autoStartInstanceId, autoRunOnLaunch, and instances); caching the state in a local variable would simplify the code and avoid repeated calls.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- When dispatching the `mxu-start-tasks` event you still hardcode `{ source: 'autostart' }`; consider using the same `source` value you compute for the log message so downstream consumers can distinguish between boot autostart and manual-launch auto-run.
- You now call `useAppStore.getState()` multiple times in this block (to read `autoStartInstanceId`, `autoRunOnLaunch`, and `instances`); caching the state in a local variable would simplify the code and avoid repeated calls.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

1 participant