Skip to content

Commit 3e41e36

Browse files
feat(ci): one run per PR head, the private bootstrap off pull requests, in-job skips and a once-only flake rerun (T133 ci-efficiency a01) (#409)
* test(ci): concurrency per PR head, private bootstrap off pull requests, in-job skips and the flake rerun script (T133 ci-efficiency a01, red) The workflow tests read the concurrency block of test.yaml, remote.yaml and agent-assets.yml, the triggers of a new private-bootstrap.yaml, the bootstrap decision's path filter and the macos-14 skip of an OS-independent diff. test_ci_rerun.py drives scripts/orchestrator/ci-rerun.sh with a stub gh. The item 0 measurement (measure.md) and the task copy come first, before any workflow change. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(ci): one run per PR head, the private bootstrap off pull requests, in-job skips and a once-only flake rerun (T133 ci-efficiency a01) - test.yaml, remote.yaml, agent-assets.yml: one concurrency group per pull request (a newer head cancels the older run) and per main commit (always completes); schedule and dispatch runs never share a PR's group. - private-bootstrap moves from remote.yaml to private-bootstrap.yaml, which runs on push to main, the same weekly schedule and workflow_dispatch; it is not a required check. remote.yaml keeps public-bootstrap only. - The bootstrap decision runs on a pull request only when a path that can change what setup.sh installs changed (or the diff is empty); the unit test decision skips macos-14 on a pull request whose every relevant path is Python, docs or records, and names the reason it skipped. No job-level if or needs: every required context still reports. - .github/flakes.yaml seeds one measured signature (a Snap Store assertion timeout); scripts/orchestrator/ci-rerun.sh reruns a run's failed jobs once when every failure matches one, records the rerun in .orchestration/validation/ci-reruns.tsv, and exits 3 on a real failure. - test_workflow_security.py: EXPECTED_PERMISSIONS gains the new workflow (amendment 1). Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(ci): ci-rerun.sh reports a failing gh call as exit 1, never with its own codes (T133 ci-efficiency a01, worker review P2, red) gh exits 4 when it needs authentication and 2 when cancelled; under set -e the script passed those through, so a sandbox without gh's token read as "already rerun once" (4) or a usage error (2). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(ci): ci-rerun.sh exits 1 on any failed gh or jq call; the concurrency comment says what the group does (T133 ci-efficiency a01, worker review P2 and P3) Under set -e a failing `gh run view` or `gh run rerun` returned gh's own code, so gh's 4 (authentication required) read as "already rerun once" and its 2 (cancelled) as a usage error; jq 1.6 also exits 2 on bad input. Each call now ends in `|| exit 1`. The workflows' comment no longer claims a main, schedule or dispatch run has a group of its own: it is grouped by its commit, never with a pull request, and never cancelled while it runs. Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(orchestration): T133 ci-efficiency a01 records (report, validation, sandbox, learning, worker review evidence) Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(ci): the bootstrap gate runs on .chezmoiroot and vendor/, and ci-rerun.sh reserves a run before rerunning it (T133 ci-efficiency a01, revise round 1, Bot P2 4305896433 and 4305896435, red) Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(ci): the bootstrap gate runs on .chezmoiroot and vendor/; ci-rerun.sh reserves the run under a lock before rerunning it (T133 ci-efficiency a01, revise round 1, Bot P2 4305896433 and 4305896435) - remote.yaml and private-bootstrap.yaml: the pull-request path gate also runs the bootstrap when .chezmoiroot (chezmoi's source root) or vendor/ (update-agent-assets.sh resolves its source root through vendor/compactiondb) changes. - ci-rerun.sh: one call at a time holds ci-reruns.lock beside the ledger (an atomic mkdir, released on exit); the ledger check runs under it, the rows are written before `gh run rerun`, and a failed rerun exits 1 with the reservation kept, so a crash or a concurrent call never reruns twice. Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(orchestration): T133 ci-efficiency a01 revise round 1 records (task copy at amendment 2, revise.yaml, report, validation, sandbox) Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(ci): the a01 audit's P2 as tests: superseded heads, timed-out and cancelled jobs, the production registry, per-run reservations and home or install Markdown on macOS (T133 ci-efficiency a02, red) Red against 27613c0: ci-rerun.sh reruns a superseded head's run, ignores timed-out and cancelled jobs, and serialises every run behind one checkout-wide lock; test.yaml's `.*\.md$` lets Markdown under home/ or install/ skip macOS. The production-registry test reads the checked-in .github/flakes.yaml; its red evidence is a mutated registry. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(ci): ci-rerun.sh refuses superseded heads, needs a signature for every failed, timed-out or cancelled job, and reserves per run; home or install Markdown keeps macOS (T133 ci-efficiency a02) - A pull-request run must belong to one pull request whose current head is the run's headSha, checked before the logs are read and again right before the rerun; a mismatch is `superseded: run <id>` (exit 3) and unreadable evidence exits 1, never rerunning. - Jobs concluded failure, timed_out or cancelled all need a signature; timed-out and cancelled logs are read whole, and an empty log matches nothing. - The checkout-wide ci-reruns.lock gives way to a persistent atomic ci-reruns.lock.d/<run-id> taken after classification and the first head check, before the ledger rows and the rerun; it blocks only its own run. - test.yaml: the OS-independent Markdown arm is `[^/]+\.md$`, so only root-level Markdown lets a pull request skip macos-14. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(ci): ci-rerun.sh refuses a run still in progress; a missing log matches no signature; the stub runs the script's --jq on a pull_requests payload (T133 ci-efficiency a02, worker review, red) Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(ci): ci-rerun.sh refuses a run not completed yet and reports a reservation it cannot create as an error; the flake file's header says what is matched (T133 ci-efficiency a02, worker review P2 and P3) A run in progress has jobs that are not final: GitHub refuses its rerun (spending the reservation) or `--failed` reruns jobs that failed after the snapshot without a signature. It now exits 2 before any reservation. A failed mkdir of the reservation exits 1 unless the directory exists. Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(orchestration): T133 ci-efficiency a02 records (report, validation, sandbox, learning, autoskill, the inherited measurement, worker review evidence) Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(ci): the test, public-bootstrap and private-bootstrap matrices do not fail fast (T133 ci-efficiency a02, amendment 1, revise round 1, red) Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(ci): the test, public-bootstrap and private-bootstrap matrices set fail-fast false (T133 ci-efficiency a02, amendment 1, revise round 1) Under GitHub's default fail-fast true, one failing matrix job cancels its siblings; ci-rerun.sh needs a signature for every cancelled job, so it refused the measured flake run 39046848147 attempt 1, whose two cancelled public-bootstrap jobs only a sibling's failure had caused. Every matrix job now reports its own conclusion. Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(orchestration): T133 ci-efficiency a02 revise round 1 records (task copy at amendment 1, revise.yaml, report, validation) Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(ci): two concurrent ci-rerun.sh calls rerun a run once even where mkdir ignores EEXIST (T133 ci-efficiency a02, revise round 1, red) PR #409's ubuntu-26.04 canary (run 39111755140, job 117629185615) failed test_ci_rerun_reservations_are_per_run_and_do_not_block_other_runs with [0, 4] != [0, 0]: both concurrent calls for one run reran it. uutils' mkdir ignored EEXIST on a non-recursive creation until uutils bf423f388d (2026-08-28), and Ubuntu 26.04 ships an older uutils. A fake mkdir with that behaviour first on PATH makes the race deterministic. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(ci): ci-rerun.sh claims a run's reservation with mkdir(2), not the mkdir binary (T133 ci-efficiency a02, revise round 1) uutils' mkdir ignored EEXIST on a non-recursive creation until uutils bf423f388d (2026-08-28, uutils/coreutils#13970), so on Ubuntu 26.04 both of two concurrent calls for one run "created" its reservation and reran it (PR #409's ubuntu-26.04 canary). python3's os.mkdir makes the mkdir(2) call itself: FileExistsError exits 4, any other failure 1. Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(orchestration): T133 ci-efficiency a02 records for revise round 1 and the canary race (report, validation, learning) Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent de3b73c commit 3e41e36

