Skip to content

ci harden dmg cleanup with pre-detach sleep and holder kill#25

Merged
zouyonghe merged 5 commits into
AstrBotDevs:mainfrom
zouyonghe:main
Feb 21, 2026
Merged

ci harden dmg cleanup with pre-detach sleep and holder kill#25
zouyonghe merged 5 commits into
AstrBotDevs:mainfrom
zouyonghe:main

Conversation

@zouyonghe
Copy link
Copy Markdown
Member

@zouyonghe zouyonghe commented Feb 21, 2026

Summary by Sourcery

通过增加可配置的计时控制、防御性卸载逻辑,以及可选的挂载持有进程终止机制,并将这些控制接入桌面 Tauri 构建工作流,提升 CI 中 macOS DMG 清理流程的健壮性。

Bug 修复:

  • 为 DMG 卸载(detach)计时选项添加有上限的预卸载休眠时间以及数值范围校验,以减少 macOS DMG 卸载操作的不稳定性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并可选地终止持有该挂载的进程,以避免卸载失败。
  • 在使用 lsof 扫描挂载持有进程时应用可配置的超时时间,并提供多种后端实现,以防止 lsof 发生卡死。

CI:

  • 在桌面 Tauri 构建工作流中暴露环境变量,用于配置 macOS DMG 卸载行为,包括预休眠时长、尝试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

Improve robustness of macOS DMG cleanup in CI by adding configurable timing controls, defensive unmount logic, and optional killing of mount-holder processes, and wire these controls into the desktop Tauri build workflow.

Bug Fixes:

  • Add bounded pre-detach sleep and numeric range validation for DMG detach timing options to reduce flakiness in macOS DMG unmount operations.
  • Force-unmount stale DMG mounts using diskutil/hdiutil and optionally terminate processes holding the mount to avoid detach failures.
  • Apply a configurable timeout with multiple backend implementations to lsof when scanning for mount-holder processes to prevent it from hanging.

CI:

  • Expose environment variables in the desktop Tauri build workflow to configure macOS DMG detach behavior, including pre-sleep duration, number of attempts, retry interval, lsof timeout, and whether to allow global helper process termination.
Original summary in English

Summary by Sourcery

通过增加可配置的计时控制、防御性卸载逻辑,以及可选的挂载持有进程终止机制,并将这些控制接入桌面 Tauri 构建工作流,提升 CI 中 macOS DMG 清理流程的健壮性。

Bug 修复:

  • 为 DMG 卸载(detach)计时选项添加有上限的预卸载休眠时间以及数值范围校验,以减少 macOS DMG 卸载操作的不稳定性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并可选地终止持有该挂载的进程,以避免卸载失败。
  • 在使用 lsof 扫描挂载持有进程时应用可配置的超时时间,并提供多种后端实现,以防止 lsof 发生卡死。

CI:

  • 在桌面 Tauri 构建工作流中暴露环境变量,用于配置 macOS DMG 卸载行为,包括预休眠时长、尝试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

Improve robustness of macOS DMG cleanup in CI by adding configurable timing controls, defensive unmount logic, and optional killing of mount-holder processes, and wire these controls into the desktop Tauri build workflow.

Bug Fixes:

  • Add bounded pre-detach sleep and numeric range validation for DMG detach timing options to reduce flakiness in macOS DMG unmount operations.
  • Force-unmount stale DMG mounts using diskutil/hdiutil and optionally terminate processes holding the mount to avoid detach failures.
  • Apply a configurable timeout with multiple backend implementations to lsof when scanning for mount-holder processes to prevent it from hanging.

CI:

  • Expose environment variables in the desktop Tauri build workflow to configure macOS DMG detach behavior, including pre-sleep duration, number of attempts, retry interval, lsof timeout, and whether to allow global helper process termination.

Bug 修复:

  • 通过添加有上限的预卸载等待时间,并对与时间相关的选项强制使用数值范围,提升 macOS DMG 卸载操作的稳健性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并在允许的情况下终止占用该挂载点的进程,从而减少卸载失败。
  • 通过对 lsof 在检测挂载占用进程时施加可配置的超时时间,并提供多种后端实现,防止 lsof 长时间运行或卡死。

CI:

  • 在 desktop Tauri 构建工作流中暴露环境变量,用于配置 DMG 卸载行为,包括预等待时间、重试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

通过增加可配置的计时控制、防御性卸载逻辑,以及可选的挂载持有进程终止机制,并将这些控制接入桌面 Tauri 构建工作流,提升 CI 中 macOS DMG 清理流程的健壮性。

Bug 修复:

  • 为 DMG 卸载(detach)计时选项添加有上限的预卸载休眠时间以及数值范围校验,以减少 macOS DMG 卸载操作的不稳定性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并可选地终止持有该挂载的进程,以避免卸载失败。
  • 在使用 lsof 扫描挂载持有进程时应用可配置的超时时间,并提供多种后端实现,以防止 lsof 发生卡死。

CI:

  • 在桌面 Tauri 构建工作流中暴露环境变量,用于配置 macOS DMG 卸载行为,包括预休眠时长、尝试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

Improve robustness of macOS DMG cleanup in CI by adding configurable timing controls, defensive unmount logic, and optional killing of mount-holder processes, and wire these controls into the desktop Tauri build workflow.

Bug Fixes:

  • Add bounded pre-detach sleep and numeric range validation for DMG detach timing options to reduce flakiness in macOS DMG unmount operations.
  • Force-unmount stale DMG mounts using diskutil/hdiutil and optionally terminate processes holding the mount to avoid detach failures.
  • Apply a configurable timeout with multiple backend implementations to lsof when scanning for mount-holder processes to prevent it from hanging.

CI:

  • Expose environment variables in the desktop Tauri build workflow to configure macOS DMG detach behavior, including pre-sleep duration, number of attempts, retry interval, lsof timeout, and whether to allow global helper process termination.
