gemini-cli - 💡(How to fix) Fix CI: fail PR when @google/gemini-cli npm tarball exceeds size threshold [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25843Fetched 2026-04-23 07:44:27
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
labeled ×2

Add a CI check that fails a PR if the published npm tarball for @google/gemini-cli (or @google/gemini-cli-core) would exceed a known-safe size threshold. Catches the kind of regression that produced #25507 (an npm publish E413 from wombat-dressing-room) at PR review time instead of at release time.

Error Message

tarball_size: name: 'Check npm tarball size' runs-on: 'gemini-cli-ubuntu-16-core' needs: 'merge_queue_skipper' if: "github.repository == 'google-gemini/gemini-cli' && needs.merge_queue_skipper.outputs.skip == 'false'" steps: - uses: 'actions/checkout@…' - uses: 'actions/setup-node@…' with: { node-version-file: '.nvmrc', cache: 'npm' } - run: 'npm ci' - run: 'npm run bundle' - run: 'node scripts/prepare-npm-release.js' - name: 'Check @google/gemini-cli tarball size' run: | SIZE_BYTES=$(npm pack --dry-run -w @google/gemini-cli --json 2>/dev/null
| jq -r '.[0].size') SIZE_MB=$(awk -v b="$SIZE_BYTES" 'BEGIN { printf "%.1f", b/1048576 }') # wombat-dressing-room's hard limit is somewhere in the 25-28 MB range; # leave headroom. LIMIT_MB=22 echo "@google/gemini-cli tarball: ${SIZE_MB} MB (limit ${LIMIT_MB} MB)" if (( $(echo "$SIZE_MB > $LIMIT_MB" | bc -l) )); then echo "::error::@google/gemini-cli tarball is ${SIZE_MB} MB — exceeds the ${LIMIT_MB} MB safety threshold for wombat-dressing-room. Consider trimming bundled assets, or moving large native binaries to platform-specific optionalDependencies." exit 1 fi - name: 'Check @google/gemini-cli-core tarball size' run: | # Same check, lower threshold (core's historical baseline is ~10 MB). ...

Root Cause

  • Caused by: #25342 (silently grew the tarball)
  • Surfaced via: #25507 (auto-filed nightly failure)
  • Mitigated by: #25841 (the actual unblock; doesn't prevent recurrence)

Code Example

tarball_size:
  name: 'Check npm tarball size'
  runs-on: 'gemini-cli-ubuntu-16-core'
  needs: 'merge_queue_skipper'
  if: "github.repository == 'google-gemini/gemini-cli' && needs.merge_queue_skipper.outputs.skip == 'false'"
  steps:
    - uses: 'actions/checkout@…'
    - uses: 'actions/setup-node@…'
      with: { node-version-file: '.nvmrc', cache: 'npm' }
    - run: 'npm ci'
    - run: 'npm run bundle'
    - run: 'node scripts/prepare-npm-release.js'
    - name: 'Check @google/gemini-cli tarball size'
      run: |
        SIZE_BYTES=$(npm pack --dry-run -w @google/gemini-cli --json 2>/dev/null \
          | jq -r '.[0].size')
        SIZE_MB=$(awk -v b="$SIZE_BYTES" 'BEGIN { printf "%.1f", b/1048576 }')
        # wombat-dressing-room's hard limit is somewhere in the 25-28 MB range;
        # leave headroom.
        LIMIT_MB=22
        echo "@google/gemini-cli tarball: ${SIZE_MB} MB (limit ${LIMIT_MB} MB)"
        if (( $(echo "$SIZE_MB > $LIMIT_MB" | bc -l) )); then
          echo "::error::@google/gemini-cli tarball is ${SIZE_MB} MB — exceeds the ${LIMIT_MB} MB safety threshold for wombat-dressing-room. Consider trimming bundled assets, or moving large native binaries to platform-specific optionalDependencies."
          exit 1
        fi
    - name: 'Check @google/gemini-cli-core tarball size'
      run: |
        # Same check, lower threshold (core's historical baseline is ~10 MB).
        ...
RAW_BUFFERClick to expand / collapse

Summary

Add a CI check that fails a PR if the published npm tarball for @google/gemini-cli (or @google/gemini-cli-core) would exceed a known-safe size threshold. Catches the kind of regression that produced #25507 (an npm publish E413 from wombat-dressing-room) at PR review time instead of at release time.

Why is this needed?

The chain that broke Release: Promote for ~7 days:

  1. PR #25342 added 5 cross-platform ripgrep binaries (~21 MB raw) into bundle/vendor/ripgrep/.
  2. The PR template only asks for "validated on macOS / npm run" (which the author checked). Nothing in the template or CI surfaced the published-tarball size.
  3. The change merged.
  4. The first nightly to include the change failed with E413 (auto-filed #25507, priority/p0, release-failure — closed without action).
  5. Six subsequent nightlies stalled in the prod environment approval queue, silently.
  6. Eight days later, a manual Release: Promote finally surfaced the failure to a human.

A CI guard at step 2 would have prevented all of this with a single line of red on the PR.

Proposed plan

Add a job to .github/workflows/ci.yml (or a small new workflow that runs on PRs touching scripts/, packages/*/package.json, esbuild.config.js, and anything that changes bundle composition):

tarball_size:
  name: 'Check npm tarball size'
  runs-on: 'gemini-cli-ubuntu-16-core'
  needs: 'merge_queue_skipper'
  if: "github.repository == 'google-gemini/gemini-cli' && needs.merge_queue_skipper.outputs.skip == 'false'"
  steps:
    - uses: 'actions/checkout@…'
    - uses: 'actions/setup-node@…'
      with: { node-version-file: '.nvmrc', cache: 'npm' }
    - run: 'npm ci'
    - run: 'npm run bundle'
    - run: 'node scripts/prepare-npm-release.js'
    - name: 'Check @google/gemini-cli tarball size'
      run: |
        SIZE_BYTES=$(npm pack --dry-run -w @google/gemini-cli --json 2>/dev/null \
          | jq -r '.[0].size')
        SIZE_MB=$(awk -v b="$SIZE_BYTES" 'BEGIN { printf "%.1f", b/1048576 }')
        # wombat-dressing-room's hard limit is somewhere in the 25-28 MB range;
        # leave headroom.
        LIMIT_MB=22
        echo "@google/gemini-cli tarball: ${SIZE_MB} MB (limit ${LIMIT_MB} MB)"
        if (( $(echo "$SIZE_MB > $LIMIT_MB" | bc -l) )); then
          echo "::error::@google/gemini-cli tarball is ${SIZE_MB} MB — exceeds the ${LIMIT_MB} MB safety threshold for wombat-dressing-room. Consider trimming bundled assets, or moving large native binaries to platform-specific optionalDependencies."
          exit 1
        fi
    - name: 'Check @google/gemini-cli-core tarball size'
      run: |
        # Same check, lower threshold (core's historical baseline is ~10 MB).
        ...

Key design decisions

  • Threshold tuning. Set the limit ~10–15% below the actual wombat ceiling so we get warned before a release fails. Values above (~22 MB for cli, ~15 MB for core) are starting points that match the current healthy baselines from #25841.
  • Run on PRs, not just main. The whole point is to catch this in review, not after merge.
  • Output is actionable. The error message names the likely fix (move binaries to optionalDependencies) so reviewers / authors don't have to reverse-engineer it.
  • Don't gate the merge queue on this if the threshold is hit by a legitimate growth. The label-bypass pattern (area/release-known-bigger-tarball or similar) lets release-aware PRs override after a maintainer reviews.
  • Optional follow-up: also report the tarball size as a status comment on the PR so authors see the trend even when below the limit.

Estimated effort

~2–3 hours, including PR template tweak to add a "tarball size impact" item to the bundle-affecting PR checklist.

Related Issues

  • Caused by: #25342 (silently grew the tarball)
  • Surfaced via: #25507 (auto-filed nightly failure)
  • Mitigated by: #25841 (the actual unblock; doesn't prevent recurrence)

Additional context

  • npm pack --dry-run --json provides exact bytes; no parsing of npm notice output needed.
  • The bundle_size job in .github/workflows/ci.yml already does diffing for the SEA bundle; this would be its npm-tarball cousin.
  • The release-infra check is layered: this CI job catches at PR time; the Release: Promote job will still legitimately fail at publish time if someone bypasses the check, so we're not removing the safety net, just adding an earlier one.

extent analysis

TL;DR

Add a CI check to .github/workflows/ci.yml to fail PRs if the published npm tarball for @google/gemini-cli or @google/gemini-cli-core exceeds a known-safe size threshold.

Guidance

  • Implement the proposed tarball_size job in .github/workflows/ci.yml to check the size of the npm tarball for @google/gemini-cli and @google/gemini-cli-core on PRs.
  • Set the size threshold to a value below the actual wombat ceiling (e.g., 22 MB for cli and 15 MB for core) to provide a warning before a release fails.
  • Consider adding a label-bypass pattern to allow release-aware PRs to override the threshold check after maintainer review.
  • Update the PR template to include a "tarball size impact" item in the bundle-affecting PR checklist.

Example

tarball_size:
  name: 'Check npm tarball size'
  runs-on: 'gemini-cli-ubuntu-16-core'
  needs: 'merge_queue_skipper'
  if: "github.repository == 'google-gemini/gemini-cli' && needs.merge_queue_skipper.outputs.skip == 'false'"
  steps:
    # ... (rest of the job configuration)

Notes

The proposed solution assumes that the npm pack --dry-run --json command provides accurate information about the tarball size. Additionally, the threshold values may need to be adjusted based on the actual wombat ceiling and the historical baseline of the project.

Recommendation

Apply the proposed workaround by adding the tarball_size job to .github/workflows/ci.yml to catch potential tarball size issues at PR review time, rather than at release time. This will help prevent similar issues in the future and provide an earlier warning system for maintainers.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING