Skip to content

chore(ci): rehearse the move of bazel-test-all to Namespace RBE in the evaluation job - #12032

Merged
basvandijk merged 9 commits into
masterfrom
bas/ci-bazel-test-all-namespace-prep
Nov 6, 2026
Merged

basvandijk merged 9 commits into
masterfrom
bas/ci-bazel-test-all-namespace-prep

Conversation

@basvandijk

@basvandijk basvandijk commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Why

bazel-test-all (ci-main.yml, dind-large) is to be replaced by the implementation of bazel-test-all-rbe
(ci-rbe-evaluation.yml: Namespace runner + Bazel Remote Execution, _local system-tests), as the first
step of moving CI off the self-hosted dind runners. Three things the required job does are not yet done
by the evaluation job and can only be validated by running them, so this PR makes the still non-blocking
evaluation job rehearse them on every master push before the switch:

  • the execlogs-bazel-build execution log that build-determinism compares with build-ic's;
  • the Upload artifacts step (bazel run --check_up_to_date //:upload-artifacts) on a Namespace runner,
    under Build-without-the-Bytes and through the Namespace bazel wrapper, including AWS OIDC role
    assumption from a Namespace container job;
  • the _local variants of the system-tests listed in PULL_REQUEST_BAZEL_TARGETS, which the evaluation
    job silently drops today (it excludes farm_system_test after the explicit targets are added).

The required jobs keep their behaviour; only the mechanics of the artifact upload change (see below).

What

  • .github/actions/upload-execlogs (new): the execlog2csv install/convert/upload steps of
    .github/actions/bazel, as a composite that both bazel actions call, so the execlog2csv pins and the
    list of known non-reproducible targets live in one place.
  • .github/actions/bazel-namespace: new execlogs-artifact-name input (the wrapper writes
    --execution_log_compact_file for build and test when it is set); the wrapper no longer writes a BEP
    file/profile for bazel run (a BEP records the client environment, and the artifact upload is a
    bazel run); the OIDC token request variables are unset before run, as in the dind action.
  • .github/actions/upload-artifacts: runner-agnostic (bazel-action: bazel | bazel-namespace) and
    credentials only where rclone runs. The uploader is built with bazel run --script_path (new
    build-uploader.sh; under Build-without-the-Bytes bazel run --check_up_to_date downloads the target's
    outputs and runfiles by the digests the build step recorded, and on Namespace it runs with
    --experimental_remote_cache_eviction_retries=0, so a lost blob fails on that output instead of a retry
    that re-resolves everything through fresh remote cache lookups) and run by
    a separate step, the only one whose environment holds the AWS/Cloudflare credentials, now passed as
    inputs instead of step env. Neither the BEP files nor Namespace's Build Event Service (to which
    nsc bazel setup streams every bazel command's events, client environment included) see them anymore.
    This relies on rules_python 2.4.6 (chore(deps): upgrade rules_python from 1.9.0 to 2.4.6 #12041): with 1.9.0, every <name>.build_data.txt had constant
    metadata, which bazel can only validate on disk, so under Build-without-the-Bytes every later command
    re-ran those PyWriteBuildData actions (21 in a Namespace test step; two are tools in the upload closure,
    which would have failed --check_up_to_date).
    ci/src/artifacts/upload.bzl: the generated run script gets its shebang on the first line, which the
    exec of the --script_path script needs (bazel run hid this by running it through bash).
  • ci-main.yml: the two upload call sites use the new inputs (bazel-test-all also passes its
    build step's options to bazel run); build-determinism prints how many artifacts the comparison covers
    and warns outside PRs when the cache side misses more than half of build-ic's artifacts (a build that
    bazel retried after a remote-cache eviction has a partial execution log).
  • ci-rbe-evaluation.yml: uploads execlogs-bazel-build-rbe; on release builds (master pushes) runs
    Configure AWS credentials (role assumption only: output-credentials: false, the session never leaves
    that step) and a DRY_RUN=1 artifact upload with placeholder credentials and --check_up_to_date
    through the Namespace wrapper (environment: upload-artifacts, id-token: write; both steps
    continue-on-error).
  • ci-kickoff.yml: the evaluation also runs on dfinity/ic-private PRs, since the Namespace GitHub App
    was given access to that repository today (so that bazel-test-all needs no repository gate after the
    switch; note that ic-private PR code, undisclosed hotfixes included, then builds on Namespace and shares
    the workspace's RBE cache with public builds, like it shares DFINITY's cache today); temporary
    rbe-build-determinism shadow job comparing execlogs-bazel-build-rbe with execlogs-build-ic
    (fails on mismatches like ci-main's job; not a required check, so it doesn't block merging; a missing
    execution log is not a mismatch).
  • PULL_REQUEST_BAZEL_TARGETS: lists the _local variant next to every _farm/_farm_colocate
    entry (24 lines; the dind job drops the former, the evaluation job the latter, so this changes nothing
    for CI Main and makes the evaluation job run on PRs exactly the tests that become blocking). The two
    nested *_upgrade_from_latest_release_to_current_local entries are runnable since test: support local runs of //rs/tests/nested:{guestos,hostos}_upgrade_from_latest_release_to_current #12029.
  • ci/scripts/targets.py: check honours --exclude_tags like test does (CI doesn't pass it yet;
    the switch will pass --exclude_tags=farm_system_test, which then rejects _farm* entries) and its
    hint no longer suggests _colocate.

Not in this PR

The switch itself (rewriting bazel-test-all, deleting the evaluation workflow and the shadow job,
_local-only PULL_REQUEST_BAZEL_TARGETS, githubstats job names) follows after a soak of the rehearsal:
shadow determinism No mismatches with ~34k joined rows, green dry-run uploads with
--check_up_to_date, green OIDC step, _local flakiness not worse than dind.

Testing

  • build-uploader.sh + the generated script, locally with --config=local and //:artifact-uploader:
    --check_up_to_date after a build reports 0 total actions, the dry run
    prints VERSION: 0000… and one well-formed <sha256> ic/<version>/… manifest line per file. This dry
    run is what found the shebang problem in upload.bzl (the uploader died under /bin/sh with
    set: Illegal option -o pipefail).
  • ci/scripts/targets.py check passes with the dual listing (all 48 system-test labels are non-manual);
    check --exclude_tags=farm_system_test fails on exactly the 24 _farm* lines with the new hint.
  • bazel run //pre-commit:ruff-check, //pre-commit:shfmt-check, //:buildifier; all changed YAML parses.
  • The Namespace upload path (bazel run --check_up_to_date without eviction retries) follows from reading
    the Bazel 9.2.0 sources and the profiles of a Namespace job, reviewed
    adversarially; build-uploader.sh was exercised with a stub bazel for every exit code. It first runs for
    real in the rehearsal on the first master push after merge.
  • This PR touches .github/*, so its own CI builds and tests //... on both jobs; the evaluation job
    shows the execlogs-bazel-build-rbe artifact and the shadow job's comparison. The upload/OIDC
    rehearsal and the dind upload mechanics only run on release builds: first master push after merge.

First rehearsal result (this PR's run 42102800890)

Both bazel-test-all jobs of this run built //... for the same commit, so their execution logs can be
compared directly: 396 of 62,164 shared artifacts differ between dind and RBE (the RBE log is complete:
62,169 rows, all with digests). Against build-ic, the shadow job finds 76 mismatches in 34,266 artifacts,
all downstream of jemalloc, while the dind Build Determinism is clean.

Root cause of the release-relevant part: jemalloc's configure reads the CPU's virtual-address width.
@@+http_archive+jemalloc (third_party/BUILD.jemalloc.bazel) runs jemalloc 5.3.0's configure on the
machine that executes the action. On x86-64 it takes LG_VADDR from CPUID leaf 0x80000008, which sizes
jemalloc's radix tree, so the compiled code of libjemalloc.a changes with it. Reproduced locally: the
unmodified build gives the dind digest (3c2559eb…), the same build with --with-lg-vaddr=57 gives the RBE
digest (b8f113b5…) exactly, so the Namespace workers report 57 bits where the dind machines report 48. The
tikv-jemalloc-sys rlib only bundles that archive (JEMALLOC_OVERRIDE; its build.rs returns before it
reads JEMALLOC_SYS_WITH_LG_*), and the replica, pocket-ic-server, ic-boundary, ic-gateway, the
GuestOS/SetupOS images and the publish bundles inherit it. Fixed by #12033, which pins
--with-lg-vaddr=48 --with-lg-page=12 --with-lg-hugepage=21. That build gives the dind digest again, so
the shipped binaries did not change.

The other leaves are outside build-ic's closure (no shipped artifact contains them) and do not block the
switch: OpenSSL's libcrypto.a (build date and sandbox path), the libsqlite3-sys build-script
environment (absolute path compiled into the build script) and the Go SDK builder (records
CGO_ENABLED).

With #12033 merged into this branch, the shadow job compares the same 34,266 artifacts with no
mismatches
(run of 27fb17f), so it now fails on mismatches like ci-main's Build Determinism.

🤖 Generated with Claude Code

…e evaluation job

Before bazel-test-all (ci-main.yml, dind-large) is replaced by the implementation
of bazel-test-all-rbe (ci-rbe-evaluation.yml: Namespace runner + Remote Build
Execution, _local system-tests), make the still non-blocking evaluation job
rehearse what the required job does and the evaluation doesn't yet:

* the execution log for build-determinism: a shared execlog2csv composite
  (.github/actions/upload-execlogs) used by both bazel actions; the Namespace
  wrapper writes --execution_log_compact_file when asked;
* the artifact upload: .github/actions/upload-artifacts becomes runner-agnostic
  and builds the uploader with `bazel run --script_path`, so that only the step
  that runs it holds the AWS/Cloudflare credentials (neither the BEP files nor
  Namespace's Build Event Service see them); the evaluation job dry-runs it with
  --check_up_to_date under Build-without-the-Bytes, after assuming the AWS role
  from a Namespace container job (release builds only);
* the _local variants of the system-tests in PULL_REQUEST_BAZEL_TARGETS, listed
  next to the _farm ones for the time being; `targets.py check` honours
  --exclude_tags so the switch can reject the _farm entries.

Also: a temporary shadow build-determinism job in ci-kickoff.yml for the RBE
build, the evaluation runs on dfinity/ic-private PRs too (Namespace was enabled
there), the generated uploader script gets its shebang on the first line (the
--script_path exec needs it), and build-determinism reports how many artifacts
its comparison covers.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unrestricted artifact materialization can regenerate outputs without proving they match the main build, while early returns bypass missing-coverage warnings on non-PR runs.

2 open issues
What changed in this PR

This PR prepares the move from self-hosted Bazel CI to Namespace Remote Execution by extending the non-blocking evaluation workflow. The required-job switch remains deferred until the rehearsal has been validated.

Changes:

  • Adds shared execution-log uploads and a shadow determinism comparison for RBE builds.
  • Separates uploader preparation from credential-bearing execution and rehearses uploads and AWS role assumption on Namespace.
  • Adds local system-test targets, exclusion-aware validation, and evaluation coverage for private-repository PRs.
File Description
PULL_REQUEST_BAZEL_TARGETS Lists local variants alongside Farm system tests.
ci/​src/​artifacts/​upload.bzl Places the generated uploader’s shebang first for direct execution.
ci/​scripts/​targets.py Applies tag exclusions during target validation.
.github/​workflows/​ci-rbe-evaluation.yml Adds execution logs, AWS authentication rehearsal, and dry-run uploads.
.github/​workflows/​ci-main.yml Adopts uploader inputs and reports determinism comparison coverage.
.github/​workflows/​ci-kickoff.yml Enables private PR evaluation and adds the shadow comparison.
.github/​actions/​upload-execlogs/​action.yaml Centralizes execution-log conversion and upload.
.github/​actions/​upload-artifacts/​build-uploader.sh Prepares an uploader script, optionally materializing remote outputs.
.github/​actions/​upload-artifacts/​action.yaml Supports both runners and isolates upload credentials.
.github/​actions/​bazel/​action.yaml Delegates execution-log handling to the shared action.
.github/​actions/​bazel-namespace/​bin/​bazel Adds optional execution logs and excludes run from file instrumentation.
.github/​actions/​bazel-namespace/​action.yaml Exposes execution-log uploads and unsets OIDC request credentials before commands.

Review effort: Balanced

Comment thread .github/workflows/ci-kickoff.yml Resolved
…r, warn on empty execution logs

Review comments of #12032:

* build-uploader.sh: before downloading the outputs and runfiles of the
  uploader target (--remote_download_toplevel, which under
  Build-without-the-Bytes re-runs their actions against the remote cache),
  first `bazel build --check_up_to_date` in the default download mode, which
  downloads nothing and so proves that the job's build step built the whole
  closure; then require the materializing build to consist of cache hits only,
  failing the step when its process summary shows an executed action, i.e. an
  output regenerated after a remote-cache eviction that may differ from what
  the build step built.
* build-determinism (ci-main.yml) and the shadow job (ci-kickoff.yml): the
  missing-coverage warning also fires on the early-return path, so an empty
  cache-side execution log on a non-PR run is no longer silent.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The release-only publishing and credential-boundary changes require maintainer validation on protected-branch runs because PR CI cannot verify real uploads, Namespace OIDC/CAS materialization, or the external controls governing shared-cache access.

1 open issue
1 resolved since last review

Review effort: Balanced

With integer division a nocache log of one line gave a threshold of 0, so an
empty cache log would not have warned. Round up instead.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Release-upload changes have only local dry-run validation, leaving uploader, attestation, and Namespace OIDC/BwoB behavior requiring protected-branch runtime confirmation and human review.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

… job

The job is informational: until bazel-test-all moves to RBE it shows on
every run whether the artifacts built on Namespace equal the ones built
from scratch on DFINITY's runners, and they currently don't (jemalloc's
configure probes the machine; fixed separately). A failing check on every
PR would only confuse, so the job now lists the mismatches in its job
summary and raises a warning annotation.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The supplied PR run does not exercise release-only uploads or Namespace OIDC/materialization paths, so human validation of a stamped release run is needed to confirm publishing behavior and credential isolation.

No open issues 🎉

Review effort: Balanced

basvandijk added a commit that referenced this pull request Nov 6, 2026
…12033)

jemalloc's `configure` reads three values from the machine that runs the
build and compiles them into
`libjemalloc.a` (`@jemalloc//:jemalloc_private` in
`third_party/BUILD.jemalloc.bazel`):

- `LG_VADDR`, the number of significant virtual address bits, from CPUID
leaf 0x80000008: 48 on CPUs without
5-level paging, 57 on CPUs with it (e.g. AMD EPYC Genoa, Intel Xeon
since Ice Lake-SP). It sizes jemalloc's
radix tree (`include/jemalloc/internal/rtree.h`: height 2 for 48 bits, 3
for 57), so the compiled code differs.
- `LG_PAGE` from `sysconf(_SC_PAGESIZE)` and `LG_HUGEPAGE` from
`Hugepagesize` in `/proc/meminfo`.

tikv-jemalloc-sys bundles this archive into its rlib
(`JEMALLOC_OVERRIDE` in `bazel/rust.MODULE.bazel`), so
the replica, `ic-boundary`, `pocket-ic-server`, `ic-gateway`, the
GuestOS/SetupOS images and the publish
bundles depend on the CPU of the machine that ran jemalloc's configure.

This PR pins the three values to the ones the released artifacts were
built with: `--with-lg-vaddr=48
--with-lg-page=12 --with-lg-hugepage=21`. After it, every machine builds
the same archive.

## How it was found and verified

The Namespace RBE rehearsal in #12032 builds the same commit as the dind
runners. Its shadow
build-determinism job finds 76 differing artifacts among the 34,266 that
build-ic builds, all downstream of
`libjemalloc.a`. Rebuilding the archive in the dev container
(`--config=local`) with different configure
options reproduces both sides byte for byte:

| `configure_options` | `libjemalloc.a` | `libjemalloc_pic.a` | Same as
|
| --- | --- | --- | --- |
| master | `3c2559eb…` | `d9e57b63…` | dind build of run 42102800890 |
| master + `--with-lg-vaddr=57` | `b8f113b5…` | `8590f912…` | Namespace
RBE build of the same run |
| this PR | `3c2559eb…` | `d9e57b63…` | dind build |

So the Namespace workers' CPUs report 57 bits where the dind machines
report 48, and nothing else differs.
With this PR the archive is byte-identical to today's, so the released
binaries do not change. (The `hunt`
script of the fix-build-determinism skill cannot show this kind of bug:
both of its builds run on the same
CPU.)

## Why it matters

- **Moving CI to Namespace:** `bazel-test-all` builds and uploads the
release artifacts. On Namespace RBE it
would change the replica and the IC-OS images, turn `build-determinism`
red, and make a hotfix re-upload
  (`rclone --immutable`) fail. This PR removes that blocker.
- **repro-check today:** `ci/scripts/repro-check` rebuilds the IC-OS
images with `./ci/container/build-ic.sh`,
i.e. `--config=local`. A verifier whose CPU reports 57 virtual address
bits therefore builds a different
replica than the one on the CDN and cannot reproduce the release. With
the pins it builds the CDN's bytes.

## Safety

`LG_VADDR=48` is what production runs today. It stays correct on
machines with 5-level paging: Linux maps
user memory above 47 bits only when `mmap` gets a hint address above
them
([kernel
docs](https://docs.kernel.org/arch/x86/x86_64/5level-paging.html)), and
jemalloc's hints only
extend its own mappings. 4 KiB pages and 2 MiB (transparent) huge pages
are the x86-64 sizes, and this archive
is only used for `x86_64-unknown-linux-gnu`. jemalloc documents all
three options in

[INSTALL.md](https://github.com/jemalloc/jemalloc/blob/5.3.0/INSTALL.md),
so no patch is needed.

Setting `JEMALLOC_SYS_WITH_LG_*` on the tikv-jemalloc-sys crate would
not help: with `JEMALLOC_OVERRIDE` set,
its `build.rs` returns before it reads them.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
@basvandijk
basvandijk marked this pull request as ready for review November 6, 2026 10:37
@basvandijk
basvandijk requested a review from a team as a code owner November 6, 2026 10:37
@github-actions github-actions Bot added the @infra label Nov 6, 2026
Picks up #12033 (the jemalloc pin), so that the shadow RBE build-determinism job can confirm the fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The changed artifact-upload paths in required jobs still need protected-branch validation of release uploads and attestations, Namespace OIDC, and BwoB materialization, which local checks and PR CI do not exercise.

No open issues 🎉

Review effort: Balanced

With #12033 (the jemalloc pin) merged in, the shadow job compares the
34,266 artifacts it shares with build-ic without mismatches. Make it fail
on mismatches like ci-main's Build Determinism job instead of only
warning, so that a regression shows up as a red run during the soak.

A missing execution log is not a mismatch and still passes: the RBE
evaluation may fail before its build step uploads one (with a warning),
and without build-ic's log ci-main's job doesn't compare either.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed because the upload check can miss execution in earlier retry attempts, allowing regenerated artifacts despite the exact-artifact guarantee.

No open issues 🎉

Review effort: Balanced

… a materialization build

Copilot's review found that the materialization guard of build-uploader.sh
reads only the last process-summary line, while rbe.bazelrc lets bazel
retry the command up to 10 times after a lost blob. Reading the Bazel
9.2.0 sources showed the materialization build itself was the weak spot:
before a retry bazel drops the recorded metadata of all remote outputs
and re-resolves them through fresh remote cache lookups, which the
summary shows as remote cache hits, and even a single attempt re-runs
any re-evaluated action that way.

The separate build isn't needed: under Skymeld, bazel run downloads the
outputs and runfiles of the uploader by the digests that the build step
recorded, hash-checked, and with --check_up_to_date any action that
would have to run fails the command. So on Namespace build-uploader.sh
now only runs bazel run --check_up_to_date, without eviction retries,
so that a lost blob fails on that output. bazel's exit code is passed
through, with a message that tells a stale action (a rerun fails again)
from a lost output (rerun the job).

What would have failed that check: rules_python 1.9.0 declares every
<name>.build_data.txt with constant metadata, which bazel can only
validate on disk, so under Build-without-the-Bytes every later command
re-runs those PyWriteBuildData actions (21 in a Namespace test step,
two of them tools in the upload closure). rbe.bazelrc now downloads
these small files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The refactored release uploader and Namespace OIDC/BwoB rehearsal run only after merge, so maintainers must validate the first protected-branch release to confirm credential isolation and exact-artifact uploads.

No open issues 🎉

Review effort: Balanced

basvandijk added a commit that referenced this pull request Nov 6, 2026
Upgrades `rules_python` from 1.9.0 to 2.4.6, its latest release
(2.5.0-rc0 is a release candidate). The
`bazel_dep` version in `MODULE.bazel` is the only edit: what the repo
uses (`python.toolchain`, `pip.parse`,
`@rules_python//python:defs.bzl` and `:pip.bzl`,
`py_console_script_binary`, the `@python_deps` labels
`requirement()`, `:pkg` and `:whl`, and the `bootstrap_impl` setting)
still works unchanged. In the module graph
only `package_metadata` moves from 0.0.6 to 0.0.7 and `toml.bzl` 0.4.1
is added; `protobuf`, `rules_cc`,
`bazel_skylib` and `platforms` stay where they are.

The released IC-OS images don't change. Built unstamped with 1.9.0 and
with 2.4.6 in the same output base, these are
byte-identical: the GuestOS disk and update images and its
`launch-measurements.json`, the HostOS disk and update
images, and the SetupOS disk image. Python only runs as a build tool
there: the `//toolchains/sysimage` tools,
rules_pkg's `build_tar`, sev-snp-measure and rules_foreign_cc's meson.

## Behaviour changes (no repo edit needed)

* **Interpreter:** `python_version = "3.12"` now resolves to CPython
3.12.16 (python-build-standalone 20261026)
instead of 3.12.12. The interpreter links libpython statically, so the
100+ MB `libpython3.12.so` is no longer part
  of every Python tool's runfiles.
* **Every `py_binary`/`py_test` starts through a venv** (2.0.0,
bazel-contrib/rules_python#3473). Its runfiles get
`_<name>.venv/pyvenv.cfg` and an unresolved `bin/python3` symlink, and
`sys.executable` is that venv's python.
Namespace RBE has to accept the symlink as an action input, which this
PR's CI exercises. If it doesn't, the fallback
is
`--@rules_python//python/config_settings:venvs_use_declare_symlink=no`
in
  `.github/actions/bazel-namespace/rbe.bazelrc`.
* **`pip.parse` uses the Bazel downloader** (2.0.0,
bazel-contrib/rules_python#3691). Evaluating the `pip` extension
fetches the PyPI simple-API page of every pinned package (about 80,
including rules_python's own publish deps). We
run with `--lockfile_mode=off`, so every new Bazel server does that
again, and a PyPI outage now fails loading
`@python_deps` (IC-OS builds, `//...`), not just fetching uncached
wheels. Bazel then downloads the wheels with their
pinned hashes and unpacks them itself. The native ones (cryptography,
bcrypt, pynacl, used by the bare-metal dev tools
and by sev-snp-measure's id-block path) switch from their manylinux_2_34
to their manylinux2014 builds, independent
  of the build host's glibc.
* **`compile_pip_requirements`** runs pip 26.2.2 and pip-tools 7.6.2;
`//:python-requirements.test` passes as is.
* **Build data:** none of our targets is stamped in rules_python's sense
(`--config=stamped` only stamps through
`workspace_status.sh`, it doesn't pass Bazel's `--stamp`). For such
targets `<name>.build_data.txt` is now written
with `ctx.actions.write` (bazel-contrib/rules_python#4160), so
Build-without-the-Bytes no longer re-runs those actions
in every command. That makes the `build_data.txt` download that #12032
adds to `rbe.bazelrc` unnecessary; whichever
  of the two PRs lands second removes it.
* **Deprecation warning** (2.2.0): analysis prints a warning about
implicit `__init__.py` creation for every Python
binary and test, including external tools (rules_pkg's `build_tar`,
rules_foreign_cc's meson). Opting in to explicit
  `__init__.py` files is left for a follow-up.
* The runtime's `__pycache__` directories are now symlinks into
`/tmp/rules_python_pycache`
(bazel-contrib/rules_python#3661); 2.5.0 moves them to a per-user cache
(bazel-contrib/rules_python#4233). The risk
  is low in CI and in the dev container, whose `/tmp` is private.

## Testing (dev container)

* `bazel build //... --nobuild`; buildifier.
* All 26 `py_*` targets build. The 5 non-manual `py_test`s pass
(including `//:python-requirements.test`), and so do
`//ci/githubstats:query_help_test` and
`//rs/recovery/subnet_splitting:integration_test`, which launch our
Python
  binaries.
* `//:mke2fs`, `//:fuse2fs` and `//:debugfs` (e2fsprogs, built with
libfuse through rules_foreign_cc's Python-based
  meson).
* The IC-OS images above, byte-identical with 1.9.0 and 2.4.6.
* This PR's CI builds and tests `//...` on the dind runners and on
Namespace RBE.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
basvandijk and others added 2 commits November 6, 2026 16:19
Picks up #12041 (rules_python 2.4.6), which makes the build_data.txt download in rbe.bazelrc unnecessary.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
rules_python 2.4.6 (#12041) writes the build data of unstamped targets,
which all of ours are, with ctx.actions.write. Those files are ordinary
local outputs now, so Build-without-the-Bytes no longer re-runs their
actions in every later command, and downloading them is unnecessary.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The changed release-critical upload path and untested Namespace OIDC/BwoB behavior require protected-branch runtime validation and human review.

No open issues 🎉

Review effort: Balanced

@basvandijk
basvandijk merged commit c38012d into master Nov 6, 2026
43 checks passed
@basvandijk
basvandijk deleted the bas/ci-bazel-test-all-namespace-prep branch November 6, 2026 18:22
basvandijk added a commit that referenced this pull request Nov 7, 2026
… job (#12044)

The RBE evaluation job (`bazel-test-all-rbe` in `ci-rbe-evaluation.yml`)
recovers from lost inputs only by rerunning the whole Bazel command
(`--experimental_remote_cache_eviction_retries=10` in `rbe.bazelrc`).
This PR tries `--rewind_lost_inputs` instead, in that non-blocking job,
before `bazel-test-all` moves to Namespace.

## Why

On the first master run after #12032 (run 42270043453), 13 tests failed
5-16 s into the test step with `Lost inputs no longer available
remotely`. Bazel recovered, but slowly:
- The first attempt still ran all the other tests to the end
(`--keep_going`), which took 40 min.
- Then Bazel dropped what it knew about every remote output and reran
the whole command. That reran time-dependent genrules (the `mkfs.fat`
UVM config images), which changed the inputs of 202 system tests that
had already passed, so they ran again.
- The step took 83 min against its 120-min limit. Once `bazel-test-all`
runs on Namespace as a required job, one such event on a busy afternoon
would time it out.

With action rewinding, an action that lost inputs makes Bazel rerun only
the actions that produced them, and then the action itself, within the
same command. Bazel 9.2.0 supports this with Build without the Bytes.

## Changes

- **`rbe.bazelrc`:** adds `build --rewind_lost_inputs`.
- The eviction retries stay. With rewinding they only rerun the command
when downloading the inputs of a local action fails for another reason
than lost inputs.
- "Exec failed due to IOException: Missing digest" is neither rewound
nor retried, before and after this PR.
- Also corrects the comment on lease extension. It runs only while a
command runs: when its first action finishes, then every
`--experimental_remote_cache_ttl` (3 h by default). Nothing extends
leases between commands.
- **`bazel-namespace` action:** Bazel prints nothing when it rewinds,
but its profile records each rewind plan. A new step reports them:
- as a warning annotation, for example "Action rewinding: Bazel rewound
actions to regenerate lost files: 2 rewind plans in
profile-test-....json, for 3 lost inputs of action 'Testing //...'; 1
lost outputs of //...". A rewind plan is an attempt, not proof of
recovery.
- as an error annotation when Bazel gave up: "lost input too many times"
(lost inputs) or "rewinding was ineffective" (lost top-level outputs) in
the log.
- **`bazel-namespace/bin/bazel`:** passes `--noslim_profile` with
`--profile`.
- Once a profile has 10,000 events, profile slimming (on by default)
merges events shorter than 250 ms with their neighbors, rewind plans
included. A rewind like the one of 2026-11-06, a few seconds into a
large test command, would most likely be merged away, and the soak
couldn't tell "rewinding worked" from "nothing was lost".
- Cost: bigger profiles in the `-bep` artifacts that github-stats
ingests. By the `Nx` counts of their merged events, the build profile of
master run 42270043453 grows from 11.7 MB to about 99 MB and its test
profile from 11 MB to about 60 MB. A PR test profile grows from 2.6 to
about 4 MB.
- The count stays a lower bound in one case: a rerun of the whole
command overwrites the profile of the earlier attempt.
- **`build-uploader.sh`:** adds `--norewind_lost_inputs` next to
`--experimental_remote_cache_eviction_retries=0` for the `bazel run` of
the artifact upload on Namespace.
- A rewound action can't run under `--check_up_to_date`, so the upload
would fail either way, but with a misleading `... is not up-to-date`.
- This keeps the `Unexpected lost outputs` failure that the step's error
message explains.
  - Nothing changes on dind, where rewinding is off by default.

## The risk this trial checks

With rewinding on, lost inputs no longer fall back to rerunning the
command. Only that fallback marks the lost digests as known to be
missing (`ActionRewindStrategy.checkRewindingEnabled` in 9.2.0).

So if a blob is really gone but Namespace's action cache keeps returning
the result that references it, the rewound producer gets the same cache
hit. The action then fails after 20 rounds ("lost input too many
times"), which is worse than today.

On 2026-11-06 the lost blobs were reported present again within about a
second, a case that rewinding handles. We'll ask Namespace whether their
action cache checks that the blobs of a result exist.

## How to evaluate it

During the soak, look at the evaluation job's runs:
- count the "Action rewinding" warning annotations;
- check that runs with rewinds finish in normal time;
- watch for the "Action rewinding" error annotation, i.e. Bazel giving
up.

To revert, drop the `--rewind_lost_inputs` line, and the
`--noslim_profile` line if the bigger profiles are a problem.

## Testing

- **Report step:** I extracted it from `action.yaml` and ran it with
`bash --noprofile --norc -e -o pipefail`, the way GitHub runs `shell:
bash`:
- a directory with a real 2.6 MB test profile without rewinds, then a
synthetic profile with 4 rewind plans, then the real one again: one
warning listing the first 3 plans, exit 0;
- a `console.log` with a "lost input too many times" failure: one error
annotation, exit 0;
  - no profiles and no `console.log`: no output, exit 0.

The first version of the step stopped at the first profile without
rewinds (Copilot's review); this PR's first CI run showed that as an
error annotation from the step. shellcheck passes for the step and for
`build-uploader.sh`.
- **Flags:** `bazel help run` and `bazel help test` (Bazel 9.2.0, in the
dev container) list `--[no]rewind_lost_inputs`.
- **This PR's CI:** its run exercises the build and test steps with
rewinding on. The dry-run upload, and with it `--norewind_lost_inputs`,
only runs on master.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
robin-liquidium pushed a commit to robin-liquidium/ic that referenced this pull request Nov 14, 2026
…finity#12052)

Moves CI Main's `bazel-test-all` (**CI Main / Bazel Test All**) from the
self-hosted dind-large runners to Bazel Remote Execution (RBE) @
Namespace. The new job is the one that `ci-rbe-evaluation.yml` has run,
non-blocking, on every same-repo PR, merge-queue run and master push,
rehearsed since dfinity#12032. On release builds it now does the real artifact
upload and Attest instead of the dry run.

**Before merging:** create the Namespace runner profile
`rbe-driver-amd64-linux-16x32-no-cache`: a copy of
`rbe-driver-amd64-linux-16x32` without the cache volume (see Security).
Also see the sign-offs listed there.

## What changes

- **`bazel-test-all` (ci-main.yml):** the evaluation job's body, with
the same id, name, `needs` and `environment` as before.
- It runs on `namespace-profile-rbe-driver-amd64-linux-16x32` in the
`nscr.io` mirror of `ic-build`, the same image as the RBE workers.
container-autobuild rewrites both pins.
- Build step: uploads `execlogs-bazel-build`, which `build-determinism`
compares with `build-ic`, now RBE against dind.
- Release builds: Configure AWS credentials, then Upload artifacts
through the Namespace bazel wrapper (credentials only in the uploader's
step, `--check_up_to_date`), then Attest. Then the test step.
- **Fork PRs:** `ci-main.yml` gets an `untrusted-code` input, which only
`ci-kickoff-manual.yml` sets. With it, `bazel-test-all` runs on the
`-no-cache` profile, see Security.
- **System-tests:** CI Main runs only the `_local` variants, on every
event (`--exclude_tags=farm_system_test`). `PULL_REQUEST_BAZEL_TARGETS`
lists only `_local` variants, and `check-pull-request-bazel-targets`
passes the same exclusion, so a re-added `_farm*` entry fails the check.
- Of the Farm variants, only those of `system_test_large` tests
(release-testing) and of the tests the nightly workflows select keep
running.
- The roughly 210 other `_farm`/`_farm_colocate` targets that CI Main
ran until now run nowhere. This is the accepted decision to drop Farm
from CI Main; `.github/CI_README.md` now says so.
- Tests tagged `system_test_large`, which include the `_head_nns`
variants of most system-tests, stay excluded from CI Main. Their
`_local` variants (16 tests at 81b768b) ran only in the nightly
`local-system-tests.yml`, which this PR deletes. Now only their Farm
variants run, in release-testing.
- **Removed:** `ci-rbe-evaluation.yml`, and from `ci-kickoff.yml` its
job and the shadow `rbe-build-determinism` job. Also the nightly
`local-system-tests.yml`, which ran all `_local` system-tests on one
dind runner in about 5.5 hours.
- **githubstats:** the tests of this job are
`bazel-test-all-bazel-test-<attempt>`, whose logs come from the
`<job>-logs` artifact. The evaluation's
`bazel-test-all-rbe-bazel-test-<n>` stays recognized for older rows.
- **Docs and comments:** `rbe.bazelrc`, `.github/CI_README.md` (new
"Where the tests run"), the fix-flaky-tests skill,
`rs/tests/README_NEW.md`, the githubstats help, and the arm64 job's
ic-private gate.

### Two additions for reliability

The job becomes required on PRs, the merge queue, master and the daily
rc branches. Over the 14 days 2026-10-26..11-09 (first attempts), the
evaluation job failed where dind passed:

| | RBE-only failures | dind-only failures | Job time, median (min): RBE
vs dind |
| --- | --- | --- | --- |
| Master pushes | 10 / 92 | 3 / 92 | 52* vs 80 |
| Merge queue | 2 / 108 | 0 / 108 | 9 vs 14 |
| PRs | 3 / ~280 | 0 | 15 vs 24 |

\* Without the real upload: the evaluation only did a dry run of about
30 s. With the upload (about 27 min), master runs will take about as
long as on dind. Build plus test alone take 48 min on RBE against 52 on
dind.

The 10 master failures had these causes:
- **6 runs on Nov 3 hit the 120-minute test timeout:**
- 3 (14:27-14:52Z) lost inputs, and bazel's whole-command retry then ran
out of time. dfinity#12044's action rewinding targets this case, but it hasn't
been exercised yet, because no inputs were lost since it landed.
- 3 (15:58-16:01Z) were still in their first attempt at 120 minutes on a
saturated cluster: 2 lost no inputs at all, 1 lost inputs but didn't get
to retry. A master run's test step that afternoon passed after 118
minutes.
- **4 runs (Oct 26 and 29):** bazel exited with 34 after Namespace
infrastructure errors ("Remote Execution Failure", "UNAVAILABLE:
connection error"), which bazel doesn't retry. Three were in the test
step, one in the build step.

So this PR adds:
1. **One rerun on exit code 34:** the build and test commands run once
more when bazel exits with 34
(`.github/actions/bazel-namespace/rerun-on-remote-error.sh`).
- The rerun waits a minute first, reuses what the first attempt built
and the tests that passed, and is announced by a warning annotation.
- It is skipped when the first attempt reported a test that FAILED or
hit its TIMEOUT, because exit 34 outranks test failures and a rerun
could turn a real failure green.
- It is also skipped when less than 15 minutes of the step's timeout are
left.
2. **Timeouts:** test step 190 min (bazel 180), job 415. The steps'
timeouts sum to 405, and Namespace's enterprise plan allows 24-hour
instances.
- A test step of a master run usually takes 25-40 min. On a saturated
cluster a single attempt took up to about 120, so 180 leaves room for a
rerun of what such an attempt didn't complete.
- Capacity itself is unchanged: each job claims the cluster with
`--jobs=480`.

## Security

- **Fork PRs:** reviewed PRs from forks (`ci-kickoff-manual.yml`) now
run this job on Namespace. They run as `workflow_dispatch` runs on
master, and the `rbe-driver` profile's cache volume is committed by runs
on master. Master and rc release builds start from that volume: the
Bazel repository cache, the container image cache and the tool caches.
So untrusted code in that privileged container could write that volume.
- With `untrusted-code`, these runs use the `-no-cache` profile, which
has "Cache Volumes" disabled. Until that profile exists, their `Bazel
Test All` waits for a runner, which fails safe.
- The profile keeps "Bazel Caching", which RBE needs. So these runs
still share Namespace's Bazel cache (CAS, action cache) with internal
PRs, master and release builds, and can write it, as the dind job does
today with the DFINITY cache (`--remote_upload_local_results`). The
evaluation never ran for fork PRs.
- We're asking Namespace for separate Bazel caches for fork PRs,
internal PRs and master/release builds, enforced on their side (their
issue NSL-8566). Branch rules alone wouldn't separate fork-PR runs,
which run on master, so a per-profile setting would suit us.
- **ic-private:** hotfix code from ic-private is now built on RBE. It
shares the workspace's CAS/action cache and Namespace's Build Event
Service with public builds, as dfinity/ic-private#139 showed (902 of
1,315 actions were cache hits). Hotfix release builds upload from
Namespace with ic-private's AWS role; Attest stays skipped there.
- **Open sign-offs from the plan:**
  - the security OK for the two points above;
- infra's confirmation that the upload role and the S3/R2 bucket
policies have no source-IP or runner conditions. The first real upload
from Namespace will show it.

## Not exercised before the merge

- **The real upload to S3/R2 from Namespace:** so far only dry runs. The
first master push after the merge is the first real one, and the next
morning's rc branch (cut at about 03:20Z) is the first rc. If the upload
fails, merging isn't affected, but that commit's artifacts are missing
until a rerun.
- **The ~27-minute upload between build and test:** Bazel extends leases
only during a command, so on master and rc runs the test step may see
more lost inputs than the evaluation did with its 30-second dry run.
- Rewinding recovers them if Namespace's action cache never returns
results whose blobs are gone. That still has to be confirmed with
Namespace. If it does return such results, the test fails with "lost
input too many times" (exit 1), which the rerun doesn't cover.
- Each bazel command that rewound gets one "Action rewinding" warning,
with the count.
- **Fork-PR runs on the `-no-cache` profile, and hotfix builds of
ic-private** (upload with ic-private's AWS role).

## Other effects

- **DFINITY remote cache:** the dind job was the main writer of
`bazel-remote.idx`. Developers and the remaining dind jobs (e.g.
release-testing's qualification and release system tests, which build
`--config=stamped`) will get fewer cache hits, so their builds get
slower. Watch the first rc's dind job durations, and add a warmer job if
needed.
- **Log attribution after a rerun:** githubstats' `last` attributes the
`-logs` artifact by run and job, so after a rerun the logs of a test
that ran in both commands are the rerun's.

## Merging and rollback

- **When:** merge early in the day and tell the release owner. Then
watch the first master run: Upload artifacts with `'172' artifacts
uploaded`, Attest, Build Determinism. Then watch the next rc's Release
Testing.
- **Rollback:** revert this PR. dfinity#12032's pieces work on dind too.
- **If only the upload or Attest failed:** `gh run rerun <run> --failed`
is safe, because the uploader's rclone refuses to change existing files.

## Testing

- **This PR's CI runs (labeled `CI_ALL_BAZEL_TARGETS`):** 42629014989
(4fd2858), 42637000380 (62b81bd) and 42644461118 (0795c3b)
passed, with no reruns, rewinds or lost inputs. Numbers of the first:
- Bazel Test All took 40 min on Namespace: 6 min build, 33 min tests.
All 1,159 tests passed, 1 of them flaky.
  - Build Determinism compared 34,253 artifacts with no mismatches.
  - `Check PULL_REQUEST_BAZEL_TARGETS` passed with the exclusion.
- The artifacts were `bazel-test-all-bazel-test-1-bep`/`-logs`,
`bazel-test-all-bazel-build-1-bep`, `execlogs-bazel-build` and
`bazel-targets`.
- **The third run shows a busy afternoon:** its tests took 82 min
(15:32-16:54Z), although only 231 of the 1,159 ran and the rest were
cached.
- System tests waited at Namespace for up to about 53 min before they
started. For 10 minutes, none of the 43 actions in flight ran.
- In dfinity/ic, 4-7 RBE test steps ran at the same time, 2-3 of them
for master pushes. Two of those master runs' test steps took 85 and 101
min.
- **The run of the latest commits** (43233278183 for e40d342: master
merged in, the nightly deleted) passed. Bazel Test All took 42 min (6
min build, 35 min tests, 14:10-14:45Z): all 1,160 tests passed, 408 of
them ran, with no reruns, rewinds or lost inputs. Build Determinism
again compared 34,253 artifacts with no mismatches.
- `bazel test //ci/githubstats:query_test
//ci/githubstats:query_help_test` passes. The tests cover both RBE job
names.
- `ci/scripts/targets.py check --exclude_tags=farm_system_test` passes
on the new `PULL_REQUEST_BAZEL_TARGETS`.
- `//pre-commit` ruff, shfmt, DFINITY-capitalization and do-not-merge
checks pass.
- actionlint 1.7.7 on `ci-main.yml` and `ci-kickoff.yml` reports nothing
that master doesn't.
- `rerun-on-remote-error.sh` against a fake bazel, both as GitHub runs
it and under `bash -e`:
  - exit codes 34 then 0, 3 or 34: one rerun, returning its code;
- 34 with a FAILED or TIMEOUT test (also with a single attempt), or with
10 min left: no rerun, keeps 34;
- 34 with only INCOMPLETE, REMOTE FAILURE, flaky or passed tests: one
rerun;
  - 3, 0 and 124: no rerun.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants