Skip to content

Commit 1e6eeb7

Browse files
committed
TO-DROP: run Copilot CLI as a --yolo debugger on linux32 failure
Wire the in-container Copilot CLI debugger to the trimmed `linux32` job per the `ci-failure-copilot` skill. On a failure of the `ci/run-build-and-tests.sh` step, install Node.js and the Copilot CLI, hand off to a `--yolo` session pointed at `.github/copilot-prompts/debug-linux32.md` (added in the previous commit), and upload the resulting `ci-diagnosis/` directory plus the captured `~/.copilot` session state as a `copilot-debug` artifact. Two preconditions for the prompt's branch-thicket-aware diagnosis flow: * The checkout step now uses `fetch-depth: 0` so the agent can `git log` between the old and new rebase baselines and run `git range-diff` against `microsoft/vfs-2.54.0`. * A new step adds the `microsoft` remote and pre-fetches `vfs-2.54.0` plus the `v2.54.0` tag so the agent does not pay the discovery latency in-session. The Copilot run executes as root (the container's default user), matching where `npm install -g` puts the binary; the prompt itself instructs the agent to re-invoke the failing command via `sudo --preserve-env --set-home --user=builder ci/run-build-and-tests.sh` so its end-to-end verification reproduces the workflow's exact conditions. The job requires a `COPILOT_GITHUB_TOKEN` repository secret on `dscho/git` with Copilot access for this repository; if it is not set, the `Run Copilot CLI` step will fail authentication but the preceding archive/upload steps still preserve whatever state was captured. This commit is to be dropped before the branch is merged anywhere. Assisted-by: Claude Opus 4.7 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 4b6658b commit 1e6eeb7

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,80 @@ jobs:
145145
apt-get -q update && apt-get -q -y install git
146146
fi
147147
- uses: actions/checkout@v6
148+
with:
149+
# Full history so the Copilot debugger can `git log` between
150+
# the rebase baselines (microsoft/vfs-2.54.0's upstream base
151+
# vs this branch's upstream base) and run `git range-diff`.
152+
fetch-depth: 0
148153
- run: ci/install-dependencies.sh
149154
- run: useradd builder --create-home
150155
- run: chown -R builder .
156+
- name: Fetch baseline refs for Copilot debugger
157+
# Runs as `builder` (matching the post-chown repo ownership) so
158+
# we do not have to fight git's dubious-ownership check. Focal's
159+
# git is too old to honour `safe.directory='*'`, so matching the
160+
# owner is cleaner. Fetch all tags from microsoft/git, git/git,
161+
# and git-for-windows/git, and unshallow the current branch, so
162+
# the agent has every baseline ref it might want to range-diff
163+
# or `git log` against without paying that discovery latency
164+
# in-session. `+refs/tags/*:refs/tags/*` forces tag updates so
165+
# name collisions between remotes are resolved last-fetch-wins
166+
# rather than aborting the fetch.
167+
run: |
168+
sudo --preserve-env --set-home --user=builder bash -c '
169+
set -e
170+
if test -f .git/shallow; then
171+
git fetch --unshallow origin
172+
fi
173+
git remote add microsoft https://github.com/microsoft/git.git
174+
git remote add upstream https://github.com/git/git.git
175+
git remote add git-for-windows https://github.com/git-for-windows/git.git
176+
git fetch microsoft "+refs/tags/*:refs/tags/*"
177+
git fetch upstream "+refs/tags/*:refs/tags/*"
178+
git fetch git-for-windows "+refs/tags/*:refs/tags/*"
179+
'
151180
- run: chmod a+w $GITHUB_ENV && sudo --preserve-env --set-home --user=builder ci/run-build-and-tests.sh
181+
- name: Install Node.js (for Copilot CLI)
182+
if: failure()
183+
uses: actions/setup-node@v4
184+
with:
185+
node-version: '20'
186+
- name: Set up Copilot CLI
187+
if: failure()
188+
run: |
189+
npm install -g @github/copilot
190+
mkdir -p ci-diagnosis
191+
chown -R builder ci-diagnosis
192+
- name: Run Copilot CLI to debug failure
193+
if: failure()
194+
timeout-minutes: 75
195+
env:
196+
GH_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
197+
# Use the `@file` syntax for the prompt rather than inlining the
198+
# whole prose on the command line; the prompt expands to several
199+
# KB and some shells truncate long argv. Run as root (the
200+
# container's default user) so the install path stays simple;
201+
# the prompt itself instructs the agent to re-invoke the failing
202+
# command via `sudo --preserve-env --set-home --user=builder
203+
# ci/run-build-and-tests.sh` so the verification reproduces the
204+
# workflow's exact conditions.
205+
run: |
206+
copilot -p "Follow the instructions in @.github/copilot-prompts/debug-linux32.md exactly." \
207+
--yolo </dev/null
208+
- name: Archive Copilot session state
209+
if: always()
210+
run: |
211+
if test -d "$HOME/.copilot"; then
212+
tar czf copilot-session.tar.gz -C "$HOME" .copilot
213+
fi
214+
- name: Upload Copilot artifacts
215+
if: always() && (hashFiles('copilot-session.tar.gz') != '' || hashFiles('ci-diagnosis/**') != '')
216+
uses: actions/upload-artifact@v7
217+
with:
218+
name: copilot-debug
219+
path: |
220+
copilot-session.tar.gz
221+
ci-diagnosis/
152222
- name: print test failures
153223
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
154224
run: sudo --preserve-env --set-home --user=builder ci/print-test-failures.sh

0 commit comments

Comments
 (0)