Original summary in English

Summary by Sourcery

通过增加可配置的计时控制、防御性卸载逻辑,以及可选的挂载持有进程终止机制,并将这些控制接入桌面 Tauri 构建工作流,提升 CI 中 macOS DMG 清理流程的健壮性。

Bug 修复:

  • 为 DMG 卸载(detach)计时选项添加有上限的预卸载休眠时间以及数值范围校验,以减少 macOS DMG 卸载操作的不稳定性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并可选地终止持有该挂载的进程,以避免卸载失败。
  • 在使用 lsof 扫描挂载持有进程时应用可配置的超时时间,并提供多种后端实现,以防止 lsof 发生卡死。

CI:

  • 在桌面 Tauri 构建工作流中暴露环境变量,用于配置 macOS DMG 卸载行为,包括预休眠时长、尝试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

Improve robustness of macOS DMG cleanup in CI by adding configurable timing controls, defensive unmount logic, and optional killing of mount-holder processes, and wire these controls into the desktop Tauri build workflow.

Bug Fixes:

  • Add bounded pre-detach sleep and numeric range validation for DMG detach timing options to reduce flakiness in macOS DMG unmount operations.
  • Force-unmount stale DMG mounts using diskutil/hdiutil and optionally terminate processes holding the mount to avoid detach failures.
  • Apply a configurable timeout with multiple backend implementations to lsof when scanning for mount-holder processes to prevent it from hanging.

CI:

  • Expose environment variables in the desktop Tauri build workflow to configure macOS DMG detach behavior, including pre-sleep duration, number of attempts, retry interval, lsof timeout, and whether to allow global helper process termination.

Bug 修复:

  • 通过添加有界的卸载前休眠时间,并对与时间相关的选项施加数值范围限制,提高 macOS DMG 卸载操作的可靠性。
  • 通过使用 diskutil 强制卸载,并在允许的情况下终止占用挂载点的进程,确保可以更可靠地卸载陈旧的 DMG 挂载点。

CI:

  • 在桌面端 Tauri 构建工作流中暴露环境变量,用于配置 DMG 卸载行为,包括卸载前休眠时长、重试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

通过增加可配置的计时控制、防御性卸载逻辑,以及可选的挂载持有进程终止机制,并将这些控制接入桌面 Tauri 构建工作流,提升 CI 中 macOS DMG 清理流程的健壮性。

Bug 修复:

  • 为 DMG 卸载(detach)计时选项添加有上限的预卸载休眠时间以及数值范围校验,以减少 macOS DMG 卸载操作的不稳定性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并可选地终止持有该挂载的进程,以避免卸载失败。
  • 在使用 lsof 扫描挂载持有进程时应用可配置的超时时间,并提供多种后端实现,以防止 lsof 发生卡死。

CI:

  • 在桌面 Tauri 构建工作流中暴露环境变量,用于配置 macOS DMG 卸载行为,包括预休眠时长、尝试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

Improve robustness of macOS DMG cleanup in CI by adding configurable timing controls, defensive unmount logic, and optional killing of mount-holder processes, and wire these controls into the desktop Tauri build workflow.

Bug Fixes:

  • Add bounded pre-detach sleep and numeric range validation for DMG detach timing options to reduce flakiness in macOS DMG unmount operations.
  • Force-unmount stale DMG mounts using diskutil/hdiutil and optionally terminate processes holding the mount to avoid detach failures.
  • Apply a configurable timeout with multiple backend implementations to lsof when scanning for mount-holder processes to prevent it from hanging.

CI:

  • Expose environment variables in the desktop Tauri build workflow to configure macOS DMG detach behavior, including pre-sleep duration, number of attempts, retry interval, lsof timeout, and whether to allow global helper process termination.
Original summary in English

Summary by Sourcery

通过增加可配置的计时控制、防御性卸载逻辑,以及可选的挂载持有进程终止机制,并将这些控制接入桌面 Tauri 构建工作流,提升 CI 中 macOS DMG 清理流程的健壮性。

Bug 修复:

  • 为 DMG 卸载(detach)计时选项添加有上限的预卸载休眠时间以及数值范围校验,以减少 macOS DMG 卸载操作的不稳定性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并可选地终止持有该挂载的进程,以避免卸载失败。
  • 在使用 lsof 扫描挂载持有进程时应用可配置的超时时间,并提供多种后端实现,以防止 lsof 发生卡死。

CI:

  • 在桌面 Tauri 构建工作流中暴露环境变量,用于配置 macOS DMG 卸载行为,包括预休眠时长、尝试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

Improve robustness of macOS DMG cleanup in CI by adding configurable timing controls, defensive unmount logic, and optional killing of mount-holder processes, and wire these controls into the desktop Tauri build workflow.

Bug Fixes:

  • Add bounded pre-detach sleep and numeric range validation for DMG detach timing options to reduce flakiness in macOS DMG unmount operations.
  • Force-unmount stale DMG mounts using diskutil/hdiutil and optionally terminate processes holding the mount to avoid detach failures.
  • Apply a configurable timeout with multiple backend implementations to lsof when scanning for mount-holder processes to prevent it from hanging.

CI:

  • Expose environment variables in the desktop Tauri build workflow to configure macOS DMG detach behavior, including pre-sleep duration, number of attempts, retry interval, lsof timeout, and whether to allow global helper process termination.

Bug 修复:

  • 通过添加有上限的预卸载等待时间,并对与时间相关的选项强制使用数值范围,提升 macOS DMG 卸载操作的稳健性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并在允许的情况下终止占用该挂载点的进程,从而减少卸载失败。
  • 通过对 lsof 在检测挂载占用进程时施加可配置的超时时间,并提供多种后端实现,防止 lsof 长时间运行或卡死。

