Skip to content

Commit eadc693

Browse files
authored
Merge pull request #23 from zouyonghe/main
refactor: harden DMG cleanup and legacy desktop patching safeguards
2 parents f139563 + 79d3001 commit eadc693

8 files changed

Lines changed: 790 additions & 44 deletions

File tree

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: "🐛 Bug Report / 问题反馈"
2+
title: "[Bug] "
3+
description: Report a reproducible bug in AstrBot Desktop. / 反馈 AstrBot Desktop 可复现问题。
4+
labels: ["bug"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for reporting this issue. Please provide reproducible steps and logs.
10+
感谢反馈问题。请尽量提供可复现步骤和日志,信息不足的问题可能无法排查。
11+
12+
- type: textarea
13+
attributes:
14+
label: What happened? / 实际发生了什么?
15+
description: Describe the actual behavior.
16+
placeholder: A clear and specific description of the issue.
17+
validations:
18+
required: true
19+
20+
- type: textarea
21+
attributes:
22+
label: Expected behavior / 预期行为
23+
description: What did you expect to happen?
24+
validations:
25+
required: true
26+
27+
- type: textarea
28+
attributes:
29+
label: Steps to reproduce / 复现步骤
30+
description: Please provide minimal reproducible steps.
31+
placeholder: |
32+
1. ...
33+
2. ...
34+
3. ...
35+
validations:
36+
required: true
37+
38+
- type: input
39+
attributes:
40+
label: Desktop version / 桌面端版本
41+
description: e.g. 4.17.6
42+
placeholder: 4.x.x
43+
validations:
44+
required: true
45+
46+
- type: dropdown
47+
attributes:
48+
label: Installation channel / 安装来源
49+
multiple: false
50+
options:
51+
- GitHub Release installer
52+
- Built from source
53+
- Other
54+
validations:
55+
required: true
56+
57+
- type: dropdown
58+
attributes:
59+
label: OS / 操作系统
60+
multiple: false
61+
options:
62+
- Windows
63+
- macOS
64+
- Linux
65+
- Other
66+
validations:
67+
required: true
68+
69+
- type: input
70+
attributes:
71+
label: Architecture / 架构
72+
description: e.g. amd64 / arm64
73+
placeholder: amd64
74+
validations:
75+
required: true
76+
77+
- type: input
78+
attributes:
79+
label: Upstream AstrBot ref used by desktop build (optional) / 桌面构建使用的上游 AstrBot Ref(可选)
80+
placeholder: v4.17.6 / master / commit SHA
81+
validations:
82+
required: false
83+
84+
- type: textarea
85+
attributes:
86+
label: Logs, screenshots, and additional context / 日志、截图与补充信息
87+
description: |
88+
Please include desktop logs, backend logs, screenshots, and (if relevant) GitHub Actions links.
89+
请附上桌面端日志、后端日志、截图,必要时附 Actions 链接。
90+
placeholder: Paste logs/screenshots/links here.
91+
validations:
92+
required: true
93+
94+
- type: checkboxes
95+
attributes:
96+
label: Willing to submit a PR? / 是否愿意提交 PR?
97+
options:
98+
- label: I am willing to submit a PR to fix this issue. / 我愿意提交 PR 修复此问题。
99+
100+
- type: checkboxes
101+
attributes:
102+
label: Code of Conduct
103+
options:
104+
- label: I agree to follow the project's Code of Conduct. / 我同意遵守项目行为准则。
105+
required: true
106+
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "🎉 Feature Request / 功能建议"
2+
title: "[Feature] "
3+
description: Suggest a new feature or improvement for AstrBot Desktop. / 为 AstrBot Desktop 提交功能建议。
4+
labels: ["enhancement"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for the suggestion. Please explain the scenario and expected outcome clearly.
10+
感谢提出建议。请尽量说明使用场景和预期效果。
11+
12+
- type: textarea
13+
attributes:
14+
label: Problem to solve / 要解决的问题
15+
description: What pain point does this feature address?
16+
validations:
17+
required: true
18+
19+
- type: textarea
20+
attributes:
21+
label: Proposed solution / 期望方案
22+
description: Describe your ideal solution.
23+
validations:
24+
required: true
25+
26+
- type: textarea
27+
attributes:
28+
label: Alternatives considered / 备选方案
29+
description: Any alternative approaches you considered.
30+
validations:
31+
required: false
32+
33+
- type: textarea
34+
attributes:
35+
label: Additional context / 补充信息
36+
description: |
37+
Screenshots, design references, related issues, or technical constraints.
38+
可补充截图、参考链接、相关 issue 或技术约束。
39+
validations:
40+
required: false
41+
42+
- type: checkboxes
43+
attributes:
44+
label: Willing to submit a PR? / 是否愿意提交 PR?
45+
options:
46+
- label: Yes, I am willing to submit a PR. / 是,我愿意提交 PR。
47+
48+
- type: checkboxes
49+
attributes:
50+
label: Code of Conduct
51+
options:
52+
- label: I agree to follow the project's Code of Conduct. / 我同意遵守项目行为准则。
53+
required: true
54+

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!-- Please explain the motivation of this PR and what problem it solves. -->
2+
<!-- 请说明这个 PR 的动机,以及它解决了什么问题。 -->
3+
4+
### Summary / 改动概述
5+
6+
<!-- Please summarize the core changes and affected files. -->
7+
<!-- 请简要说明核心改动和涉及的文件。 -->
8+
9+
### Verification / 验证方式
10+
11+
<!-- Paste test logs, screenshots, or CI links that prove this change works. -->
12+
<!-- 请粘贴测试日志、截图或 CI 链接,证明改动有效。 -->
13+
14+
---
15+
16+
### Checklist / 检查清单
17+
18+
- [ ] This change is **not** a breaking change. / 此改动**不是**破坏性变更。
19+
- [ ] I have verified the change locally (and provided logs/screenshots above). / 我已在本地验证并在上方提供日志/截图。
20+
- [ ] If workflows are changed, I attached at least one related Actions run link. / 如果修改了工作流,我已附上至少一个相关 Actions 运行链接。
21+
- [ ] If dependencies are updated, lockfiles are updated accordingly (`src-tauri/Cargo.lock`, lockfiles under changed package dirs). / 如果引入或升级依赖,已同步更新相关 lock 文件(如 `src-tauri/Cargo.lock`、对应包目录中的 lock 文件)。
22+
- [ ] This PR does not include malicious code. / 此 PR 不包含恶意代码。
23+

.github/workflows/build-desktop-tauri.yml

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,16 @@ jobs:
278278
run: |
279279
set -euo pipefail
280280
281-
max_attempts=2
281+
max_attempts=3
282282
attempt=1
283283
# Only retry on known transient DMG detach failures.
284284
retry_pattern='hdiutil: detach:.*(timeout|not detached)|DiskArbitration expired'
285+
cleanup_script="scripts/ci/cleanup-dmg.sh"
285286
log_file=""
287+
if [ ! -f "${cleanup_script}" ]; then
288+
echo "Missing DMG cleanup script: ${cleanup_script}" >&2
289+
exit 1
290+
fi
286291
287292
cleanup_log_file() {
288293
if [ -n "${log_file:-}" ]; then
@@ -292,7 +297,14 @@ jobs:
292297
}
293298
trap cleanup_log_file EXIT
294299
300+
cleanup_stale_dmg_state() {
301+
bash "${cleanup_script}"
302+
}
303+
295304
while [ "${attempt}" -le "${max_attempts}" ]; do
305+
echo "Cleaning stale DMG state before attempt ${attempt}/${max_attempts}..."
306+
cleanup_stale_dmg_state
307+
296308
log_file="$(mktemp -t tauri-macos-build.XXXXXX.log)"
297309
echo "macOS build attempt ${attempt}/${max_attempts} (arch=${{ matrix.arch }}, target=${{ matrix.target }})"
298310
@@ -311,28 +323,7 @@ jobs:
311323
fi
312324
313325
echo "Detected transient DMG detach/bundling error. Cleaning up stale dmg mounts before retry..."
314-
dmg_mounts="$(mount | awk '$3 ~ /^\/Volumes\/dmg\./ { print $3 }' || true)"
315-
if [ -n "${dmg_mounts}" ]; then
316-
while IFS= read -r mount_point; do
317-
[ -z "${mount_point}" ] && continue
318-
echo "Detaching ${mount_point}"
319-
hdiutil detach "${mount_point}" || hdiutil detach -force "${mount_point}" || true
320-
done <<< "${dmg_mounts}"
321-
322-
# Avoid broad pkill: only target likely disk image helper binaries.
323-
helper_pids="$(
324-
pgrep -f '/System/Library/PrivateFrameworks/.*/diskimages-helper' || true
325-
pgrep -f '/usr/libexec/diskimages-helper' || true
326-
pgrep -f 'diskimages-help' || true
327-
)"
328-
helper_pids="$(printf '%s\n' "${helper_pids}" | awk 'NF' | sort -u)"
329-
if [ -n "${helper_pids}" ]; then
330-
while IFS= read -r pid; do
331-
[ -z "${pid}" ] && continue
332-
kill "${pid}" || true
333-
done <<< "${helper_pids}"
334-
fi
335-
fi
326+
cleanup_stale_dmg_state
336327
rm -f src-tauri/target/${{ matrix.target }}/release/bundle/macos/rw.*.dmg || true
337328
cleanup_log_file
338329

0 commit comments

Comments
 (0)