Skip to content

fix(ci): cache mise tool installs to reduce GitHub API rate limit usage#1117

Open
palootcenas-outreach wants to merge 1 commit intomainfrom
palo/cache-mise-installs
Open

fix(ci): cache mise tool installs to reduce GitHub API rate limit usage#1117
palootcenas-outreach wants to merge 1 commit intomainfrom
palo/cache-mise-installs

Conversation

@palootcenas-outreach
Copy link

@palootcenas-outreach palootcenas-outreach commented Mar 26, 2026

Summary

  • Add ~/.local/share/mise to CircleCI save_cache paths so installed mise tool binaries and shims are persisted across builds
  • Bump cache key prefix from v1 to v2 on all daily-cache and toggle-cache keys to force a fresh cache write that includes the new path

Problem

Every CI run re-installs mise tool binaries because ~/.local/share/mise/ (where installed binaries live) is not in the cached paths. Only ~/.cache (downloaded archives) was cached. Each mise install hits api.github.com/repos/.../releases for every github: backend tool, consuming shared GitHub API rate limits (~18 API URLs per build). With concurrent CI builds across all repos sharing the same 15,000 req/hour token pool, this is the primary driver of rate limit exhaustion causing CI failures and devenv provisioning failures org-wide.

Fix

File Change
orbs/shared/jobs/save_cache.yaml Add ~/.local/share/mise to save_cache paths; bump v1v2 on daily-cache save key (line 81), toggle-cache restore key (line 63), and toggle-cache save key (line 87)
orbs/shared/commands/setup_environment.yml Bump v1v2 on daily-cache restore key (line 40)

With mise installs cached, subsequent CI runs find tool binaries already installed. mise install becomes a no-op for already-installed tools, skipping GitHub API calls entirely.

Risk Assessment

  • Low risk — additive change only (one new path in cache list + key prefix bump)
  • No behavioral change — if cache is empty, mise installs normally as before
  • Rollback — bump to v3 to invalidate if needed
  • Cache size~/.local/share/mise adds ~500MB-1GB; CircleCI supports up to 3GB per cache key

Rollout

Once merged and released, all repos pick this up automatically when they restencil (devbase version bumps via stencil.lock.bootstrap/ syncs new orb version).

Notes

  • The {{ epoch }} key pattern (existing, not introduced here) means every build writes a new cache entry. CircleCI auto-evicts after 15 days. A future optimization could key off checksum("mise.toml")-checksum("mise.lock") instead of epoch to deduplicate cache entries.
  • The v1-node-client-cache-* keys are unrelated and intentionally left unchanged.

Rovo Dev code review: Rovo Dev couldn't review this pull request
Something went wrong while reviewing this pull request.
Troubleshoot code review errors

Add ~/.local/share/mise to CircleCI save_cache paths so installed tool
binaries and shims are persisted across builds. This eliminates redundant
GitHub API calls for version resolution on every CI run.

Bump cache key prefix from v1 to v2 on all daily-cache and toggle-cache
keys to force a fresh cache write that includes the new path.
@palootcenas-outreach palootcenas-outreach marked this pull request as ready for review March 26, 2026 13:44
@palootcenas-outreach palootcenas-outreach requested a review from a team as a code owner March 26, 2026 13:44
@palootcenas-outreach
Copy link
Author

palootcenas-outreach commented Mar 26, 2026

Validation Results ✅

Tested in [internal-repo] using a dev orb (getoutreach/shared@dev:cache-mise-test) published from this branch.

Cold cache run (job #135 from internal-repo)

  • restore_cache correctly looked for v2-daily-cache-* keys → cache miss as expected
  • Tests passed normally, mise installed tools from scratch

save_cache run (pipeline #24, manual rebuild_cache trigger)

  • save_cache wrote v2-daily-cache-* key with ~/.local/share/mise in paths
  • Cache size increased from 688 MiB → 903 MiB (215 MiB added for mise installs)

Warm cache run (job #151 from internal-repo)

  • restore_cache hit v2-daily-cache-* key, extracted in 29.6s
  • mise output: all tools are installed — no downloads, no installations
  • GitHub API rate limit: 14907/15000 — identical before and after mise install, confirming zero API calls for tool installation
  • "Skipping writing" messages for home/circleci/.local/share/mise/installs/* confirmed binaries were restored from cache

The fix eliminates all GitHub API calls from mise tool installation when the cache is warm.

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