28 files changed

Lines changed: 5223 additions & 98 deletions

‎.github/flakes.yaml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Known CI flakes. scripts/orchestrator/ci-rerun.sh reruns a completed run's
2+
# failed jobs once, and only when every job concluded failure, timed_out or
3+
# cancelled matches one of these: `job` against the job name and `log_regex`
4+
# against its log (`gh run view --log-failed`, or the whole `--log` of a
5+
# timed-out or cancelled job), both extended regular expressions (grep -E). A
6+
# job with no log matches nothing. Add a signature only with the log line of a
7+
# measured failed run beside it in the task's records, and its sample in
8+
# tests/unit/test_ci_rerun.py.
9+
- id: snapcraft-assertion-timeout
10+
job: '^public-bootstrap \(ubuntu-'
11+
log_regex: 'cannot fetch assertion: got unexpected HTTP status code (408|5[0-9][0-9]) via GET to "https://api\.snapcraft\.io/'
12+
note: snap install timed out fetching an assertion from the Snap Store (run 39046848147 attempt 1, 2026-10-17); the rerun passed.

‎.github/workflows/agent-assets.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ on:
1010
# Keep agent, MCP, plugin, and skill metadata from drifting silently.
1111
- cron: "23 20 * * 0"
1212

13+
# A pull request's newer head cancels its older run. A main push, schedule or
14+
# dispatch run is grouped by its commit, never with a pull request, and is never
15+
# cancelled while it runs.
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('main-{0}', github.sha) }}
18+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
19+
1320
permissions:
1421
contents: read
1522

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Private bootstrap
2+
3+
# The private bootstrap is not a required check and needs secrets a pull
4+
# request does not get, so it runs on main, weekly and on demand only.
5+
on:
6+
push:
7+
branches: [main]
8+
workflow_dispatch:
9+
schedule:
10+
- cron: "0 0 * * 5"
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
private-bootstrap:
17+
# A failing matrix job never cancels its siblings: each required context reports its own conclusion, and
18+
# scripts/orchestrator/ci-rerun.sh never meets a cancellation that only a sibling caused.
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- os: ubuntu-24.04
24+
system: client
25+
- os: ubuntu-24.04
26+
system: server
27+
- os: macos-14
28+
system: client
29+
30+
runs-on: ${{ matrix.os }}
31+
env:
32+
CI: true
33+
SYSTEM: ${{ matrix.system }}
34+
HAS_EMAIL_ADDRESS: ${{ secrets.EMAIL_ADDRESS != '' }}
35+
HAS_PRIVATE_DEPLOY_KEY: ${{ secrets.PRIVATE_DOTFILES_PRIVATE_DEPLOY_KEY != '' }}
36+
37+
steps:
38+
- name: Configure isolated HOME
39+
run: |
40+
mkdir -p "${RUNNER_TEMP}/dotfiles-home"
41+
printf 'HOME=%s/dotfiles-home\n' "${RUNNER_TEMP}" >> "${GITHUB_ENV}"
42+
43+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
44+
with:
45+
fetch-depth: 0
46+
persist-credentials: false
47+
48+
- name: Decide whether the diff needs a bootstrap
49+
id: decide
50+
env:
51+
EVENT_NAME: ${{ github.event_name }}
52+
BASE_REF: ${{ github.base_ref }}
53+
HEAD_SHA: ${{ github.sha }}
54+
shell: bash
55+
run: |
56+
set -euo pipefail
57+
# Decided in this job, never in a job it needs: a job skipped because
58+
# a needed job failed reports Success even as a required check, so a
59+
# failed decision has to fail this job instead. Only a pull request has
60+
# a base-to-head range to judge; push, schedule and workflow_dispatch
61+
# keep bootstrapping main.
62+
if [ "${EVENT_NAME}" != pull_request ]; then
63+
echo "should_run=true" >> "${GITHUB_OUTPUT}"
64+
exit 0
65+
fi
66+
# A full fetch: a shallow one cuts the history of a base tip that
67+
# moved after the checkout, and the diff then has no merge base.
68+
git fetch --no-tags origin "${BASE_REF}"
69+
# --no-renames lists both sides of a rename; core.quotePath off keeps
70+
# non-ASCII paths raw. An empty diff runs the bootstrap, and so does a
71+
# path that can change what setup.sh installs or how this job runs it.
72+
changed="$(git -c core.quotePath=false diff --no-renames --name-only "origin/${BASE_REF}...${HEAD_SHA}")"
73+
if [ -z "${changed}" ] || grep -Eq '^(setup\.sh$|\.chezmoiroot$|vendor/|install/|home/|scripts/lib/|scripts/update-agent-assets\.sh$|scripts/gh-auth\.sh$|tests/install/|\.github/workflows/remote\.yaml$|\.github/workflows/private-bootstrap\.yaml$)' <<< "${changed}"; then
74+
echo "should_run=true" >> "${GITHUB_OUTPUT}"
75+
else
76+
echo "should_run=false" >> "${GITHUB_OUTPUT}"
77+
fi
78+
79+
- name: Skip the bootstrap when no bootstrap path changed
80+
if: ${{ steps.decide.outputs.should_run != 'true' }}
81+
run: echo "No path the bootstrap reads changed; the job reports success without bootstrapping."
82+
83+
- name: Explain skipped private bootstrap
84+
if: ${{ contains(github.actor, '[bot]') || env.HAS_EMAIL_ADDRESS != 'true' || env.HAS_PRIVATE_DEPLOY_KEY != 'true' }}
85+
run: echo "Private bootstrap is optional and secrets are unavailable in this context."
86+
87+
- name: Set up the private deploy key
88+
if: ${{ steps.decide.outputs.should_run == 'true' && !contains(github.actor, '[bot]') && env.HAS_EMAIL_ADDRESS == 'true' && env.HAS_PRIVATE_DEPLOY_KEY == 'true' }}
89+
uses: webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555 # v0.10.0
90+
with:
91+
ssh-private-key: ${{ secrets.PRIVATE_DOTFILES_PRIVATE_DEPLOY_KEY }}
92+
93+
- name: Bootstrap with private restoration
94+
if: ${{ steps.decide.outputs.should_run == 'true' && !contains(github.actor, '[bot]') && env.HAS_EMAIL_ADDRESS == 'true' && env.HAS_PRIVATE_DEPLOY_KEY == 'true' }}
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
EMAIL_ADDRESS: ${{ secrets.EMAIL_ADDRESS }}
98+
shell: bash
99+
run: |
100+
set -euo pipefail
101+
git checkout -b bootstrap-under-test
102+
printf '%s\n%s\n' "${EMAIL_ADDRESS}" "${SYSTEM}" | \
103+
DOTFILES_REPO_URL="${GITHUB_WORKSPACE}" BRANCH_NAME=bootstrap-under-test \
104+
bash "${GITHUB_WORKSPACE}/setup.sh"

