Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(ci): stop backend jobs dying in setup on a runner crash (#95137)

Georges-Antoine Assic51e1d9d5533
diff --git a/.agents/skills/depot-ci/SKILL.md b/.agents/skills/depot-ci/SKILL.md
index 70e8176940c4..c6ac424966f8 100644
--- a/.agents/skills/depot-ci/SKILL.md
+++ b/.agents/skills/depot-ci/SKILL.md
@@ -218,6 +218,15 @@ Available sizes: `2x8`, `4x16`, `8x32`, `16x64`, `32x128`, `64x256` (CPUs x RAM
Depot CI supports running steps concurrently within a single job using `parallel:` blocks, reducing job duration to the slowest branch rather than the sum of all steps. This is a Depot CI-specific feature, not compatible with GitHub Actions runners.
+<!-- PostHog-local section. Keep it when resyncing from upstream; see UPSTREAM.md. -->
+
+PostHog addition: the sentence above predates June 2026, when GitHub shipped its own [`parallel:` step keyword](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstepsparallel) for GitHub Actions.
+A `parallel:` block under `.github/workflows/` runs on GitHub's implementation, even on a Depot GHA runner, and only a block under `.depot/workflows/` runs on Depot's.
+The two share a keyword and nothing else: GitHub's has no `sequential:`, and its runner crashes when two branches write `$GITHUB_PATH` at once.
+See "Put the setup actions in a `parallel:` block" in [docs/internal/ci-things-already-tried.md](../../../docs/internal/ci-things-already-tried.md) before proposing one for setup actions.
+
+<!-- End PostHog-local section. -->
+
Use `parallel:` inside `steps:` with individual steps or `sequential:` groups. Each branch starts from the same job state; step outputs, environment variable, and `$GITHUB_PATH` changes from all branches are merged back when the block completes.
```yaml
diff --git a/.agents/skills/depot-ci/UPSTREAM.md b/.agents/skills/depot-ci/UPSTREAM.md
index f8974c718f93..51f4cd086875 100644
--- a/.agents/skills/depot-ci/UPSTREAM.md
+++ b/.agents/skills/depot-ci/UPSTREAM.md
@@ -11,7 +11,7 @@ Upstream also ships `agents/openai.yaml` and `assets/` icons in this directory.
## Local additions
- `references/posthog-check-run-semantics.md`, which upstream has no equivalent of.
-- In `SKILL.md`, the paragraph between the PostHog-local comment markers, and the two sentences appended to the frontmatter `description`.
+- In `SKILL.md`, the two paragraphs between PostHog-local comment markers (one under the intro, one under "Parallel Steps" recording that GitHub Actions now has its own `parallel:` keyword), and the two sentences appended to the frontmatter `description`.
- Three code fences tagged `text` to satisfy markdownlint MD040, which the pre-commit hook enforces: the directory tree in `SKILL.md` and `references/migration.md`, and the SPIFFE id in `references/oidc.md`. Upstream leaves them untagged, so a resync reintroduces the error.
## Resync
diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.yml
index f1595f8052d7..79aaf6272a7b 100644
--- a/.depot/workflows/ci-backend.yml
+++ b/.depot/workflows/ci-backend.yml
@@ -927,17 +927,20 @@ jobs:
client-id: ${{ vars.GH_APP_POSTHOG_PRODUCT_TESTS_APP_ID }}
private-key: ${{ secrets.GH_APP_POSTHOG_PRODUCT_TESTS_PRIVATE_KEY }}
skip-token-revoke: true
- - parallel:
- - name: Set up pnpm and Node
- uses: ./.depot/actions/setup-pnpm
- with:
- token: ${{ steps.setup-gh-token.outputs.token || github.token }}
- - name: Set up Python
- uses: ./.depot/actions/setup-python-cached
- with:
- python-version: 3.13.13
- token: ${{ steps.setup-gh-token.outputs.token || github.token }}
- # Needs pnpm from the block above, so it cannot run inside it.
+ # Sequential to mirror canonical. GitHub's native `parallel:` crashes the
+ # Actions runner when two branches write $GITHUB_PATH at once. Depot CI's
+ # `parallel:` is a separate implementation, but the shadow keeps the same
+ # step order so the timing trial measures the same work.
+ - name: Set up pnpm and Node
+ uses: ./.depot/actions/setup-pnpm
+ with:
+ token: ${{ steps.setup-gh-token.outputs.token || github.token }}
+ - name: Set up Python
+ uses: ./.depot/actions/setup-python-cached
+ with:
+ python-version: 3.13.13
+ token: ${{ steps.setup-gh-token.outputs.token || github.token }}
+ # Needs pnpm from the step above.
- name: Install turbo
uses: ./.github/actions/setup-turbo
@@ -2038,28 +2041,31 @@ jobs:
# Tool cache steps inlined rather than the setup-python-cached composite:
# this job checks out the PR head ref, which cannot resolve a local
# action that only exists on master until the branch rebases. The
- # restore sits before the parallel block so the tool cache is warm
- # when setup-python starts.
+ # restore sits before setup-python so the tool cache is warm when it
+ # starts.
- name: Restore Python tool cache
id: python-toolcache
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ runner.tool_cache }}/Python/${{ matrix.python-version }}
key: python-toolcache-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}
- - parallel:
- - name: Set up Python
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
- with:
- python-version: ${{ matrix.python-version }}
- token: ${{ steps.setup-gh-token.outputs.token || github.token }}
- # setup-sqlx-cli resolves from the PR head ref here, so an unrebased branch
- # gets a version that installs no Rust. Delete once open branches rebase.
- - name: Install Rust
- if: needs.changes.outputs.backend == 'true'
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
- with:
- toolchain: 1.91.1
- components: cargo
+ # Sequential to mirror canonical. GitHub's native `parallel:` crashes the
+ # Actions runner when two branches write $GITHUB_PATH at once. Depot CI's
+ # `parallel:` is a separate implementation, but the shadow keeps the same
+ # step order so the timing trial measures the same work.
+ - name: Set up Python
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
+ with:
+ python-version: ${{ matrix.python-version }}
+ token: ${{ steps.setup-gh-token.outputs.token || github.token }}
+ # setup-sqlx-cli resolves from the PR head ref here, so an unrebased branch
+ # gets a version that installs no Rust. Delete once open branches rebase.
+ - name: Install Rust
+ if: needs.changes.outputs.backend == 'true'
+ uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
+ with:
+ toolchain: 1.91.1
+ components: cargo
- name: Save Python tool cache
if: github.ref == 'refs/heads/master' && steps.python-toolcache.outputs.cache-hit != 'true'
uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.yml
index 501588299a05..b09f88056495 100644
--- a/.github/workflows/ci-backend.yml
+++ b/.github/workflows/ci-backend.yml
@@ -843,21 +843,25 @@ jobs:
private-key: ${{ secrets.GH_APP_POSTHOG_PRODUCT_TESTS_PRIVATE_KEY }}
skip-token-revoke: true
- - parallel:
- # turbo launches each backend:test script through pnpm, so pnpm and
- # Node must stay on PATH even though nothing here reads the workspace.
- - name: Set up pnpm and Node
- uses: ./.github/actions/setup-pnpm
- with:
- token: ${{ steps.setup-gh-token.outputs.token || github.token }}
-
- - name: Set up Python
- uses: ./.github/actions/setup-python-cached
- with:
- python-version: 3.13.13
- token: ${{ steps.setup-gh-token.outputs.token || github.token }}
-
- # Needs pnpm from the block above, so it cannot run inside it.
+ # Sequential, not a `parallel:` block. Each of these writes $GITHUB_PATH,
+ # and concurrent writes crash the GitHub Actions runner ("Collection was
+ # modified" or a missing-key error). The runner fails the step even though
+ # the tool installed fine, so the job dies in setup with nothing to debug.
+ #
+ # turbo launches each backend:test script through pnpm, so pnpm and
+ # Node must stay on PATH even though nothing here reads the workspace.
+ - name: Set up pnpm and Node
+ uses: ./.github/actions/setup-pnpm
+ with:
+ token: ${{ steps.setup-gh-token.outputs.token || github.token }}
+
+ - name: Set up Python
+ uses: ./.github/actions/setup-python-cached
+ with:
+ python-version: 3.13.13
+ token: ${{ steps.setup-gh-token.outputs.token || github.token }}
+
+ # Needs pnpm from the step above.
- name: Install turbo
uses: ./.github/actions/setup-turbo
@@ -2911,8 +2915,8 @@ jobs:
# Tool cache steps inlined rather than the setup-python-cached composite:
# this job checks out the PR head ref, which cannot resolve a local
# action that only exists on master until the branch rebases. The
- # restore sits before the parallel block so the tool cache is warm
- # when setup-python starts.
+ # restore sits before setup-python so the tool cache is warm when it
+ # starts.
- name: Restore Python tool cache
id: python-toolcache
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
@@ -2920,21 +2924,24 @@ jobs:
path: ${{ runner.tool_cache }}/Python/${{ matrix.python-version }}
key: python-toolcache-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}
- - parallel:
- - name: Set up Python
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
- with:
- python-version: ${{ matrix.python-version }}
- token: ${{ steps.setup-gh-token.outputs.token || github.token }}
-
- # setup-sqlx-cli resolves from the PR head ref here, so an unrebased branch
- # gets a version that installs no Rust. Delete once open branches rebase.
- - name: Install Rust
- if: needs.changes.outputs.backend == 'true'
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
- with:
- toolchain: 1.91.1
- components: cargo
+ # Sequential, not a `parallel:` block. Both of these write $GITHUB_PATH,
+ # and concurrent writes crash the GitHub Actions runner ("Collection was
+ # modified" or a missing-key error). The runner fails the step even though
+ # the tool installed fine, so the job dies in setup with nothing to debug.
+ - name: Set up Python
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
+ with:
+ python-version: ${{ matrix.python-version }}
+ token: ${{ steps.setup-gh-token.outputs.token || github.token }}
+
+ # setup-sqlx-cli resolves from the PR head ref here, so an unrebased branch
+ # gets a version that installs no Rust. Delete once open branches rebase.
+ - name: Install Rust
+ if: needs.changes.outputs.backend == 'true'
+ uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
+ with:
+ toolchain: 1.91.1
+ components: cargo
- name: Save Python tool cache
if: github.ref == 'refs/heads/master' && steps.python-toolcache.outputs.cache-hit != 'true'
diff --git a/.github/workflows/ci-deltalite-python.yml b/.github/workflows/ci-deltalite-python.yml
index 22241f8c8445..542d0ea7e056 100644
--- a/.github/workflows/ci-deltalite-python.yml
+++ b/.github/workflows/ci-deltalite-python.yml
@@ -52,17 +52,20 @@ jobs:
sparse-checkout-cone-mode: false
clean: false
- - parallel:
- - name: Install rust
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
- with:
- toolchain: 1.91.1
- components: clippy,rustfmt
+ # Sequential, not a `parallel:` block. Both of these write $GITHUB_PATH,
+ # and concurrent writes crash the GitHub Actions runner ("Collection was
+ # modified" or a missing-key error). The runner fails the step even though
+ # the tool installed fine, so the job dies in setup with nothing to debug.
+ - name: Install rust
+ uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
+ with:
+ toolchain: 1.91.1
+ components: clippy,rustfmt
- - name: Set up Python
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
- with:
- python-version: '3.13'
+ - name: Set up Python
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
+ with:
+ python-version: '3.13'
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
diff --git a/.github/workflows/ci-rust.yml b/.github/workflows/ci-rust.yml
index 5cdfaf0b2ef7..ac2f5a678cb7 100644
--- a/.github/workflows/ci-rust.yml
+++ b/.github/workflows/ci-rust.yml
@@ -277,20 +277,23 @@ jobs:
sparse-checkout-cone-mode: false
clean: false
- - parallel:
- - name: Install system OpenSSL
- run: |
- sudo rm -f /etc/apt/sources.list.d/*twingate*
- sudo apt-get update
- sudo apt-get install -y libssl-dev pkg-config
+ - name: Install system OpenSSL
+ run: |
+ sudo rm -f /etc/apt/sources.list.d/*twingate*
+ sudo apt-get update
+ sudo apt-get install -y libssl-dev pkg-config
- - name: Install protoc
- uses: ./.github/actions/setup-protoc
+ # protoc and rustup both write $GITHUB_PATH, so they stay out of a
+ # `parallel:` block. Concurrent writes crash the GitHub Actions runner
+ # ("Collection was modified" or a missing-key error), and the runner
+ # fails the step even though the tool installed fine.
+ - name: Install protoc
+ uses: ./.github/actions/setup-protoc
- - name: Install rust
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
- with:
- toolchain: 1.91.1
+ - name: Install rust
+ uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
+ with:
+ toolchain: 1.91.1
- name: Set sccache WebDAV key prefix (Cargo.lock hash)
run: echo "SCCACHE_WEBDAV_KEY_PREFIX=cargo-${{ hashFiles('rust/Cargo.lock') }}" >> "$GITHUB_ENV"
@@ -837,21 +840,24 @@ jobs:
sparse-checkout-cone-mode: false
clean: false
- - parallel:
- - name: Install system OpenSSL
- run: |
- sudo rm -f /etc/apt/sources.list.d/*twingate*
- sudo apt-get update
- sudo apt-get install -y libssl-dev pkg-config
-
- - name: Install protoc
- uses: ./.github/actions/setup-protoc
-
- - name: Install rust
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
- with:
- toolchain: 1.91.1
- components: clippy,rustfmt
+ - name: Install system OpenSSL
+ run: |
+ sudo rm -f /etc/apt/sources.list.d/*twingate*
+ sudo apt-get update
+ sudo apt-get install -y libssl-dev pkg-config
+
+ # protoc and rustup both write $GITHUB_PATH, so they stay out of a
+ # `parallel:` block. Concurrent writes crash the GitHub Actions runner
+ # ("Collection was modified" or a missing-key error), and the runner
+ # fails the step even though the tool installed fine.
+ - name: Install protoc
+ uses: ./.github/actions/setup-protoc
+
+ - name: Install rust
+ uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
+ with:
+ toolchain: 1.91.1
+ components: clippy,rustfmt
- name: Set sccache WebDAV key prefix (Cargo.lock hash)
run: echo "SCCACHE_WEBDAV_KEY_PREFIX=cargo-${{ hashFiles('rust/Cargo.lock') }}" >> "$GITHUB_ENV"
diff --git a/docs/internal/ci-things-already-tried.md b/docs/internal/ci-things-already-tried.md
index d1ba5b13c18c..1176b35da2e8 100644
--- a/docs/internal/ci-things-already-tried.md
+++ b/docs/internal/ci-things-already-tried.md
@@ -377,6 +377,40 @@ Run the trial for several days. A short window cannot separate the jobs whose ti
_Also asked as:_ change CI provider, Blacksmith, cheaper runners, are the Depot runners slow
+### Put the setup actions in a `parallel:` block
+
+**Verdict: reverted** · Sep 2026 · added by [#76651](https://github.com/PostHog/posthog/pull/76651)
+
+`pnpm-install`, `setup-python-cached`, and `dtolnay/rust-toolchain` each write `$GITHUB_PATH`.
+The `parallel:` block here is [GitHub's native step parallelism](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstepsparallel), shipped in June 2026.
+It runs every step in the group as a background step and merges their environment changes at the implicit wait.
+The implementation in the GitHub Actions runner is not thread-safe. Two branches that write at the same time crash the runner.
+
+The failing jobs ran on Depot GHA runners, but the bug is not Depot's.
+Depot confirmed that its own `parallel:` construct exists only in Depot CI, which parses `.depot/workflows/`, and that jobs under `.github/workflows/` use GitHub's implementation.
+The two share a keyword and nothing else.
+
+The crash gives one of three messages. None of them names a step:
+
+```text
+##[error]Collection was modified; enumeration operation may not execute.
+##[error]The given key '<guid>' was not present in the dictionary.
+SyntaxError: Unexpected end of JSON input # setup-node parsing GITHUB_EVENT_PATH
+```
+
+The runner then fails the step that it was running, and the whole job.
+The tool itself succeeds. One failing job logs `1.91.1-x86_64-unknown-linux-gnu installed` inside the step that the runner reports as failed.
+The crash lands in whichever branch loses the race, so the same bug shows up as `Install Rust`, `Install pnpm dependencies`, or `Set up Python`.
+
+Four product test jobs died this way between 09:05 and 11:52 on 4 Sep 2026.
+The same crash is in the runs of 3 Sep 2026, so it is not a single bad day.
+The three setup steps take 151s, 4s, and 12s in the product test job, so the block saves about 16s of a 12-minute job.
+
+The steps are sequential today. Keep an action that writes `$GITHUB_PATH` or `$GITHUB_ENV` out of a `parallel:` block.
+A block of `run:` steps is safe, and `ci-backend.yml`, `ci-python.yml`, `ci-frontend.yml`, and `ci-nodejs.yml` still use one.
+
+_Also asked as:_ parallel steps, run the setup steps at the same time, Collection was modified, key was not present in the dictionary, Install Rust fails in setup
+
### Use sparse-checkout on the large CI workflows
**Verdict: abandoned** · Oct 2025 · [#39239](https://github.com/PostHog/posthog/pull/39239)