CI:

  • 在 desktop Tauri 构建工作流中暴露环境变量,用于配置 DMG 卸载行为,包括预等待时间、重试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

通过增加可配置的计时控制、防御性卸载逻辑,以及可选的挂载持有进程终止机制,并将这些控制接入桌面 Tauri 构建工作流,提升 CI 中 macOS DMG 清理流程的健壮性。

Bug 修复:

  • 为 DMG 卸载(detach)计时选项添加有上限的预卸载休眠时间以及数值范围校验,以减少 macOS DMG 卸载操作的不稳定性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并可选地终止持有该挂载的进程,以避免卸载失败。
  • 在使用 lsof 扫描挂载持有进程时应用可配置的超时时间,并提供多种后端实现,以防止 lsof 发生卡死。

CI:

  • 在桌面 Tauri 构建工作流中暴露环境变量,用于配置 macOS DMG 卸载行为,包括预休眠时长、尝试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

Improve robustness of macOS DMG cleanup in CI by adding configurable timing controls, defensive unmount logic, and optional killing of mount-holder processes, and wire these controls into the desktop Tauri build workflow.

Bug Fixes:

  • Add bounded pre-detach sleep and numeric range validation for DMG detach timing options to reduce flakiness in macOS DMG unmount operations.
  • Force-unmount stale DMG mounts using diskutil/hdiutil and optionally terminate processes holding the mount to avoid detach failures.
  • Apply a configurable timeout with multiple backend implementations to lsof when scanning for mount-holder processes to prevent it from hanging.

CI:

  • Expose environment variables in the desktop Tauri build workflow to configure macOS DMG detach behavior, including pre-sleep duration, number of attempts, retry interval, lsof timeout, and whether to allow global helper process termination.
Original summary in English

Summary by Sourcery

通过增加可配置的计时控制、防御性卸载逻辑,以及可选的挂载持有进程终止机制,并将这些控制接入桌面 Tauri 构建工作流,提升 CI 中 macOS DMG 清理流程的健壮性。

Bug 修复:

  • 为 DMG 卸载(detach)计时选项添加有上限的预卸载休眠时间以及数值范围校验,以减少 macOS DMG 卸载操作的不稳定性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并可选地终止持有该挂载的进程,以避免卸载失败。
  • 在使用 lsof 扫描挂载持有进程时应用可配置的超时时间,并提供多种后端实现,以防止 lsof 发生卡死。

CI:

  • 在桌面 Tauri 构建工作流中暴露环境变量,用于配置 macOS DMG 卸载行为,包括预休眠时长、尝试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

Improve robustness of macOS DMG cleanup in CI by adding configurable timing controls, defensive unmount logic, and optional killing of mount-holder processes, and wire these controls into the desktop Tauri build workflow.

Bug Fixes:

  • Add bounded pre-detach sleep and numeric range validation for DMG detach timing options to reduce flakiness in macOS DMG unmount operations.
  • Force-unmount stale DMG mounts using diskutil/hdiutil and optionally terminate processes holding the mount to avoid detach failures.
  • Apply a configurable timeout with multiple backend implementations to lsof when scanning for mount-holder processes to prevent it from hanging.

CI:

  • Expose environment variables in the desktop Tauri build workflow to configure macOS DMG detach behavior, including pre-sleep duration, number of attempts, retry interval, lsof timeout, and whether to allow global helper process termination.

Bug 修复:

  • 通过添加可配置的分离前休眠时间并限制其取值范围,提高 macOS DMG 分离操作的可靠性。
  • 当常规分离尝试失败时,使用 diskutilhdiutil 强制卸载 DMG 挂载点。
  • 在尝试分离前终止占用陈旧 DMG 挂载点的进程,以避免分离失败。

CI:

  • 通过环境变量在桌面 Tauri 构建工作流中配置 macOS DMG 分离行为,包括预休眠时长、尝试次数、休眠间隔,以及是否允许全局终止 helper 进程。
Original summary in English

Summary by Sourcery

通过增加可配置的计时控制、防御性卸载逻辑,以及可选的挂载持有进程终止机制,并将这些控制接入桌面 Tauri 构建工作流,提升 CI 中 macOS DMG 清理流程的健壮性。

Bug 修复:

  • 为 DMG 卸载(detach)计时选项添加有上限的预卸载休眠时间以及数值范围校验,以减少 macOS DMG 卸载操作的不稳定性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并可选地终止持有该挂载的进程,以避免卸载失败。
  • 在使用 lsof 扫描挂载持有进程时应用可配置的超时时间,并提供多种后端实现,以防止 lsof 发生卡死。

CI:

  • 在桌面 Tauri 构建工作流中暴露环境变量,用于配置 macOS DMG 卸载行为,包括预休眠时长、尝试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

Improve robustness of macOS DMG cleanup in CI by adding configurable timing controls, defensive unmount logic, and optional killing of mount-holder processes, and wire these controls into the desktop Tauri build workflow.

Bug Fixes:

  • Add bounded pre-detach sleep and numeric range validation for DMG detach timing options to reduce flakiness in macOS DMG unmount operations.
  • Force-unmount stale DMG mounts using diskutil/hdiutil and optionally terminate processes holding the mount to avoid detach failures.
  • Apply a configurable timeout with multiple backend implementations to lsof when scanning for mount-holder processes to prevent it from hanging.

CI:

  • Expose environment variables in the desktop Tauri build workflow to configure macOS DMG detach behavior, including pre-sleep duration, number of attempts, retry interval, lsof timeout, and whether to allow global helper process termination.
Original summary in English

Summary by Sourcery

通过增加可配置的计时控制、防御性卸载逻辑,以及可选的挂载持有进程终止机制,并将这些控制接入桌面 Tauri 构建工作流,提升 CI 中 macOS DMG 清理流程的健壮性。