‎.github/workflows/remote.yaml‎

Lines changed: 15 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,22 @@ on:
99
schedule:
1010
- cron: "0 0 * * 5"
1111

12+
# A pull request's newer head cancels its older run. A main push, schedule or
13+
# dispatch run is grouped by its commit, never with a pull request, and is never
14+
# cancelled while it runs.
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('main-{0}', github.sha) }}
17+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
18+
1219
permissions:
1320
contents: read
1421

1522
jobs:
1623
public-bootstrap:
24+
# A failing matrix job never cancels its siblings: each required context reports its own conclusion, and
25+
# scripts/orchestrator/ci-rerun.sh never meets a cancellation that only a sibling caused.
1726
strategy:
27+
fail-fast: false
1828
matrix:
1929
include:
2030
- os: ubuntu-24.04
@@ -62,17 +72,18 @@ jobs:
6272
# moved after the checkout, and the diff then has no merge base.
6373
git fetch --no-tags origin "${BASE_REF}"
6474
# --no-renames lists both sides of a rename; core.quotePath off keeps
65-
# non-ASCII paths raw. An empty diff runs the bootstrap.
75+
# non-ASCII paths raw. An empty diff runs the bootstrap, and so does a
76+
# path that can change what setup.sh installs or how this job runs it.
6677
changed="$(git -c core.quotePath=false diff --no-renames --name-only "origin/${BASE_REF}...${HEAD_SHA}")"
67-
if grep -qv '^\.orchestration/' <<< "${changed}"; then
78+
if [ -z "${changed}" ] || grep -Eq '^(setup\.sh$|\.chezmoiroot$|vendor/|install/|home/|scripts/lib/|scripts/update-agent-assets\.sh$|scripts/gh-auth\.sh$|tests/install/|\.github/workflows/remote\.yaml$|\.github/workflows/private-bootstrap\.yaml$)' <<< "${changed}"; then
6879
echo "should_run=true" >> "${GITHUB_OUTPUT}"
6980
else
7081
echo "should_run=false" >> "${GITHUB_OUTPUT}"
7182
fi
7283
73-
- name: Skip the bootstrap for an .orchestration-only diff
84+
- name: Skip the bootstrap when no bootstrap path changed
7485
if: ${{ steps.decide.outputs.should_run != 'true' }}
75-
run: echo "Only .orchestration/ files changed; the job reports success without bootstrapping."
86+
run: echo "No path the bootstrap reads changed; the job reports success without bootstrapping."
7687

