Skip to content

perf: 清理日志时同时清理vision与on_error - #314

Merged
MistEO merged 1 commit into
MistEO:mainfrom
zmdyy0318:perf/2026080501
Aug 5, 2026
Merged

perf: 清理日志时同时清理vision与on_error#314
MistEO merged 1 commit into
MistEO:mainfrom
zmdyy0318:perf/2026080501

Conversation

@zmdyy0318

@zmdyy0318 zmdyy0318 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

close MaaEnd/MaaEnd#4771
close MaaEnd/MaaEnd#4531
opus5.0

Summary by Sourcery

扩展日志清理功能,在保留目录结构的前提下清理调试工件目录

Enhancements:

  • 增加支持在清理日志文件的同时,清理 on_error 和视觉调试工件目录
  • 保留调试工件目录本身,以保持与 MaaFW 的 save_on_error 行为兼容
  • 改进启动时自动清理日志的日志消息,以反映调试工件被删除的情况

Documentation:

  • 更新所有受支持语言中的“自动清理运行时日志”设置说明,注明会清理 on_error 及视觉调试截图
Original summary in English

Summary by Sourcery

Extend log cleanup to also clear debug artifact directories while preserving their structure

Enhancements:

  • Add support for clearing on_error and vision debug artifact directories alongside log files during cleanup
  • Preserve debug artifact directories themselves to remain compatible with MaaFW save_on_error behavior
  • Improve auto-clear logs on launch logging message to reflect deletion of debug artifacts

Documentation:

  • Update auto-clear runtime logs setting description across all supported locales to mention cleanup of on_error and vision debug screenshots

@sourcery-ai sourcery-ai Bot 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.

Hey - 我发现了 1 个问题,并提供了一些高层次的反馈:

  • 当前 i18n 提示字符串里把 on_errorvision 写死了,而代码使用的是 DEBUG_ARTIFACT_DIRS;建议从该常量自动生成文案,或者让提示文本更通用一些,这样当调试目录集合变化时,就不需要在多个地方同步更新。
  • clear_debug_artifact_dir 目前记录的日志是 "Failed to read debug dir" 和 "debug entry",但这个函数其实适用于任何 artifact 目录;建议把日志消息写得更通用一些,以便复用这个 helper 时不会引起困惑。
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The i18n hint strings now hardcode `on_error` and `vision`, while the code uses `DEBUG_ARTIFACT_DIRS`; consider deriving the wording from that constant or keeping the hint text generic so you don’t need to update multiple places when the set of debug directories changes.
- `clear_debug_artifact_dir` logs "Failed to read debug dir" and "debug entry" but is actually suitable for any artifact directory; consider making the log messages more generic to avoid confusion when this helper is reused.

## Individual Comments

### Comment 1
<location path="src/i18n/locales/en-US.ts" line_range="130-131" />
<code_context>
     autoClearLogsOnLaunch: 'Auto-clear Runtime Logs',
     autoClearLogsOnLaunchHint:
-      'Automatically clear runtime logs and delete old log files every time the project is launched',
+      'Automatically clear runtime logs and delete old log files along with debug screenshots in on_error and vision every time the project is launched',
   },

</code_context>
<issue_to_address>
**suggestion:** Description mentions only screenshots while implementation deletes all artifacts in those dirs

Since the backend deletes all artifacts under `on_error` and `vision`, not just screenshots, the current wording can become misleading if other files are present now or in future. Please use a more general term (e.g. “debug artifacts” or “debug files”) so the label matches the actual behavior.

```suggestion
    autoClearLogsOnLaunchHint:
      'Automatically clear runtime logs and delete old log files along with debug artifacts in on_error and vision every time the project is launched',
```
</issue_to_address>

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

Hey - I've found 1 issue, and left some high level feedback:

  • The i18n hint strings now hardcode on_error and vision, while the code uses DEBUG_ARTIFACT_DIRS; consider deriving the wording from that constant or keeping the hint text generic so you don’t need to update multiple places when the set of debug directories changes.
  • clear_debug_artifact_dir logs "Failed to read debug dir" and "debug entry" but is actually suitable for any artifact directory; consider making the log messages more generic to avoid confusion when this helper is reused.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The i18n hint strings now hardcode `on_error` and `vision`, while the code uses `DEBUG_ARTIFACT_DIRS`; consider deriving the wording from that constant or keeping the hint text generic so you don’t need to update multiple places when the set of debug directories changes.
- `clear_debug_artifact_dir` logs "Failed to read debug dir" and "debug entry" but is actually suitable for any artifact directory; consider making the log messages more generic to avoid confusion when this helper is reused.

## Individual Comments

### Comment 1
<location path="src/i18n/locales/en-US.ts" line_range="130-131" />
<code_context>
     autoClearLogsOnLaunch: 'Auto-clear Runtime Logs',
     autoClearLogsOnLaunchHint:
-      'Automatically clear runtime logs and delete old log files every time the project is launched',
+      'Automatically clear runtime logs and delete old log files along with debug screenshots in on_error and vision every time the project is launched',
   },

</code_context>
<issue_to_address>
**suggestion:** Description mentions only screenshots while implementation deletes all artifacts in those dirs

Since the backend deletes all artifacts under `on_error` and `vision`, not just screenshots, the current wording can become misleading if other files are present now or in future. Please use a more general term (e.g. “debug artifacts” or “debug files”) so the label matches the actual behavior.

```suggestion
    autoClearLogsOnLaunchHint:
      'Automatically clear runtime logs and delete old log files along with debug artifacts in on_error and vision every time the project is launched',
```
</issue_to_address>

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.

Comment thread src/i18n/locales/en-US.ts
@MistEO
MistEO merged commit 5b3a685 into MistEO:main Aug 5, 2026
8 checks passed
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.

自动清理日志缓存 日志包太大了,要开始传不动了,是否有可能优化一下

2 participants