Skip to content

Commit d3f1d78

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 d3f1d78

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,66 @@ 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 this is the
160+
# cleaner way: just match the owner.
161+
run: |
162+
sudo --preserve-env --set-home --user=builder bash -c '
163+
git remote add microsoft https://github.com/microsoft/git.git &&
164+
git fetch --tags --no-recurse-submodules microsoft v2.54.0 vfs-2.54.0
165+
'
151166
- run: chmod a+w $GITHUB_ENV && sudo --preserve-env --set-home --user=builder ci/run-build-and-tests.sh
167+
- name: Install Node.js (for Copilot CLI)
168+
if: failure()
169+
uses: actions/setup-node@v4
170+
with:
171+
node-version: '20'
172+
- name: Set up Copilot CLI
173+
if: failure()
174+
run: |
175+
npm install -g @github/copilot
176+
mkdir -p ci-diagnosis
177+
chown -R builder ci-diagnosis
178+
- name: Run Copilot CLI to debug failure
179+
if: failure()
180+
timeout-minutes: 75
181+
env:
182+
GH_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
183+
# Use the `@file` syntax for the prompt rather than inlining the
184+
# whole prose on the command line; the prompt expands to several
185+
# KB and some shells truncate long argv. Run as root (the
186+
# container's default user) so the install path stays simple;
187+
# the prompt itself instructs the agent to re-invoke the failing
188+
# command via `sudo --preserve-env --set-home --user=builder
189+
# ci/run-build-and-tests.sh` so the verification reproduces the
190+
# workflow's exact conditions.
191+
run: |
192+
copilot -p "Follow the instructions in @.github/copilot-prompts/debug-linux32.md exactly." \
193+
--yolo </dev/null
194+
- name: Archive Copilot session state
195+
if: always()
196+
run: |
197+
if test -d "$HOME/.copilot"; then
198+
tar czf copilot-session.tar.gz -C "$HOME" .copilot
199+
fi
200+
- name: Upload Copilot artifacts
201+
if: always() && (hashFiles('copilot-session.tar.gz') != '' || hashFiles('ci-diagnosis/**') != '')
202+
uses: actions/upload-artifact@v7
203+
with:
204+
name: copilot-debug
205+
path: |
206+
copilot-session.tar.gz
207+
ci-diagnosis/
152208
- name: print test failures
153209
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
154210
run: sudo --preserve-env --set-home --user=builder ci/print-test-failures.sh

0 commit comments

Comments
 (0)