Bug 修复:

  • 为 DMG 卸载(detach)计时选项添加有上限的预卸载休眠时间以及数值范围校验,以减少 macOS DMG 卸载操作的不稳定性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并可选地终止持有该挂载的进程,以避免卸载失败。
  • 在使用 lsof 扫描挂载持有进程时应用可配置的超时时间,并提供多种后端实现,以防止 lsof 发生卡死。

CI:

  • 在桌面 Tauri 构建工作流中暴露环境变量,用于配置 macOS DMG 卸载行为,包括预休眠时长、尝试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

Improve robustness of macOS DMG cleanup in CI by adding configurable timing controls, defensive unmount logic, and optional killing of mount-holder processes, and wire these controls into the desktop Tauri build workflow.

Bug Fixes:

  • Add bounded pre-detach sleep and numeric range validation for DMG detach timing options to reduce flakiness in macOS DMG unmount operations.
  • Force-unmount stale DMG mounts using diskutil/hdiutil and optionally terminate processes holding the mount to avoid detach failures.
  • Apply a configurable timeout with multiple backend implementations to lsof when scanning for mount-holder processes to prevent it from hanging.

CI:

  • Expose environment variables in the desktop Tauri build workflow to configure macOS DMG detach behavior, including pre-sleep duration, number of attempts, retry interval, lsof timeout, and whether to allow global helper process termination.

Bug 修复:

  • 通过添加有上限的预卸载等待时间,并对与时间相关的选项强制使用数值范围,提升 macOS DMG 卸载操作的稳健性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并在允许的情况下终止占用该挂载点的进程,从而减少卸载失败。
  • 通过对 lsof 在检测挂载占用进程时施加可配置的超时时间,并提供多种后端实现,防止 lsof 长时间运行或卡死。

CI:

  • 在 desktop Tauri 构建工作流中暴露环境变量,用于配置 DMG 卸载行为,包括预等待时间、重试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

通过增加可配置的计时控制、防御性卸载逻辑,以及可选的挂载持有进程终止机制,并将这些控制接入桌面 Tauri 构建工作流,提升 CI 中 macOS DMG 清理流程的健壮性。

Bug 修复:

  • 为 DMG 卸载(detach)计时选项添加有上限的预卸载休眠时间以及数值范围校验,以减少 macOS DMG 卸载操作的不稳定性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并可选地终止持有该挂载的进程,以避免卸载失败。
  • 在使用 lsof 扫描挂载持有进程时应用可配置的超时时间,并提供多种后端实现,以防止 lsof 发生卡死。

CI:

  • 在桌面 Tauri 构建工作流中暴露环境变量,用于配置 macOS DMG 卸载行为,包括预休眠时长、尝试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

Improve robustness of macOS DMG cleanup in CI by adding configurable timing controls, defensive unmount logic, and optional killing of mount-holder processes, and wire these controls into the desktop Tauri build workflow.

Bug Fixes:

  • Add bounded pre-detach sleep and numeric range validation for DMG detach timing options to reduce flakiness in macOS DMG unmount operations.
  • Force-unmount stale DMG mounts using diskutil/hdiutil and optionally terminate processes holding the mount to avoid detach failures.
  • Apply a configurable timeout with multiple backend implementations to lsof when scanning for mount-holder processes to prevent it from hanging.

CI:

  • Expose environment variables in the desktop Tauri build workflow to configure macOS DMG detach behavior, including pre-sleep duration, number of attempts, retry interval, lsof timeout, and whether to allow global helper process termination.
Original summary in English

Summary by Sourcery

通过增加可配置的计时控制、防御性卸载逻辑,以及可选的挂载持有进程终止机制,并将这些控制接入桌面 Tauri 构建工作流,提升 CI 中 macOS DMG 清理流程的健壮性。

Bug 修复:

  • 为 DMG 卸载(detach)计时选项添加有上限的预卸载休眠时间以及数值范围校验,以减少 macOS DMG 卸载操作的不稳定性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并可选地终止持有该挂载的进程,以避免卸载失败。
  • 在使用 lsof 扫描挂载持有进程时应用可配置的超时时间,并提供多种后端实现,以防止 lsof 发生卡死。

CI:

  • 在桌面 Tauri 构建工作流中暴露环境变量,用于配置 macOS DMG 卸载行为,包括预休眠时长、尝试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

Improve robustness of macOS DMG cleanup in CI by adding configurable timing controls, defensive unmount logic, and optional killing of mount-holder processes, and wire these controls into the desktop Tauri build workflow.

Bug Fixes:

  • Add bounded pre-detach sleep and numeric range validation for DMG detach timing options to reduce flakiness in macOS DMG unmount operations.
  • Force-unmount stale DMG mounts using diskutil/hdiutil and optionally terminate processes holding the mount to avoid detach failures.
  • Apply a configurable timeout with multiple backend implementations to lsof when scanning for mount-holder processes to prevent it from hanging.

CI:

  • Expose environment variables in the desktop Tauri build workflow to configure macOS DMG detach behavior, including pre-sleep duration, number of attempts, retry interval, lsof timeout, and whether to allow global helper process termination.

Bug 修复:

  • 通过添加有界的卸载前休眠时间,并对与时间相关的选项施加数值范围限制,提高 macOS DMG 卸载操作的可靠性。
  • 通过使用 diskutil 强制卸载,并在允许的情况下终止占用挂载点的进程,确保可以更可靠地卸载陈旧的 DMG 挂载点。

CI:

  • 在桌面端 Tauri 构建工作流中暴露环境变量,用于配置 DMG 卸载行为,包括卸载前休眠时长、重试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

通过增加可配置的计时控制、防御性卸载逻辑,以及可选的挂载持有进程终止机制,并将这些控制接入桌面 Tauri 构建工作流,提升 CI 中 macOS DMG 清理流程的健壮性。

