Skip to content

ci: retry transient dependency installs + skip native rebuild in typecheck - #49286

Merged
ethernet8023 merged 1 commit into
bb/ci-affected-onlyfrom
bb/ci-install-retry
Jun 23, 2026
Merged

ethernet8023 merged 1 commit into
bb/ci-affected-onlyfrom
bb/ci-install-retry

Conversation

@OutThisLife

Copy link
Copy Markdown

Stacked on #49272 (base = bb/ci-affected-only). GitHub will auto-retarget this to main once that merges. Review/merge #49272 first.

Problem

The most common "red, re-run, green" CI failures here aren't test bugs — they're transient network/toolchain flakes during dependency install. The reported case: the typecheck (ui-tui) job died in npm ci while node-gyp rebuilt node-pty's native binary and choked fetching Node headers (an undici assert(!this.paused)). It never reached tsc.

Fix

1. Auto-retry every PR-path network install — a reusable .github/actions/retry composite action wraps a command and retries on non-zero exit (3× / 10s). The command is passed via env (never interpolated into the script body) so it can't break or inject. Applied to:

Step Workflow
npm ci typecheck, desktop-build, docs-site
uv sync tests, e2e
uv tool install ruff/ty lint
pip install docs-site

ripgrep download switched to curl --retry 3 --retry-delay 5 (curl-native retry).

2. Root-cause the typecheck flake — typecheck now runs npm ci --ignore-scripts. tsc only needs TS sources + type defs, not compiled native binaries, so skipping install scripts removes the node-pty rebuild entirely (eliminating the header-fetch flake) and is faster. desktop-build keeps scripts (its production build may need the native binary) and relies on retry.

Validation

  • npm ci --ignore-scripts + tsc passes for ui-tui, apps/shared, apps/desktop (~17s, no native build).
  • retry loop semantics unit-checked: succeeds first try, succeeds on the Nth retry, gives up non-zero after N.
  • all five touched YAML files parse.

Out of scope (deliberate)

`npm ci` / `uv sync` / toolchain header fetches occasionally die on
transient network blips — e.g. node-pty's node-gyp fetching Node headers
(an undici assert) during the typecheck job's `npm ci`, which killed the job
before `tsc` ever ran. "Re-run and it goes green" is exactly what CI should
do itself.

- New reusable `.github/actions/retry` composite action wraps a command and
  retries on failure (3x / 10s, command passed via env so it can't inject).
  Applied to every PR-path network install: npm ci (typecheck, desktop
  build, docs site), uv sync (tests, e2e), uv tool install (lint),
  pip install (docs site).
- typecheck now runs `npm ci --ignore-scripts`: `tsc` needs only sources +
  type defs, so skipping install scripts drops node-pty's native rebuild
  (whose header fetch was the flake) and is faster. Validated locally — tsc
  passes for ui-tui, apps/shared, and apps/desktop with scripts skipped.
- ripgrep download uses `curl --retry`.

Docker (main-only) and the release/windows workflows are intentionally left
for a follow-up.
@alt-glitch alt-glitch added type/test Test coverage or test infrastructure P3 Low — cosmetic, nice to have labels Jun 19, 2026
@alt-glitch

Copy link
Copy Markdown

Related: #49227 (closed) — this PR supersedes that earlier "skip native rebuild in typecheck" attempt and broadens it into a reusable .github/actions/retry composite covering npm ci / uv sync / uv tool install across the lint, tests, docs-site, and typecheck workflows. Valid resubmission of the closed predecessor, not a duplicate.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Clean, well-scoped CI hardening. Approving.

Security: the composite action passes the command through env._CMD and runs bash -c "$_CMD" rather than interpolating it into the script body, so a command with quotes/specials can't break or inject into the runner. Correct pattern.

set -uo pipefail without -e is right here — the loop captures the command's exit code manually via the if bash -c, and -e would abort the retry on the first failed attempt.

--ignore-scripts on typecheck: sound. tsc only needs TS sources + type defs, so dropping the node-pty node-gyp rebuild removes the actual flake source rather than just papering over it with retry — and it's faster. Keeping scripts on desktop-build (its production build may need the native binary) + relying on retry there is the right split.

Two notes, neither blocking:

  1. Stacked on #49272 (base = bb/ci-affected-only) — merge that first, then this auto-retargets to main.
  2. Because #49272 makes CI affected-only and this PR only touches .github/ workflow files, the touched lanes (typecheck/lint/tests) didn't actually run here — only the four always-on guard jobs are green. The npm ci --ignore-scripts + tsc path was validated locally per the PR body; first real CI exercise lands on the next frontend/python PR after merge.

LGTM.

@ethernet8023
ethernet8023 merged commit e7868fd into bb/ci-affected-only Jun 23, 2026
7 checks passed
@ethernet8023
ethernet8023 deleted the bb/ci-install-retry branch June 23, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have type/test Test coverage or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants