Skip to content

Commit 6eeda26

Browse files
committed
debug-busybox: faithfully reproduce the i686 failure path
and capture every patch Copilot leaves behind Two correctness gaps in the previous iteration of this throwaway workflow caused real information loss when the user re-investigated the original CI failure. First, the matrix entry for the mingw32 axis pulled git-sdk-32 by passing `architecture: i686` to git-for-windows/setup-git-for-windows-sdk@v2. The git-for-windows-automation build-and-deploy.yml dispatch that hit the original mingw_pathconv / realpath conflicting-types error runs with ARCHITECTURE='' and therefore resolves to `architecture: x86_64`, downloads git-sdk-64-full, and cross-builds mingw32 from the x86_64 SDK. The two SDKs ship different mingw-w64-i686-gcc baselines (and the active `i686-w64-mingw32-gcc` binary that gets invoked at build time is structurally different), so the throwaway was exercising a toolchain build that the original never sees. The result was a spuriously green mingw32 job that hid the actual bug. The mingw32 matrix entry now uses `sdk_architecture: x86_64` so the same git-sdk-64 the original dispatch downloads is the one under test, and the perl-DLL rebase dance that only the git-sdk-32 image needs is dropped because the x86_64 SDK does not need it. Second, the upload-artifact glob only listed `build.log`, the diagnosis markdown, the session tarball, and the produced `.pkg.tar.xz`. Any file Copilot edited under `mingw-w64-busybox/src/busybox-w32/` or created in `mingw-w64-busybox/` (a freshly authored `.patch` file, an amended PKGBUILD) was therefore lost when the runner was reaped, leaving the human reviewer with the diagnosis text but no actual code to apply. Two new steps now run with `if: always()` and emit, for both the busybox-w32 clone and the MINGW-packages checkout, a `git diff HEAD` against the respective baseline plus a tar of the untracked-and-not- ignored files. The MINGW-packages capture explicitly skips `mingw-w64-busybox/src/`, `pkg/`, and built `.pkg.tar.*` so makepkg's outputs do not pollute the patch artifact while human-authored additions (new `.patch` files alongside the PKGBUILD) are preserved. A third preventive change records `pacman -Qi` versions of the toolchain packages plus `--version` of every relevant compiler binary on PATH into `toolchain-versions.log` before the build even starts. Diagnosing "this is unexpectedly green" or "this is unexpectedly red" against a moving SDK target is otherwise an exercise in archaeology, since `pacman -Syyu` tends to print "nothing to do" once the holdback removes the offending upgrade entry from the database. The baseline log is uploaded unconditionally so the exact compiler revision in play is always one artifact download away. The Copilot CLI invocation is unchanged: it still references the rendered prompt with `@copilot-prompt.md` so it does not hit the cmd.exe 8 KB argv limit, and it still runs only when the build step actually fails. Assisted-by: Opus 4.7 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent c51f689 commit 6eeda26

1 file changed

Lines changed: 138 additions & 23 deletions

File tree

.github/workflows/debug-busybox.yml

Lines changed: 138 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,22 @@
77
# This workflow exists only on the `debug-busybox-ci` branch and is
88
# expected to be deleted (along with the branch) once the underlying
99
# bugs are fixed upstream.
10+
#
11+
# Faithful-reproducer notes:
12+
# - The git-for-windows-automation build-and-deploy.yml workflow that
13+
# originally hit these failures dispatches with ARCHITECTURE='' (the
14+
# default), which makes setup-git-for-windows-sdk install the
15+
# x86_64-flavor SDK (git-sdk-64) and cross-builds mingw32 from it.
16+
# The relevant `i686-w64-mingw32-gcc` is therefore the one shipped
17+
# inside git-sdk-64, not the native one in git-sdk-32. The first
18+
# iteration of this throwaway used `architecture: i686` which pulls
19+
# git-sdk-32 instead, and the mingw32 build passed unexpectedly
20+
# because a different toolchain build was exercised. We now match
21+
# the original by using `architecture: x86_64` for the mingw32 axis.
22+
# - clangarm64 still wants `architecture: aarch64` (= git-sdk-arm64)
23+
# because that is the only SDK that ships clangarm64 tooling, and
24+
# that is also what the original build-and-deploy.yml dispatch uses
25+
# when ARCHITECTURE='aarch64'.
1026