Bug 修复:

  • 为 DMG 卸载(detach)计时选项添加有上限的预卸载休眠时间以及数值范围校验,以减少 macOS DMG 卸载操作的不稳定性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并可选地终止持有该挂载的进程,以避免卸载失败。
  • 在使用 lsof 扫描挂载持有进程时应用可配置的超时时间,并提供多种后端实现,以防止 lsof 发生卡死。

CI:

  • 在桌面 Tauri 构建工作流中暴露环境变量,用于配置 macOS DMG 卸载行为,包括预休眠时长、尝试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

Improve robustness of macOS DMG cleanup in CI by adding configurable timing controls, defensive unmount logic, and optional killing of mount-holder processes, and wire these controls into the desktop Tauri build workflow.

Bug Fixes:

  • Add bounded pre-detach sleep and numeric range validation for DMG detach timing options to reduce flakiness in macOS DMG unmount operations.
  • Force-unmount stale DMG mounts using diskutil/hdiutil and optionally terminate processes holding the mount to avoid detach failures.
  • Apply a configurable timeout with multiple backend implementations to lsof when scanning for mount-holder processes to prevent it from hanging.

CI:

  • Expose environment variables in the desktop Tauri build workflow to configure macOS DMG detach behavior, including pre-sleep duration, number of attempts, retry interval, lsof timeout, and whether to allow global helper process termination.
Original summary in English

Summary by Sourcery

通过增加可配置的计时控制、防御性卸载逻辑,以及可选的挂载持有进程终止机制,并将这些控制接入桌面 Tauri 构建工作流,提升 CI 中 macOS DMG 清理流程的健壮性。

Bug 修复:

  • 为 DMG 卸载(detach)计时选项添加有上限的预卸载休眠时间以及数值范围校验,以减少 macOS DMG 卸载操作的不稳定性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并可选地终止持有该挂载的进程,以避免卸载失败。
  • 在使用 lsof 扫描挂载持有进程时应用可配置的超时时间,并提供多种后端实现,以防止 lsof 发生卡死。

CI:

  • 在桌面 Tauri 构建工作流中暴露环境变量,用于配置 macOS DMG 卸载行为,包括预休眠时长、尝试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

Improve robustness of macOS DMG cleanup in CI by adding configurable timing controls, defensive unmount logic, and optional killing of mount-holder processes, and wire these controls into the desktop Tauri build workflow.

Bug Fixes:

  • Add bounded pre-detach sleep and numeric range validation for DMG detach timing options to reduce flakiness in macOS DMG unmount operations.
  • Force-unmount stale DMG mounts using diskutil/hdiutil and optionally terminate processes holding the mount to avoid detach failures.
  • Apply a configurable timeout with multiple backend implementations to lsof when scanning for mount-holder processes to prevent it from hanging.

CI:

  • Expose environment variables in the desktop Tauri build workflow to configure macOS DMG detach behavior, including pre-sleep duration, number of attempts, retry interval, lsof timeout, and whether to allow global helper process termination.

Bug 修复:

  • 通过添加有上限的预卸载等待时间,并对与时间相关的选项强制使用数值范围,提升 macOS DMG 卸载操作的稳健性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并在允许的情况下终止占用该挂载点的进程,从而减少卸载失败。
  • 通过对 lsof 在检测挂载占用进程时施加可配置的超时时间,并提供多种后端实现,防止 lsof 长时间运行或卡死。

CI:

  • 在 desktop Tauri 构建工作流中暴露环境变量,用于配置 DMG 卸载行为,包括预等待时间、重试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

通过增加可配置的计时控制、防御性卸载逻辑,以及可选的挂载持有进程终止机制,并将这些控制接入桌面 Tauri 构建工作流,提升 CI 中 macOS DMG 清理流程的健壮性。

Bug 修复:

  • 为 DMG 卸载(detach)计时选项添加有上限的预卸载休眠时间以及数值范围校验,以减少 macOS DMG 卸载操作的不稳定性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并可选地终止持有该挂载的进程,以避免卸载失败。
  • 在使用 lsof 扫描挂载持有进程时应用可配置的超时时间,并提供多种后端实现,以防止 lsof 发生卡死。

CI:

  • 在桌面 Tauri 构建工作流中暴露环境变量,用于配置 macOS DMG 卸载行为,包括预休眠时长、尝试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

Improve robustness of macOS DMG cleanup in CI by adding configurable timing controls, defensive unmount logic, and optional killing of mount-holder processes, and wire these controls into the desktop Tauri build workflow.

Bug Fixes:

  • Add bounded pre-detach sleep and numeric range validation for DMG detach timing options to reduce flakiness in macOS DMG unmount operations.
  • Force-unmount stale DMG mounts using diskutil/hdiutil and optionally terminate processes holding the mount to avoid detach failures.
  • Apply a configurable timeout with multiple backend implementations to lsof when scanning for mount-holder processes to prevent it from hanging.

CI:

  • Expose environment variables in the desktop Tauri build workflow to configure macOS DMG detach behavior, including pre-sleep duration, number of attempts, retry interval, lsof timeout, and whether to allow global helper process termination.
Original summary in English

Summary by Sourcery

通过增加可配置的计时控制、防御性卸载逻辑,以及可选的挂载持有进程终止机制,并将这些控制接入桌面 Tauri 构建工作流,提升 CI 中 macOS DMG 清理流程的健壮性。

Bug 修复:

  • 为 DMG 卸载(detach)计时选项添加有上限的预卸载休眠时间以及数值范围校验,以减少 macOS DMG 卸载操作的不稳定性。
  • 使用 diskutil/hdiutil 强制卸载陈旧的 DMG 挂载点,并可选地终止持有该挂载的进程,以避免卸载失败。
  • 在使用 lsof 扫描挂载持有进程时应用可配置的超时时间,并提供多种后端实现,以防止 lsof 发生卡死。

