Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .agents/skills/change-maple-ci/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ fields in `lanes.py` are authoritative.
| Label | Adds | Use when |
| --- | --- | --- |
| `ci:windows` | The native updater tests and the full Windows suite (Windows Clippy already runs on every Agent PR) | Path, filesystem, process or terminal code behaves differently on Windows |
| `ci:package` | Unsigned Agent packages and Research desktop bundles on all three OSes, plus the Research Dev macOS app | Packaging or release scripts, flakes, toolchains, or bundled assets, entitlements or updater metadata change |
| `ci:package` | Unsigned Agent packages and Research desktop bundles on all three OSes, plus the Research Dev macOS app | Packaging or release scripts, flakes, toolchains, or bundled assets, entitlements or updater metadata change. Also a gpui/zed revision bump, an Xcode pin change or an edit to the Metal Toolchain actions: PR lanes build gpui with runtime shaders, and only the macOS rehearsal compiles them before master's signed build |
| `ci:ios`, `ci:android` | The Research iOS simulator or Android build | Research changes reach native mobile code or mobile-only plugins that their paths do not select |
| `ci:research-dev-macos` | The unsigned Research Dev app | Research Dev OAuth profile work |
| `ci:eif` | Dev and prod OpenSecret EIF candidates (`os-eif`) | The selector misses a measured input. Works only on a same-repository PR to `master` that edits no PCR approval |
Expand Down
13 changes: 11 additions & 2 deletions .agents/skills/change-maple-ci/references/changing-ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Paths are relative to the repository root. `scripts/ci/lanes.py` and
| `submodules` | Recursive submodules with full blobless history (Nix needs `revCount`) |
| `hook` | Pre-commit component that runs the same checks locally |
| `restore` | Read-only restore of a cache another workflow writes |
| `requires` | Lanes whose jobs this lane's special job needs. The planner adds them to every plan that selects the lane, dispatches included; a required lane has no paths, labels, gate or OpenSecret selector of its own and runs on no event its requirers lack, so nothing else selects it (lint). `metal-toolchain` is the example: GitHub's xcode-27 image exports Xcode's Metal Toolchain for `agent-package-macos` |

Event sets:

Expand Down Expand Up @@ -99,6 +100,8 @@ Its id is the lane's `job`. Checked by `plan.py lint` and the policy tests:
- `runs-on` exactly `${{ vars.<VARIABLE> || '<label>' }}` when the runner has
an override variable, otherwise the plain label; `timeout-minutes` equals
the lane's `timeout` (lint).
- A lane with `requires` has its own job, whose `needs:` lists each required
lane's job (lint).
- `ci-ok` needs it (test 8); a new runner label is declared in
`.github/actionlint.yaml` (test 9 and lint); checkouts use
`persist-credentials: false` (test 3).
Expand Down Expand Up @@ -132,7 +135,7 @@ The `Runner` constants at the top of `lanes.py` are authoritative.
| `MACOS` (Blacksmith macOS) | `CI_MACOS_RUNNER` |
| `WINDOWS` (Blacksmith Windows) | `CI_WINDOWS_RUNNER` |
| `GITHUB_WINDOWS` (`maple-windows-2025-16core`) | `CI_WINDOWS_GITHUB_RUNNER`, read only by special jobs |
| `GITHUB`, `GITHUB_WINDOWS_FREE`, `EIF_BUILDER`, inline `ubuntu-24.04-arm` | none |
| `GITHUB`, `GITHUB_WINDOWS_FREE`, `GITHUB_XCODE` (`xcode-27`), `EIF_BUILDER`, inline `ubuntu-24.04-arm` | none |

- Matrix lanes resolve their runner when `plan` runs. A new matrix variable
must be passed in the `plan` step's `env`; `lint` checks this.
Expand All @@ -159,7 +162,10 @@ The `Runner` constants at the top of `lanes.py` are authoritative.
- The Agent release key's hash is a step output from
`scripts/ci/cargo_graph_key.py`, not `hashFiles`. C4 runs that step, with
the script working and failing, so an empty or misnamed output cannot turn
the exact key into a family prefix.
the exact key into a family prefix. The macOS build also passes
`scripts/ci/apple-toolchain.json`, as the macOS lanes list it in
`cache_files`: an Xcode upgrade must not restore objects built against the
previous SDK.
- Turn off implicit saves on PR paths: setup-bun `no-cache: true` and no
Magic Nix Cache (both checked), and Trivy `cache: "false"` (convention).
- After a lockfile change, master's first save deletes the lane's target
Expand Down Expand Up @@ -252,6 +258,9 @@ selected or nightly; run it yourself after doc edits.
`just lane <id>` runs exactly what CI runs. Limits:

- macOS lanes need macOS and the pinned Xcode (`scripts/ci/select-xcode.py`).
The Agent's Clippy and native suite build gpui with `runtime_shaders`, so
they need no Metal Toolchain; the packaging rehearsal compiles the shaders
and needs it (`xcodebuild -downloadComponent MetalToolchain`).
- Windows lanes need Windows with the toolchain from
`.github/actions/setup-agent-windows`.
- `os-sdk-e2e` needs PostgreSQL on `127.0.0.1:5432` with the credentials in
Expand Down
9 changes: 5 additions & 4 deletions .agents/skills/change-maple-ci/references/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Start with the facts the run already has:
| --- | --- | --- |
| Push a commit | Yes | Code fixes; also picks up new labels and variables |
| **Re-run all jobs** | Yes: `plan` reads the PR's current labels and repository variables | After adding a label, or changing `CI_QUARANTINE` or a `CI_*_RUNNER` variable. GitHub offers it only on a finished run: cancel a running PR run first, never a master run |
| **Re-run failed jobs** | No: reuses the old `plan` outputs (lanes, matrix runners, quarantine) | Infrastructure flakes in a lane |
| **Re-run failed jobs** | No: reuses the old `plan` outputs (lanes, matrix runners, quarantine) | Infrastructure flakes in a lane. A job that imports the Metal Toolchain (`agent-package-macos`) re-run more than a day later fails at the download, because the `metal-toolchain` artifact lives one day: re-run `metal-toolchain` too, or all jobs |
| Dispatch `ci.yml` | Its own plan from the `lanes` input | Running lanes on a branch outside a PR. It never saves caches |