7788
- name: Bootstrap the checked-out public source
7889
if: ${{ steps.decide.outputs.should_run == 'true' }}
@@ -108,89 +119,3 @@ jobs:
108119
test -e "${HOME}/.bashrc"
109120
fi
110121
printf 'Validated checkout SHA %s\n' "${GITHUB_SHA}"
111-
112-
private-bootstrap:
113-
strategy:
114-
matrix:
115-
include:
116-
- os: ubuntu-24.04
117-
system: client
118-
- os: ubuntu-24.04
119-
system: server
120-
- os: macos-14
121-
system: client
122-
123-
runs-on: ${{ matrix.os }}
124-
env:
125-
CI: true
126-
SYSTEM: ${{ matrix.system }}
127-
HAS_EMAIL_ADDRESS: ${{ secrets.EMAIL_ADDRESS != '' }}
128-
HAS_PRIVATE_DEPLOY_KEY: ${{ secrets.PRIVATE_DOTFILES_PRIVATE_DEPLOY_KEY != '' }}
129-
130-
steps:
131-
- name: Configure isolated HOME
132-
run: |
133-
mkdir -p "${RUNNER_TEMP}/dotfiles-home"
134-
printf 'HOME=%s/dotfiles-home\n' "${RUNNER_TEMP}" >> "${GITHUB_ENV}"
135-
136-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
137-
with:
138-
fetch-depth: 0
139-
persist-credentials: false
140-
141-
- name: Decide whether the diff needs a bootstrap
142-
id: decide
143-
env:
144-
EVENT_NAME: ${{ github.event_name }}
145-
BASE_REF: ${{ github.base_ref }}
146-
HEAD_SHA: ${{ github.sha }}
147-
shell: bash
148-
run: |
149-
set -euo pipefail
150-
# Decided in this job, never in a job it needs: a job skipped because
151-
# a needed job failed reports Success even as a required check, so a
152-
# failed decision has to fail this job instead. Only a pull request has
153-
# a base-to-head range to judge; push, schedule and workflow_dispatch
154-
# keep bootstrapping main.
155-
if [ "${EVENT_NAME}" != pull_request ]; then
156-
echo "should_run=true" >> "${GITHUB_OUTPUT}"
157-
exit 0
158-
fi
159-
# A full fetch: a shallow one cuts the history of a base tip that
160-
# moved after the checkout, and the diff then has no merge base.
161-
git fetch --no-tags origin "${BASE_REF}"
162-
# --no-renames lists both sides of a rename; core.quotePath off keeps
163-
# non-ASCII paths raw. An empty diff runs the bootstrap.
164-
changed="$(git -c core.quotePath=false diff --no-renames --name-only "origin/${BASE_REF}...${HEAD_SHA}")"
165-
if grep -qv '^\.orchestration/' <<< "${changed}"; then
166-
echo "should_run=true" >> "${GITHUB_OUTPUT}"
167-
else
168-
echo "should_run=false" >> "${GITHUB_OUTPUT}"
169-
fi
170-
171-
- name: Skip the bootstrap for an .orchestration-only diff
172-
if: ${{ steps.decide.outputs.should_run != 'true' }}
173-
run: echo "Only .orchestration/ files changed; the job reports success without bootstrapping."
174-
175-
- name: Explain skipped private bootstrap
176-
if: ${{ contains(github.actor, '[bot]') || env.HAS_EMAIL_ADDRESS != 'true' || env.HAS_PRIVATE_DEPLOY_KEY != 'true' }}
177-
run: echo "Private bootstrap is optional and secrets are unavailable in this context."
178-
179-
- name: Set up the private deploy key
180-
if: ${{ steps.decide.outputs.should_run == 'true' && !contains(github.actor, '[bot]') && env.HAS_EMAIL_ADDRESS == 'true' && env.HAS_PRIVATE_DEPLOY_KEY == 'true' }}
181-
uses: webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555 # v0.10.0
182-
with:
183-
ssh-private-key: ${{ secrets.PRIVATE_DOTFILES_PRIVATE_DEPLOY_KEY }}
184-
185-
- name: Bootstrap with private restoration
186-
if: ${{ steps.decide.outputs.should_run == 'true' && !contains(github.actor, '[bot]') && env.HAS_EMAIL_ADDRESS == 'true' && env.HAS_PRIVATE_DEPLOY_KEY == 'true' }}
187-
env:
188-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
189-
EMAIL_ADDRESS: ${{ secrets.EMAIL_ADDRESS }}
190-
shell: bash
191-
run: |
192-
set -euo pipefail
193-
git checkout -b bootstrap-under-test
194-
printf '%s\n%s\n' "${EMAIL_ADDRESS}" "${SYSTEM}" | \
195-
DOTFILES_REPO_URL="${GITHUB_WORKSPACE}" BRANCH_NAME=bootstrap-under-test \
196-
bash "${GITHUB_WORKSPACE}/setup.sh"