CI:

  • 在桌面 Tauri 构建工作流中暴露环境变量,用于配置 macOS DMG 卸载行为,包括预休眠时长、尝试次数、重试间隔、lsof 超时时间,以及是否允许全局终止辅助进程。
Original summary in English

Summary by Sourcery

Improve robustness of macOS DMG cleanup in CI by adding configurable timing controls, defensive unmount logic, and optional killing of mount-holder processes, and wire these controls into the desktop Tauri build workflow.

Bug Fixes:

  • Add bounded pre-detach sleep and numeric range validation for DMG detach timing options to reduce flakiness in macOS DMG unmount operations.
  • Force-unmount stale DMG mounts using diskutil/hdiutil and optionally terminate processes holding the mount to avoid detach failures.
  • Apply a configurable timeout with multiple backend implementations to lsof when scanning for mount-holder processes to prevent it from hanging.

CI:

  • Expose environment variables in the desktop Tauri build workflow to configure macOS DMG detach behavior, including pre-sleep duration, number of attempts, retry interval, lsof timeout, and whether to allow global helper process termination.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @zouyonghe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the robustness of the macOS DMG cleanup script in CI environments. It addresses common issues that lead to unmount failures by introducing a pre-detach delay, employing more aggressive unmounting strategies, and proactively terminating processes that might be holding onto mounted DMG volumes. These changes aim to improve the reliability of CI builds by ensuring that temporary DMG files are consistently cleaned up.

Highlights

  • Pre-detach sleep: Introduced a configurable pre-detach sleep period (detach_pre_sleep_seconds) before attempting to unmount a DMG, aiming to give the system time to release resources and prevent immediate unmount failures.
  • Enhanced unmount attempts: Added diskutil unmountDisk force and diskutil unmount force commands to the retry logic for detaching DMGs, providing additional methods to force unmount stubborn volumes.
  • Mount holder process termination: Implemented a new function kill_mount_holders that identifies and terminates processes (using lsof and ps) that are actively holding a DMG mount point, thereby preventing unmount failures caused by open files or running applications.
Changelog
  • scripts/ci/cleanup-dmg.sh
    • Added detach_pre_sleep_seconds variable with default and validation for a configurable sleep before detaching.
    • Implemented a pre-detach sleep using the new detach_pre_sleep_seconds variable within the detach_target function.
    • Incorporated diskutil unmountDisk force and diskutil unmount force commands into the detach_target function's retry loop for more robust unmounting.
    • Created a new kill_mount_holders function to identify and terminate processes holding a given mount point.
    • Integrated the kill_mount_holders function into the cleanup_stale_dmg_state process to kill lingering processes before attempting to detach.
    • Updated the log_cleanup_configuration function to include the new detach_pre_sleep_seconds variable in the output.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/build-desktop-tauri.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@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 - 我发现了 1 个问题,并给出了一些整体性的反馈:

  • 你在 workflow 里设置了 ASTRBOT_DESKTOP_MACOS_ALLOW_GLOBAL_HELPER_KILL,但在 cleanup-dmg.sh 中并没有使用它;如果这是用来控制 kill_mount_holders 行为的开关,建议把这个标志传入脚本,并在脚本中基于它进行分支处理。
  • kill_mount_holders 中的 lsof -t +D "${mount_point}" 调用在某些情况下可能比较耗时,或者在有问题的挂载点上直接卡住;建议增加超时或“尽力而为”的保护(例如限制最大深度或大小检查),以避免在极端情况下导致 CI 卡住。
给 AI Agent 的提示词
Please address the comments from this code review:

## Overall Comments
- You’re setting `ASTRBOT_DESKTOP_MACOS_ALLOW_GLOBAL_HELPER_KILL` in the workflow but not consuming it in `cleanup-dmg.sh`; if this is meant to gate `kill_mount_holders` behavior, consider plumbing the flag into the script and branching on it.
- The `lsof -t +D "${mount_point}"` call in `kill_mount_holders` can be relatively expensive or hang on problematic mounts; consider adding a timeout or a best-effort guard (e.g., max depth or size check) to avoid CI stalls on pathological cases.

## Individual Comments

### Comment 1
<location> `.github/workflows/build-desktop-tauri.yml:278` </location>
<code_context>
+          ASTRBOT_DESKTOP_MACOS_DETACH_PRE_SLEEP_SECONDS: '8'
+          ASTRBOT_DESKTOP_MACOS_DETACH_ATTEMPTS: '6'
+          ASTRBOT_DESKTOP_MACOS_DETACH_SLEEP_SECONDS: '3'
+          ASTRBOT_DESKTOP_MACOS_ALLOW_GLOBAL_HELPER_KILL: '1'
           GITHUB_TOKEN: ${{ github.token }}
           GH_TOKEN: ${{ github.token }}
</code_context>

<issue_to_address>
**issue (bug_risk):** Align the workflow toggle with script behavior so the env var actually controls killing mount holders.

This workflow sets `ASTRBOT_DESKTOP_MACOS_ALLOW_GLOBAL_HELPER_KILL: '1'`, but `cleanup-dmg.sh` never reads it, so the toggle has no real effect on `kill_mount_holders`. Please either use this env var in `cleanup-dmg.sh` (e.g., as a guard around `kill_mount_holders`) or remove it here to avoid a misleading, no-op configuration option.
</issue_to_address>

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

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

  • You’re setting ASTRBOT_DESKTOP_MACOS_ALLOW_GLOBAL_HELPER_KILL in the workflow but not consuming it in cleanup-dmg.sh; if this is meant to gate kill_mount_holders behavior, consider plumbing the flag into the script and branching on it.
  • The lsof -t +D "${mount_point}" call in kill_mount_holders can be relatively expensive or hang on problematic mounts; consider adding a timeout or a best-effort guard (e.g., max depth or size check) to avoid CI stalls on pathological cases.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- You’re setting `ASTRBOT_DESKTOP_MACOS_ALLOW_GLOBAL_HELPER_KILL` in the workflow but not consuming it in `cleanup-dmg.sh`; if this is meant to gate `kill_mount_holders` behavior, consider plumbing the flag into the script and branching on it.