1127
name: debug-busybox (throwaway)
1228

@@ -25,8 +41,8 @@ jobs:
2541
matrix:
2642
include:
2743
- mingw_arch: mingw32
28-
sdk_architecture: i686
29-
msystem: MINGW32
44+
sdk_architecture: x86_64
45+
msystem: MINGW64
3046
runs_on: windows-latest
3147
- mingw_arch: clangarm64
3248
sdk_architecture: aarch64
@@ -48,28 +64,36 @@ jobs:
4864
run: |
4965
& ("${{ steps.setup-sdk.outputs.result }}\update-via-pacman.ps1")
5066
51-
- name: rebase `.dll` base addresses (i686 only)
52-
if: matrix.sdk_architecture == 'i686'
53-
shell: powershell
67+
- name: Record toolchain versions (pre-build baseline)
68+
shell: bash
5469
run: |
55-
if (Test-Path D:\git-sdk-32-full -PathType Container) {
56-
cd D:\git-sdk-32-full
57-
} else {
58-
cd C:\git-sdk-32-full
59-
}
60-
if (!$?) { exit(1); }
61-
62-
$env:MSYSTEM = "MINGW32"
63-
$env:PATH = "$(Get-Location)\usr\bin;" + $env:PATH
64-
$env:MSYS2_PATH_TYPE = "minimal"
65-
66-
sh.exe -lc "set -x && rm -f /usr/share/libalpm/hooks/rebase.hook"
67-
sh.exe -lc "set -x && find /usr/lib/perl5/*_perl -name \*.dll >perl-dlls.txt"
68-
type perl-dlls.txt
69-
dash -x /usr/bin/rebaseall -p -T perl-dlls.txt
70-
bash -lc "set -x && rebase -b 0x61500000 /usr/lib/perl5/core_perl/auto/*/{*,*/*}.dll"
71-
bash -lc "set -x && rebase -v -b 0x63f00000 /usr/lib/perl5/core_perl/auto/Cwd/Cwd.dll"
72-
bash -lc "set -x && rebase -v -i /usr/lib/perl5/core_perl/auto/Cwd/Cwd.dll"
70+
{
71+
echo "=== uname / MSYSTEM ==="
72+
uname -a
73+
echo "MSYSTEM=${MSYSTEM:-<unset>}"
74+
echo
75+
echo "=== Relevant pacman packages ==="
76+
pacman -Qi mingw-w64-i686-gcc mingw-w64-i686-gcc-libs \
77+
mingw-w64-i686-binutils mingw-w64-i686-headers-git \
78+
mingw-w64-i686-crt-git \
79+
mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc-libs \
80+
mingw-w64-x86_64-binutils \
81+
mingw-w64-clang-aarch64-clang \
82+
mingw-w64-clang-aarch64-llvm \
83+
mingw-w64-clang-aarch64-crt-git \
84+
mingw-w64-clang-aarch64-headers-git \
85+
2>/dev/null | grep -E '^(Name|Version|Build Date)' || true
86+
echo
87+
echo "=== compiler binaries on PATH ==="
88+
for tool in \
89+
i686-w64-mingw32-gcc x86_64-w64-mingw32-gcc \
90+
aarch64-w64-mingw32-clang aarch64-w64-mingw32-gcc \
91+
llvm-ar ar; do
92+
p=$(command -v "$tool" 2>/dev/null || echo "<not found>")
93+
echo "$tool: $p"
94+
[ "$p" = "<not found>" ] || "$tool" --version 2>&1 | head -1 | sed "s/^/ /"
95+
done
96+
} 2>&1 | tee toolchain-versions.log
7397
7498
- name: Build mingw-w64-busybox (expected to fail)
7599
id: build
@@ -125,6 +149,90 @@ jobs:
125149
copilot.cmd -p "Follow the instructions in @copilot-prompt.md exactly." \
126150
--yolo </dev/null
127151
152+
- name: Capture busybox-w32 source mutations
153+
if: always()
154+
shell: bash
155+
run: |
156+
# Even if Copilot didn't run, the build step may have left a
157+
# partial build tree we want to preserve. If the source clone
158+
# exists, snapshot every tracked, modified, and untracked file
159+
# so that no work Copilot did is lost when the runner is
160+
# reaped. The two-pronged approach (diff for tracked changes
161+
# plus tar of untracked) captures everything regardless of
162+
# whether Copilot's edits were `edit`-style or new-file
163+
# `create`-style.
164+
src=mingw-w64-busybox/src/busybox-w32
165+
if [ ! -d "$src/.git" ]; then
166+
echo "No busybox-w32 source clone present; skipping." \
167+
| tee busybox-w32-status.log
168+
exit 0
169+
fi
170+
{
171+
echo "=== git status ==="
172+
git -C "$src" status --porcelain=v1
173+
echo
174+
echo "=== HEAD ==="
175+
git -C "$src" log -1 --format='%H %ai %s'
176+
echo
177+
echo "=== diff against HEAD (tracked file changes) ==="
178+
git -C "$src" diff HEAD
179+
} 2>&1 | tee busybox-w32-status.log
180+
181+
# Save the diff separately so it is applyable with git apply.
182+
git -C "$src" diff HEAD >busybox-w32-tracked.patch || true
183+
184+
# Pack any untracked files that are not in .gitignore so new
185+
# files Copilot created (e.g. a freshly added header) are
186+
# preserved too.
187+
mapfile -t untracked < <(
188+
git -C "$src" ls-files --others --exclude-standard
189+
)
190+
if [ "${#untracked[@]}" -gt 0 ]; then
191+
tar czf busybox-w32-untracked.tar.gz -C "$src" "${untracked[@]}"
192+
fi
193+
194+
- name: Capture MINGW-packages tree mutations
195+
if: always()
196+
shell: bash
197+
run: |
198+
# Copilot may have added a .patch file alongside the PKGBUILD
199+
# (the recommended "distro patch" strategy in the prompt) or
200+
# tweaked the PKGBUILD itself. Capture both as a diff against
201+
# the workflow's checkout HEAD, plus a tar of untracked files
202+
# that are not in .gitignore.
203+
{
204+
echo "=== git status (MINGW-packages root) ==="
205+
git status --porcelain=v1
206+
echo
207+
echo "=== diff against HEAD ==="
208+
git diff HEAD -- ':!mingw-w64-busybox/src' \
209+
':!mingw-w64-busybox/pkg' \
210+
':!mingw-w64-busybox/*.pkg.tar.xz'
211+
} 2>&1 | tee mingw-packages-status.log
212+
213+
git diff HEAD -- ':!mingw-w64-busybox/src' \
214+
':!mingw-w64-busybox/pkg' \
215+
':!mingw-w64-busybox/*.pkg.tar.xz' \
216+
>mingw-packages-tracked.patch || true
217+
218+
mapfile -t untracked < <(
219+
git ls-files --others --exclude-standard -- mingw-w64-busybox/
220+
)
221+
# Strip out things makepkg produced that are not Copilot's work.
222+
filtered=()
223+
for f in "${untracked[@]}"; do
224+
case "$f" in
225+
mingw-w64-busybox/src/*) ;;
226+
mingw-w64-busybox/pkg/*) ;;
227+
mingw-w64-busybox/*.pkg.tar.*) ;;
228+
mingw-w64-busybox/*.log) ;;
229+
*) filtered+=("$f") ;;
230+
esac
231+
done
232+
if [ "${#filtered[@]}" -gt 0 ]; then
233+
tar czf mingw-packages-untracked.tar.gz "${filtered[@]}"
234+
fi
235+
128236
- name: Archive Copilot session state
129237
if: always()
130238
shell: bash
@@ -143,8 +251,15 @@ jobs:
143251
if-no-files-found: warn
144252
path: |
145253
build.log
254+
toolchain-versions.log
146255
copilot-prompt.md
147256
copilot-diagnosis-*.md
148257
copilot-session-*.tar.gz
258+
busybox-w32-status.log
259+
busybox-w32-tracked.patch
260+
busybox-w32-untracked.tar.gz
261+
mingw-packages-status.log
262+
mingw-packages-tracked.patch
263+
mingw-packages-untracked.tar.gz
149264
mingw-w64-busybox/verify-build.log
150265
mingw-w64-busybox/*.pkg.tar.xz

0 commit comments

Comments
 (0)