Adding a label never starts a run by itself. That is deliberate: a label
Expand All @@ -32,7 +32,7 @@ the cancellation to finish, so rapid re-pushes each add some delay.
| Signature | Cause | Response |
| --- | --- | --- |
| Nix setup fails: `HTTP error 416`, `SSL_read`, or "is required, but there is no substituter" | Transient `cache.nixos.org` error. Setup has no automatic retry | Re-run the failed job |
| "lost communication with the server", or a job that vanished mid-run | Lost runner | Re-run failed jobs. On `agent-desktop-build.yml` (signed builds), ask the release owner first; a re-run in the same run keeps the build number |
| "lost communication with the server", or a job that vanished mid-run | Lost runner | Re-run failed jobs. On `agent-desktop-build.yml` (signed builds), ask the release owner first; a re-run in the same run keeps the build number. A macOS build re-run more than a day later also needs **Export the Metal Toolchain** re-run, since its artifact lives one day |
| `plan` fails with `lane selection failed` on a PR | A label read through `gh api` failed, or the event payload was unusable | **Re-run all jobs** |
| `plan` fails on every event, master included | `CI_QUARANTINE` names an unknown lane or `repo` | Fix or clear the variable |
| `plan` succeeds but selects every lane | An unclassified path, or no usable diff (new branch, force-push) | Own or mark inert the path in `lanes.py`; `plan.py lint` lists it |
Expand Down Expand Up @@ -62,15 +62,16 @@ the cancellation to finish, so rapid re-pushes each add some delay.
lanes save only from the 04:17 UTC nightly run. A labelled run right after
a lockfile change restores by prefix and is slower.
- **Agent master builds.** The exact-key release cache misses when a
third-party package, a dependency edge or `flake.lock` changes (a version
third-party package, a dependency edge, `flake.lock` or, for macOS,
`scripts/ci/apple-toolchain.json` changes (a version
bump of workspace or path crates keeps it), and fat LTO bounds the link. The
master Agent build is slow by design; it does not gate PRs.
- **Queued jobs.** If `agent-lint` or `agent-test` sit queued while other
Blacksmith jobs start, the 32-vCPU pool is bursting. Set the repository
variable `CI_LINUX_HEAVY_RUNNER=blacksmith-16vcpu-ubuntu-2404` (same
vendor, so caches still work) and unset it afterwards. For the 8-vCPU
lanes, `CI_LINUX_RUNNER=blacksmith-16vcpu-ubuntu-2404` keeps Blacksmith's
store. In a Blacksmith-wide outage use `ubuntu-latest` (or `macos-26`,
store. In a Blacksmith-wide outage use `ubuntu-latest` (or `xcode-27`,
`windows-2025`): cold, saves nothing, slower.
- Matrix lanes take their runner from `plan`, so re-plan: cancel a PR run,
then **Re-run all jobs**. Never cancel a master run; the variable applies
Expand Down
4 changes: 3 additions & 1 deletion .agents/skills/change-maple-ci/references/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ and the others have no better fallback.
prefix fallback could carry a removed crate's build output into a signed
binary. `scripts/ci/cargo_graph_key.py` hashes the Agent's `flake.lock` and
every third-party package and dependency edge in its `Cargo.lock`, but not
the versions of workspace and path crates. Cargo rebuilds those anyway, so a
the versions of workspace and path crates; the macOS builder also hashes
`scripts/ci/apple-toolchain.json`, so an Xcode pin change makes its next
build cold. Cargo rebuilds the local crates anyway, so a
version bump of them, the commonest Agent lockfile change, keeps the fat-LTO
build warm. Any other lockfile change makes it fully cold; that cost is
known and accepted. Only Prod pushes save it; the nightly Dev and dispatch
Expand Down
4 changes: 3 additions & 1 deletion .github/actionlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ self-hosted-runner:
labels:
- blacksmith-16vcpu-ubuntu-2404-arm
- blacksmith-8vcpu-windows-2025
- blacksmith-6vcpu-macos-26
- blacksmith-6vcpu-macos-27
- blacksmith-8vcpu-ubuntu-2404
- blacksmith-32vcpu-ubuntu-2404
# GitHub-hosted larger runner (org runner group "Maple"); actionlint only knows standard labels.
- maple-windows-2025-16core
# GitHub-hosted Xcode 27 image; newer than the pinned actionlint label list.
- xcode-27
30 changes: 30 additions & 0 deletions .github/actions/export-metal-toolchain/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Export the Metal Toolchain
description: >-
Download the selected Xcode's Metal Toolchain and upload it as this run's
one-day `metal-toolchain` artifact. Blacksmith's macOS image has no Metal
Toolchain and cannot download it (its MobileAsset catalog fetch fails), so a
GitHub xcode-27 job exports it and the Blacksmith jobs import it. Run it after
selecting the pinned Xcode.
runs:
using: composite
steps:
- name: Download and export the Metal Toolchain
shell: bash
run: |
set -euo pipefail
export_dir="$RUNNER_TEMP/metal-toolchain"
mkdir -p "$export_dir"
xcodebuild -downloadComponent metalToolchain -exportPath "$export_dir"
# Keep symlinks and modes intact; artifacts flatten them.
tar -C "$export_dir" -cf "$RUNNER_TEMP/metal-toolchain.tar" .
- name: Upload the Metal Toolchain
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: metal-toolchain
path: ${{ runner.temp }}/metal-toolchain.tar
if-no-files-found: error
# Re-run all jobs uploads it again under the same name.
overwrite: true
# Apple's toolchain, re-hosted only for this run's jobs.
retention-days: 1
compression-level: 0
34 changes: 34 additions & 0 deletions .github/actions/import-metal-toolchain/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Import the Metal Toolchain
description: >-
Install the Metal Toolchain that this run's metal-toolchain job exported, so
gpui can compile its Metal shaders on Blacksmith's macOS image. A runner whose
Xcode already has it (GitHub's xcode-27 image, during a failover) skips the
import. Run it after selecting the pinned Xcode.
runs:
using: composite
steps:
# The artifact lives one day. A later "Re-run failed jobs" finds it gone: re-run the
# metal-toolchain job (Export the Metal Toolchain) so its dependents re-run with it.
- name: Download the exported Metal Toolchain
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: metal-toolchain
path: ${{ runner.temp }}/metal-toolchain-artifact
- name: Import the Metal Toolchain
shell: bash
run: |
set -euo pipefail
# Capture first: grep -q could close the pipe while xcodebuild still writes.
component="$(xcodebuild -showComponent metalToolchain 2>/dev/null || true)"
if grep -q '^Status: installed' <<<"$component"; then
echo "The selected Xcode already has its Metal Toolchain."
else
import_dir="$RUNNER_TEMP/metal-toolchain"
mkdir -p "$import_dir"
tar -C "$import_dir" -xf "$RUNNER_TEMP/metal-toolchain-artifact/metal-toolchain.tar"
bundle="$(find "$import_dir" -maxdepth 1 \( -name '*.exportedBundle' -o -name '*.dmg' \) -print -quit)"
test -n "$bundle"
xcodebuild -importComponent metalToolchain -importPath "$bundle" \
|| sudo xcodebuild -importComponent metalToolchain -importPath "$bundle"
fi
xcrun -sdk macosx metal --version
41 changes: 31 additions & 10 deletions .github/workflows/agent-desktop-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,31 @@ jobs:
# Dispatch, the nightly run, an unusable push base and selector errors all build.
run: python3 scripts/ci/plan.py only agent-desktop >> "$GITHUB_OUTPUT"

# Blacksmith's macOS image cannot download Xcode's Metal Toolchain, so GitHub's
# xcode-27 image exports it for the macOS build, which compiles gpui's shaders.
metal-toolchain:
name: Export the Metal Toolchain
needs: changes
if: ${{ always() && !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.agent != 'false') && github.repository == 'MaplePrivacyLabs/Maple' && github.ref == 'refs/heads/master' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') }}
runs-on: xcode-27
permissions:
contents: read
timeout-minutes: 15
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
ref: ${{ github.sha }}
persist-credentials: false
- name: Select pinned Xcode
working-directory: .
run: python3 scripts/ci/select-xcode.py
- uses: ./.github/actions/export-metal-toolchain

macos-build:
name: Build macOS binary (${{ matrix.variant }})
needs: changes
needs: [changes, metal-toolchain]
if: ${{ always() && !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.agent != 'false') && github.repository == 'MaplePrivacyLabs/Maple' && github.ref == 'refs/heads/master' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') }}
runs-on: blacksmith-6vcpu-macos-26
runs-on: blacksmith-6vcpu-macos-27
permissions:
contents: read
timeout-minutes: 120
Expand All @@ -82,17 +102,18 @@ jobs:
- name: Select pinned Xcode
working-directory: .
run: python3 scripts/ci/select-xcode.py
- uses: ./.github/actions/import-metal-toolchain
- name: Hash the Agent's third-party dependency graph and toolchain
id: graph
run: python3 ../../scripts/ci/cargo_graph_key.py Cargo.lock flake.lock >> "$GITHUB_OUTPUT"
run: python3 ../../scripts/ci/cargo_graph_key.py Cargo.lock flake.lock ../../scripts/ci/apple-toolchain.json >> "$GITHUB_OUTPUT"
- name: Restore the exact-key Agent release cache
id: cache
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
# No restore-keys: a master build never starts from another dependency
# graph's artifacts. The hash covers flake.lock and every third-party
# package and edge in Cargo.lock, not workspace or path crate versions
# (Cargo rebuilds those anyway). Prod pushes save it; Dev builds only
# graph's artifacts. The hash covers flake.lock, every third-party
# package and edge in Cargo.lock and, on macOS, the Xcode pin, not workspace
# or path crate versions (Cargo rebuilds those anyway). Prod pushes save it; Dev builds only
# restore it (Cargo rebuilds what the profile changes).
key: ci-v1-agent-release-${{ runner.os }}-${{ steps.graph.outputs.hash }}
path: |
Expand Down Expand Up @@ -138,7 +159,7 @@ jobs:
contents: read
id-token: write
attestations: write
runs-on: macos-26
runs-on: xcode-27
timeout-minutes: 120
strategy:
fail-fast: false
Expand Down Expand Up @@ -513,6 +534,9 @@ jobs:
permissions:
contents: read
attestations: read
# Launch the signed app on macOS 26, where most users run it, rather than on
# the macOS 27 it was built on. The job builds nothing, so it uses the image's
# default Xcode: the pinned 27.1 exists only on xcode-27.
runs-on: macos-26
timeout-minutes: 30
strategy:
Expand All @@ -535,9 +559,6 @@ jobs:
- name: Verify pinned Nix runtime
working-directory: .
run: bash scripts/ci/verify-nix-runtime.sh
- name: Select pinned Xcode
working-directory: .
run: python3 scripts/ci/select-xcode.py
- name: Download exact Agent packages
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with:
Expand Down
Loading
Loading