Skip to content

fix(toolchain): release-lane cache parity, bounded realisation, fail-soft cachix - #2082

Merged
gerchowl merged 5 commits into
devfrom
bugfix/2010-release-lane-cachix
Nov 17, 2026
Merged

gerchowl merged 5 commits into
devfrom
bugfix/2010-release-lane-cachix

Conversation

@gerchowl

Copy link
Copy Markdown
Contributor

Description

Release-lane jobs in direnv-mode consumers built consumer-only derivations from source and ran into their job timeout. This PR fixes that, and the hangs, Cachix hard-failures and stuck rollbacks around it (#2010, devkit part of #2077).

Root cause: only ci.yml passed cachix-cache to setup-devkit-toolchain. In the public stepv prepare-release run 43877817364, "Configure Cachix" was skipped and 0 paths came from the consumer cache. The same hour, ci.yml run 43880461559 pulled those same paths in seconds.

Type of Change

  • fix -- Bug fix
  • test -- Adding or updating tests

Changes Made

  1. Substituter parity: all 25 scaffolded call sites now pass cachix-cache: ${{ vars.CACHIX_CACHE }}. Only ci.yml passes cachix-auth-token; the token and push policy stay with [FEATURE] Nix: seeded CI cache + opt-in trusted release-cache push #1784/security(ci): managed ci.yml passes the Cachix push token to same-repo pull_request runs (cache poisoning) #1881.
    • I read cachix/cachix-action v17 at the pinned SHA. With a cache name and no token it installs cachix if missing, runs cachix use <name> and logs "Pushing is disabled". So the new call sites are pull-only. This is documented in the action header.
    • devkit-upgrade.yml does not call the composite; it has its own Nix install. It gets the network knobs below through the existing lockstep constant.
    • Devkit's own .github/ uses setup-env and already passes cachix-cache everywhere.
  2. Bounded realisation:
    • Nix's own transfer settings connect-timeout = 15, stalled-download-timeout = 60 and download-attempts = 3. They are set on both the extra_nix_config path and the host NIX_CONFIG path, plus devkit-upgrade.yml, with the rationale and the Nix settings reference in a comment. The lockstep constant is extended.
    • A new realisation-timeout-minutes input (default 6) sets one wall-clock budget across every nix develop call in the dev-shell step. It uses coreutils timeout with a kill grace, because composite steps have no timeout-minutes (metadata syntax docs).
    • On expiry the step fails with ::error::… toolchain realisation exceeded N min; last nix activity: <last nix stderr line>.
    • An exit 137 before the deadline (e.g. the OOM killer) keeps its own exit code instead of being blamed on the clock.
    • Budget: the default 6 leaves at least 4 min of every release-lane job timeout (10–20 min) for the rest of the job. The ci.yml lanes fill the cache and may legitimately build, so they pass their job timeout minus 4.
    • There is no shell retry around nix; retries happen per transfer.
  3. Fail-soft Cachix ([BUG] 1.19.0 setup-devkit-toolchain: cachix-action fails 'Error: not found: cachix' (stepv adoption PR) #2077): "Configure Cachix" now has continue-on-error. A "Report Cachix degradation" step then emits a ::warning:: naming the likely reason (cachix binary missing / cache URL unreachable / see the step log), and the realisation continues on the remaining substituters.
  4. Rollbacks don't depend on the toolchain: a new minimal input. With it the action keeps only the retry helper in host modes, and the in-image env plus safe.directory in container modes.
    • With minimal, no Nix, dev-shell, uv tools or prek guard are set up.
    • Used by the prepare-release, prepare-hotfix and release.yml rollbacks and promote-release cleanup. Their run: bodies only use gh, git, jq, base64 and retry.
    • Also used by sync-main-to-dev check (git and retry only), whose 5-min job timeout no realisation bound fits.
  5. Docs: the action header and input descriptions are the source of truth. docs/MIGRATION.md (Mode-aware CI) gets a short paragraph on CACHIX_CACHE, the bounds and the degradation, linking to the header.

Changelog Entry

Fixed

  • Release-lane toolchain setup pulls the consumer cache, is bounded and degrades softly (#2010, #2077)
    • Every scaffolded setup-devkit-toolchain call site now passes cachix-cache: ${{ vars.CACHIX_CACHE }}, pull-only, so release-lane jobs substitute consumer-only paths instead of building them from source into the job timeout.
    • Nix network bounds (connect-timeout, stalled-download-timeout, download-attempts) on every runner-side Nix config, plus a realisation-timeout-minutes wall-clock bound that fails with toolchain realisation exceeded N min; last nix activity: … instead of a silent cancel.
    • A failing Configure Cachix step now warns with the reason and continues on the remaining substituters instead of failing every job.
    • Rollback and cleanup jobs pass minimal: true and no longer realise the dev-shell they may be rolling back from.

Testing

  • Tests pass locally for the touched suites (the full suite runs in CI)

  • New tests/test_toolchain_release_lane.py, committed first:

    • On base it gave 80 failed and 173 passed, together with the lockstep suites that pick up the extended Nix settings constant.
    • The hang tests run the real step script against a stub nix that hangs, both TERM-able and TERM-ignoring. They check the step fails within the bound, with the explicit error and the last nix activity line.
    • Other tests cover: call-site parity and token exclusion, the bound fitting each job timeout, the warning reasons for each Cachix failure, and if: conditions evaluated with tests.github_expression across all modes × minimal.
  • Locally, the 63 workflow-shape suites that parse the edited files gave 2520 passed and 36 skipped, exit 0.

  • A fresh-context review found one blocker: the 6-min default also capped the cache-filling ci.yml lanes. It is fixed in dd600ccd, along with both nits.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Additional Notes

Not done here (follow-ups worth filing):

Refs: #2010, #2077

…fail-soft cachix

Guard tests for setup-devkit-toolchain: every call site pulls the consumer
Cachix cache, release-lane call sites never get the push token, Nix network
knobs are set on both config paths, the realisation fails at a wall-clock
bound with an explicit error, a failed Cachix step degrades to a warning, and
rollback/cleanup jobs never realise the dev-shell.

Refs: #2010
…tions

Drop the ad-hoc evaluate_if helper in favour of tests.github_expression,
complete the hanging-nix stub's env dump, and route the realisation bound
through the existing dev-shell harness env.

Refs: #2010
…ation, fail soft on cachix

Every scaffolded setup-devkit-toolchain call site passes cachix-cache
(pull-only; the token stays in ci.yml). Nix network bounds are set on both
config paths and in devkit-upgrade, the dev-shell realisation runs under a
wall-clock budget that fails with an explicit error naming the last nix
activity, a failing Cachix step degrades to a warning, and rollback/cleanup
jobs pass minimal: true so they never realise the dev-shell.

Refs: #2010
…sation bound

The 6-minute default fits the pull-only release lane, where a cold build is
itself the bug. ci.yml fills the cache and may legitimately build, so its
lanes pass their job timeout minus the 4-minute margin. A nix exit 137 before
the deadline (e.g. the OOM killer) now keeps its own exit code instead of
being reported as the wall-clock bound.

Refs: #2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant