Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
您好——我发现了 4 个问题
面向 AI Agent 的提示
请处理此代码审查中的评论:
## 单条评论
### 评论 1
<location path="src/App.tsx" line_range="602" />
<code_context>
try {
+ // 在恢复更新状态或分发任务前确定退出策略,所有自动安装入口共用此状态。
+ const shouldQuit = isTauri() ? await invoke<boolean>('has_quit_after_run_flag') : false;
+ useAppStore.getState().setQuitAfterRun(shouldQuit);
log.info('加载 interface.json...');
</code_context>
<issue_to_address>
**IPC 调用失败会导致启动中止**
如果 Tauri 命令调用失败,`invoke` 会在 `loadInterface` 中被拒绝,导致其外层 catch 将应用设为错误状态,并跳过配置加载和任务分发;启动因此失败。
捕获命令调用失败,将 `shouldQuit` 默认设为 false,然后继续初始化。
</issue_to_address>
### 评论 2
<location path="src/App.tsx" line_range="1050-1056" />
<code_context>
- // 检查 -q/--quit-after-run 参数:任务完成后关闭自身
- const shouldQuit = await invoke<boolean>('has_quit_after_run_flag');
+ // -q/--quit-after-run:任务完成后关闭自身
if (shouldQuit) {
log.info('命令行 --quit-after-run 参数:任务完成后将关闭自身');
const unsub = useAppStore.subscribe(
</code_context>
<issue_to_address>
**任务运行期间会安装更新**
当一个可见的 `-q` 会话有待处理更新,且用户选择“立即安装”时,更新面板仍然可用;`UpdatePanel.handleInstallNow` 会将 `installStatus` 设为 `installing`,却没有遵循 `tryAutoInstallUpdate` 的保护逻辑,因此任务运行期间可能安装更新并重启。
阻止更新面板的“立即安装”操作在 `-q` 会话期间启动安装。
另见 `src/App.tsx:421`。
</issue_to_address>
### 评论 3
<location path="src/App.tsx" line_range="498" />
<code_context>
if (result.success) {
// 使用实际保存路径(可能与请求路径不同,如果从 302 重定向检测到正确文件名)
setDownloadSavePath(result.actualSavePath);
- setDownloadStatus('completed');
log.info('更新下载完成');
-
</code_context>
<issue_to_address>
**元数据保存失败会导致更新丢失**
保存待处理更新的元数据失败时(例如本地存储已满),`savePendingUpdateInfo` 虽然会捕获存储错误,但下载仍会被标记为已完成;在 `-q` 会话中,安装会被抑制,因此退出后下载包的路径没有持久化,下一次启动也无法提供该更新。
将待处理更新元数据持久化失败视为下载失败,或者在将下载标记为完成前,通过可靠的备用方式持久化元数据。
</issue_to_address>
### 评论 4
<location path="src/App.tsx" line_range="421" />
<code_context>
const state = useAppStore.getState();
+ // -q 会话始终优先在任务结束后退出,更新留给下次普通启动安装。
+ // 参数未读取时也不安装,避免初始化期间抢先触发。
+ if (state.quitAfterRun !== false) return;
if (state.downloadStatus !== 'completed') return;
if (state.installStatus !== 'idle') return;
</code_context>
<issue_to_address>
**待处理更新被搁置**
如果进程使用 `-q` 启动,但未配置有效的自动任务,`tryAutoInstallUpdate` 会抑制安装和弹窗,而待处理更新分支则直接返回、不执行安装;`dispatchPendingAutoStartTasks` 也不会做任何事,导致应用仍保持打开状态,更新既没有安装,也没有向用户展示。
当无法分发有效的自动任务时,使用常规的待处理更新流程。
另见 `src/App.tsx:1050-1056`、`src/App.tsx:1396`、`src/App.tsx:1416`。
</issue_to_address>Original comment in English
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/App.tsx" line_range="602" />
<code_context>
try {
+ // 在恢复更新状态或分发任务前确定退出策略,所有自动安装入口共用此状态。
+ const shouldQuit = isTauri() ? await invoke<boolean>('has_quit_after_run_flag') : false;
+ useAppStore.getState().setQuitAfterRun(shouldQuit);
log.info('加载 interface.json...');
</code_context>
<issue_to_address>
**Startup stops on IPC failure**
When the Tauri command invocation fails, `invoke` rejects inside `loadInterface`, so its outer catch sets the app to an error state and skips configuration loading and task dispatch; startup fails.
Catch the command failure, default `shouldQuit` to false, and continue initialization.
</issue_to_address>
### Comment 2
<location path="src/App.tsx" line_range="1050-1056" />
<code_context>
- // 检查 -q/--quit-after-run 参数:任务完成后关闭自身
- const shouldQuit = await invoke<boolean>('has_quit_after_run_flag');
+ // -q/--quit-after-run:任务完成后关闭自身
if (shouldQuit) {
log.info('命令行 --quit-after-run 参数:任务完成后将关闭自身');
const unsub = useAppStore.subscribe(
</code_context>
<issue_to_address>
**Updates install during tasks**
When a visible `-q` session has a pending update and the user selects Install Now, the update panel remains available, and `UpdatePanel.handleInstallNow` sets `installStatus` to `installing` without honoring the `tryAutoInstallUpdate` guard, so the update can install and restart while the task is running.
Prevent the update panel's Install Now action from starting an installation during a `-q` session.
Also at `src/App.tsx:421`.
</issue_to_address>
### Comment 3
<location path="src/App.tsx" line_range="498" />
<code_context>
if (result.success) {
// 使用实际保存路径(可能与请求路径不同,如果从 302 重定向检测到正确文件名)
setDownloadSavePath(result.actualSavePath);
- setDownloadStatus('completed');
log.info('更新下载完成');
-
</code_context>
<issue_to_address>
**Failed metadata save loses update**
When saving pending-update metadata fails, such as when local storage is full, `savePendingUpdateInfo` catches storage errors, but the download is still marked completed; in a `-q` session installation is suppressed, so exiting leaves no persisted path for the downloaded package and the next launch cannot offer it.
Treat failure to persist pending-update metadata as a download failure, or persist the metadata through a durable fallback before marking the download complete.
</issue_to_address>
### Comment 4
<location path="src/App.tsx" line_range="421" />
<code_context>
const state = useAppStore.getState();
+ // -q 会话始终优先在任务结束后退出,更新留给下次普通启动安装。
+ // 参数未读取时也不安装,避免初始化期间抢先触发。
+ if (state.quitAfterRun !== false) return;
if (state.downloadStatus !== 'completed') return;
if (state.installStatus !== 'idle') return;
</code_context>
<issue_to_address>
**Pending updates are stranded**
When the process is launched with `-q` but no valid automatic task is configured, `tryAutoInstallUpdate` suppresses installation and the modal, while the pending-update branch returns without installing; `dispatchPendingAutoStartTasks` does nothing, leaving the app open with the update neither installed nor offered.
Use the normal pending-update flow when no valid automatic task can be dispatched.
Also at `src/App.tsx:1050-1056`, `src/App.tsx:1396`, `src/App.tsx:1416`.
</issue_to_address>
Contributor
Author
|
MaaEnd/MaaEnd#6808 关于静默更新的一个Ref Issue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #364
现在-q参数和任务结束闲时安装更新竞态了,需要规定一下
修改为优先退出,下次启动安装并重启
另外之前群里有个想法是删掉下载进度条和闲时安装,统一在启动时更新,减少一些UX困惑()
Sourcery 摘要
对于运行后退出的会话,推迟安装更新,以便任务能够正常退出,并在下次常规启动时安装更新。
Bug 修复:
--quit-after-run会话与更新安装发生竞争。增强功能:
Original summary in English
Sourcery 摘要
确保在“运行后退出”会话中优先完成任务,并将已下载更新的安装推迟到下次正常启动时进行。
Bug 修复:
--quit-after-run会话期间推迟安装更新,使任务能够正常退出,并在下次正常启动时安装待处理的更新。增强功能:
--quit-after-run会话状态,并在受管理任务运行期间隐藏更新安装提示和完成对话框。Original summary in English
Summary by Sourcery
Ensure quit-after-run sessions prioritize task completion while deferring downloaded update installation until the next normal startup.
Bug Fixes:
--quit-after-runsessions so tasks can exit cleanly and pending updates are installed on the next normal launch.Enhancements:
--quit-after-runsession state and suppress update installation prompts and completion dialogs while managed tasks are running.