‎.github/workflows/test.yaml‎

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ on:
1010
branches: [main]
1111
pull_request:
1212
branches: [main]
13+
14+
# A pull request's newer head cancels its older run. A main push, schedule or
15+
# dispatch run is grouped by its commit, never with a pull request, and is never
16+
# cancelled while it runs.
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('main-{0}', github.sha) }}
19+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
20+
1321
permissions:
1422
contents: read
1523

@@ -18,7 +26,10 @@ jobs:
1826
# Run the same test suite on each target OS/system pair.
1927
# We intentionally keep macOS as `client` only because this repository
2028
# does not define a macOS `server` test target.
29+
# A failing matrix job never cancels its siblings: each required context reports its own conclusion, and
30+
# scripts/orchestrator/ci-rerun.sh never meets a cancellation that only a sibling caused.
2131
strategy:
32+
fail-fast: false
2233
matrix:
2334
os: [ubuntu-24.04, macos-14]
2435
system: [client, server]
@@ -99,16 +110,25 @@ jobs:
99110
# home/ into .orchestration/ still runs the tests.
100111
changed="$(git -c core.quotePath=false diff --no-renames --name-only "${diff_range}")"
101112
relevant="$(grep -v '^\.orchestration/' <<< "${changed}" || true)"
102-
if grep -Eq '^(\.github/workflows/|home/|install/|scripts/|tests/|plans/|docs/|setup\.sh$|Makefile$|ruff\.toml$|\.prettierignore$)|(^|/)[^/]+\.(py|md)$' <<< "${relevant}"; then
103-
echo "should_test=true" >> "${GITHUB_OUTPUT}"
104-
else
113+
if ! grep -Eq '^(\.github/workflows/|home/|install/|scripts/|tests/|plans/|docs/|setup\.sh$|Makefile$|ruff\.toml$|\.prettierignore$)|(^|/)[^/]+\.(py|md)$' <<< "${relevant}"; then
105114
echo "should_test=false" >> "${GITHUB_OUTPUT}"
115+
echo "skip_reason=unrelated" >> "${GITHUB_OUTPUT}"
116+
# macOS adds nothing to a pull request whose every relevant path is Python, docs or records: a shell,
117+
# install, home, bats, Makefile or workflow change keeps it, and a push to main runs the full matrix.
118+
elif [ "${OS:-}" = macos-14 ] && [ "${EVENT_NAME}" = pull_request ] &&
119+
! grep -Evq '^(scripts/.*\.py$|tests/unit/.*\.py$|docs/|plans/|\.orchestration/|[^/]+\.md$|ruff\.toml$|\.prettierignore$)' <<< "${relevant}"; then
120+
echo "should_test=false" >> "${GITHUB_OUTPUT}"
121+
echo "skip_reason=os-independent on macos-14" >> "${GITHUB_OUTPUT}"
122+
else
123+
echo "should_test=true" >> "${GITHUB_OUTPUT}"
106124
fi
107125
108126
- name: Skip full unit test run for unrelated changes
109127
if: ${{ steps.decide.outputs.should_test != 'true' }}
128+
env:
129+
SKIP_REASON: ${{ steps.decide.outputs.skip_reason }}
110130
run: |
111-
echo "No unit-test-relevant files changed."
131+
echo "Skipped the unit tests: ${SKIP_REASON}."
112132
echo "Compared diff range: ${{ steps.decide.outputs.diff_range }}"
113133
114134
- name: Install tools
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[
2+
{
3+
"id": "t133-worker-review-p2-gh-exit-codes",
4+
"scope": "scripts/orchestrator/ci-rerun.sh",
5+
"body": "P2, fixed. Under set -e a failing `gh run view` or `gh run rerun` returned gh's own exit code. gh exits 4 when it needs authentication and 2 when cancelled, so a seat without gh's token read as \"already rerun once\" (4) or a usage error (2), and the `@exitcode 1` line was false. The reviewer reproduced it with a stub gh that exits 4. Red in 20096edf: test_a_failing_gh_exits_1_never_with_the_scripts_own_codes failed with 1 != 4 and 1 != 2. Fixed in 414e475b: every gh call, both jq calls (jq 1.6 exits 2 on bad input) and the signature read end in `|| exit 1`, and the @exitcode line says so.",
6+
"resolved": true
7+
},
8+
{
9+
"id": "t133-worker-review-p2-bootstrap-path-coverage",
10+
"scope": ".github/workflows/remote.yaml",
11+
"body": "P2, declared (task text). The bootstrap path pattern is item 3's text verbatim and misses `vendor/` and `.chezmoiroot`. scripts/update-agent-assets.sh resolves its source root through vendor/compactiondb and copies it during run_once_after_06, and .chezmoiroot selects chezmoi's source directory. A PR changing only those paths gives should_run=false. The consequence is coverage only: the three required public-bootstrap contexts still report, and a break first shows on main's push. Widening the pattern is a change to the task's text, so it is named in report.md and the RESULT for the orchestrator.",
12+
"resolved": true
13+
},
14+
{
15+
"id": "t133-worker-review-p3-macos-pattern-and-rerun-scope",
16+
"scope": ".github/workflows/test.yaml",
17+
"body": "Two P3, declared. (1) The OS-independent pattern `.*\\.md$` (the task's text) also matches the Markdown under `home/` and `install/`, so `home/x.md` plus a unit test gives should_test=false on macos-14. That is in tension with the task's sentence that a home change keeps macOS; a `home/` shell file does keep it. Separately, `scripts/check-statusline-tools.py` runs under sandbox-exec only on macOS. (2) ci-rerun.sh fetches `status` and `event` but does not require a completed run or the PR's current head. `gh run rerun --failed` on a superseded head's run would re-enter the `pr-<N>` group and could cancel the newest head's run, and `--failed` also reruns cancelled or timed-out jobs that no signature checked. Both are named in report.md for the follow-up owner.",
18+
"resolved": true
19+
},
20+
{
21+
"id": "t133-worker-review-scope-and-approval",
22+
"scope": "review",
23+
"body": "One review round on 3affaac7 by a fresh read-only subagent (given the commits and the task file, not the worker's conclusions): `Verdict: incorrect` on the P2 of ci-rerun.sh's exit codes. It confirmed:\n- The concurrency block is exactly the task's expression, top-level, once per file, and push, schedule and dispatch never share a PR's group.\n- No job-level if or needs; every heavy step keeps its decision; the decide steps fail closed.\n- A cancelled superseded run reports on its old commit only.\n- The moved job equals main's except the decide and skip edits.\n- The private workflow's triggers, permissions and pinned actions are right.\n- jq and gh fields: `databaseId` and `conclusion` exist.\n- The flake regex matches the pasted log line and is narrow.\n- Tests are red on 0b7c5b4c and green on 3affaac7.\n- Caps 231/250 and 220/350.\n- shellcheck, shfmt and ruff are clean, except the I001 of test_workflow_security.py, which already exists at 99a4a80f.\n\nIts P3 on the concurrency comment (a schedule or dispatch run on a pushed commit shares that commit's group) is fixed in 414e475b's comment text. After the fix round the worker re-ran the 27 tests green, plus shellcheck and shfmt. This is local process evidence, not the task-level audit or reviewer authentication.",
24+
"resolved": true
25+
}
26+
]

0 commit comments

Comments
 (0)