- The `lsof -t +D "${mount_point}"` call in `kill_mount_holders` can be relatively expensive or hang on problematic mounts; consider adding a timeout or a best-effort guard (e.g., max depth or size check) to avoid CI stalls on pathological cases.

## Individual Comments

### Comment 1
<location> `.github/workflows/build-desktop-tauri.yml:278` </location>
<code_context>
+          ASTRBOT_DESKTOP_MACOS_DETACH_PRE_SLEEP_SECONDS: '8'
+          ASTRBOT_DESKTOP_MACOS_DETACH_ATTEMPTS: '6'
+          ASTRBOT_DESKTOP_MACOS_DETACH_SLEEP_SECONDS: '3'
+          ASTRBOT_DESKTOP_MACOS_ALLOW_GLOBAL_HELPER_KILL: '1'
           GITHUB_TOKEN: ${{ github.token }}
           GH_TOKEN: ${{ github.token }}
</code_context>

<issue_to_address>
**issue (bug_risk):** Align the workflow toggle with script behavior so the env var actually controls killing mount holders.

This workflow sets `ASTRBOT_DESKTOP_MACOS_ALLOW_GLOBAL_HELPER_KILL: '1'`, but `cleanup-dmg.sh` never reads it, so the toggle has no real effect on `kill_mount_holders`. Please either use this env var in `cleanup-dmg.sh` (e.g., as a guard around `kill_mount_holders`) or remove it here to avoid a misleading, no-op configuration option.
</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 .github/workflows/build-desktop-tauri.yml
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request introduces improvements to the DMG cleanup script by adding a pre-detach sleep and a mechanism to kill processes holding mounts, aiming to enhance the robustness of the cleanup process. However, a vulnerability was identified in how mount points are parsed from the mount command output, which could lead to unintended process termination or unmounting of legitimate volumes.

Comment thread scripts/ci/cleanup-dmg.sh
Comment on lines +143 to +145
if command -v diskutil >/dev/null 2>&1; then
diskutil unmountDisk force "${target}" >/dev/null 2>&1 || true
diskutil unmount force "${target}" >/dev/null 2>&1 || true
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.

medium

The diskutil unmountDisk force and diskutil unmount force commands are executed unconditionally after the initial hdiutil detach attempt fails. While this is likely intended to provide additional force, it might be more efficient to only attempt these if hdiutil detach -force also fails, or to combine them with the hdiutil detach -force attempt to avoid redundant calls if the initial hdiutil detach succeeds. However, given the || true and the goal of hardening, this approach is acceptable.

Comment thread scripts/ci/cleanup-dmg.sh
Comment on lines +294 to +296
while IFS= read -r pid; do
[ -z "${pid}" ] && continue
[ "${pid}" = "$$" ] && continue
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.

medium

The [ "${pid}" = "$$" ] && continue check correctly prevents the script from killing itself. This is a good safety measure.

@zouyonghe
Copy link
Copy Markdown
Member Author

@sourcery-ai review

Copy link
Copy Markdown

@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 - 我在这里给出了一些高层次的反馈:

  • detach_target 函数现在把挂载路径传给了 diskutil unmountDisk force,但 unmountDisk 期望的是整个磁盘标识符(例如 /dev/disk2);建议要么根据挂载点解析出对应的设备节点,要么直接移除对 unmountDisk 的调用,以避免不必要的失败和噪声。
  • kill_mount_holders 中,当前的超时处理逻辑假定 timeout/gtimeout 使用 GNU 风格的退出码 124/137;如果这个脚本可能在其他 timeout 实现的系统上运行,你或许需要先做版本检查,或者在不依赖这些特定退出码的前提下更优雅地降级处理。
给 AI 代理的提示词
Please address the comments from this code review:

## Overall Comments
- `detach_target` 函数现在把挂载路径传给了 `diskutil unmountDisk force`,但 `unmountDisk` 期望的是整个磁盘标识符(例如 `/dev/disk2`);建议要么根据挂载点解析出对应的设备节点,要么直接移除对 `unmountDisk` 的调用,以避免不必要的失败和噪声。
-`kill_mount_holders` 中,当前的超时处理逻辑假定 `timeout`/`gtimeout` 使用 GNU 风格的退出码 124/137;如果这个脚本可能在其他 `timeout` 实现的系统上运行,你或许需要先做版本检查,或者在不依赖这些特定退出码的前提下更优雅地降级处理。

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

Hey - I've left some high level feedback:

  • The detach_target function now passes the mount path to diskutil unmountDisk force, but unmountDisk expects a whole-disk identifier (e.g. /dev/disk2); consider either resolving the device node for the mount point or dropping the unmountDisk call to avoid unnecessary failures/noise.
  • In kill_mount_holders, the timeout-handling logic assumes GNU-style timeout/gtimeout exit codes 124/137; if this script may run on systems with a different timeout implementation, you might want to guard this with a version check or degrade more gracefully instead of relying on those specific codes.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `detach_target` function now passes the mount path to `diskutil unmountDisk force`, but `unmountDisk` expects a whole-disk identifier (e.g. `/dev/disk2`); consider either resolving the device node for the mount point or dropping the `unmountDisk` call to avoid unnecessary failures/noise.
- In `kill_mount_holders`, the timeout-handling logic assumes GNU-style `timeout`/`gtimeout` exit codes 124/137; if this script may run on systems with a different `timeout` implementation, you might want to guard this with a version check or degrade more gracefully instead of relying on those specific codes.

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.

@zouyonghe
Copy link
Copy Markdown
Member Author

@sourcery-ai review

Copy link
Copy Markdown

@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 - 我已经给出了一些总体反馈:

  • select_lsof_timeout_tool 中,你目前优先选择 python3 而不是 gtimeout/timeout;如果两者都可用,优先使用原生的 timeout 可执行文件可能会更高效、更简单,只在没有 timeout 命令的环境中保留 Python 兜底方案。
  • detach_pre_sleep_seconds 的范围检查里包含了 -lt 0 的判断,但前面的类型转换只允许非负数字;可以考虑简化这个逻辑块(或者简化转换逻辑),让最小/最大值检查保持一致、更易于理解。
给 AI Agent 的提示
Please address the comments from this code review:

## Overall Comments
- In `select_lsof_timeout_tool`, you currently prefer `python3` over `gtimeout/timeout`; if both are available it might be more efficient and simpler to choose the native timeout binary first and keep the Python fallback only for environments without a timeout command.
- The `detach_pre_sleep_seconds` range check includes a `-lt 0` guard even though earlier coercion only allows non-negative digits; consider simplifying this block (or coercion) so the min/max logic is consistent and easier to reason about.

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

Hey - I've left some high level feedback:

  • In select_lsof_timeout_tool, you currently prefer python3 over gtimeout/timeout; if both are available it might be more efficient and simpler to choose the native timeout binary first and keep the Python fallback only for environments without a timeout command.
  • The detach_pre_sleep_seconds range check includes a -lt 0 guard even though earlier coercion only allows non-negative digits; consider simplifying this block (or coercion) so the min/max logic is consistent and easier to reason about.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `select_lsof_timeout_tool`, you currently prefer `python3` over `gtimeout/timeout`; if both are available it might be more efficient and simpler to choose the native timeout binary first and keep the Python fallback only for environments without a timeout command.
- The `detach_pre_sleep_seconds` range check includes a `-lt 0` guard even though earlier coercion only allows non-negative digits; consider simplifying this block (or coercion) so the min/max logic is consistent and easier to reason about.

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.

@zouyonghe
Copy link
Copy Markdown
Member Author

@sourcery-ai review

Copy link
Copy Markdown

@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 - 我发现了 1 个问题,并给出了一些整体性的反馈:

  • kill_mount_holders 中,对于使用 gtimeout/timeout 的路径,你是通过比较耗时与 lsof_timeout_seconds 来推断 lsof 是否超时;由于 GNU/BSD 的 timeout 在超时时通常会返回 124,更稳健、也更简单的做法是像你在 Python 路径中已经做的那样,基于退出状态来判断,而不是依赖 date 和耗时计算。
给 AI 代理的提示
Please address the comments from this code review:

## Overall Comments
- In `kill_mount_holders`, for the `gtimeout`/`timeout` path you infer lsof timeouts by comparing elapsed time to `lsof_timeout_seconds`; since GNU/BSD timeout conventionally return 124 on timeout, it would be more robust and simpler to key off the exit status (like you already do in the Python path) instead of relying on `date` and elapsed-time calculations.

## Individual Comments

### Comment 1
<location> `scripts/ci/cleanup-dmg.sh:344-353` </location>
<code_context>
+  if [ "${lsof_timeout_tool}" = "gtimeout" ] || [ "${lsof_timeout_tool}" = "timeout" ]; then
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Consider tightening the timeout error handling to ensure genuine `lsof` errors are surfaced.

In the `gtimeout`/`timeout` path, a non-zero exit code is only treated as a timeout when `elapsed >= lsof_timeout_seconds`; otherwise, a non-zero exit with no output is effectively treated as “no holders.” That can hide real `lsof` failures. Consider distinguishing: (1) explicit timeout → warn and skip, (2) non-zero with output → trust the output, and (3) non-zero with no output → log a warning and skip, so `lsof` misconfigurations or failures are visible instead of silently ignored.
</issue_to_address>

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

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

  • In kill_mount_holders, for the gtimeout/timeout path you infer lsof timeouts by comparing elapsed time to lsof_timeout_seconds; since GNU/BSD timeout conventionally return 124 on timeout, it would be more robust and simpler to key off the exit status (like you already do in the Python path) instead of relying on date and elapsed-time calculations.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `kill_mount_holders`, for the `gtimeout`/`timeout` path you infer lsof timeouts by comparing elapsed time to `lsof_timeout_seconds`; since GNU/BSD timeout conventionally return 124 on timeout, it would be more robust and simpler to key off the exit status (like you already do in the Python path) instead of relying on `date` and elapsed-time calculations.

## Individual Comments

### Comment 1
<location> `scripts/ci/cleanup-dmg.sh:344-353` </location>
<code_context>
+  if [ "${lsof_timeout_tool}" = "gtimeout" ] || [ "${lsof_timeout_tool}" = "timeout" ]; then
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Consider tightening the timeout error handling to ensure genuine `lsof` errors are surfaced.

In the `gtimeout`/`timeout` path, a non-zero exit code is only treated as a timeout when `elapsed >= lsof_timeout_seconds`; otherwise, a non-zero exit with no output is effectively treated as “no holders.” That can hide real `lsof` failures. Consider distinguishing: (1) explicit timeout → warn and skip, (2) non-zero with output → trust the output, and (3) non-zero with no output → log a warning and skip, so `lsof` misconfigurations or failures are visible instead of silently ignored.
</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 scripts/ci/cleanup-dmg.sh Outdated
@zouyonghe
Copy link
Copy Markdown
Member Author

@sourcery-ai review

Copy link
Copy Markdown

@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 - 我已经审查了你的更改,看起来非常不错!


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

Hey - I've reviewed your changes and they look great!


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.

@zouyonghe zouyonghe merged commit 8e3b8dc into AstrBotDevs:main Feb 21, 2026
4 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.

1 participant