Skip to content

perf(ci): carry Android Gradle caches on a Blacksmith sticky disk - #109605

Merged
steipete merged 2 commits into
mainfrom
perf/ci-gradle-sticky
Jul 17, 2026
Merged

steipete merged 2 commits into
mainfrom
perf/ci-gradle-sticky

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The android CI lane runs ~501s of build (observed on job android-build-play) largely re-resolving Gradle's dependency graph every run: its only cache today is setup-java's gradle cache on the GitHub actions-cache backend, which the repo's churned quota evicts so quickly that restores rarely hit — the same failure mode that motivated moving the boundary artifacts and Vitest transform caches to Blacksmith sticky disks.

Why This Change Was Made

Same-repo android jobs now mount a Blacksmith sticky disk and point GRADLE_USER_HOME at it, carrying Gradle's dependency cache, wrapper distributions, and build cache across runs:

  • Task-scoped keys (gradle-v1-${{ matrix.task }}-…): each matrix task (ktlint/test/build) resolves a different dependency set, and a shared if-missing key would let a light task win the cold-key race and permanently pin a thin snapshot the heavy lanes can never repair — the exact first-hydration race caught on the boundary-sticky review. One semantic writer per snapshot.
  • Safety: Gradle's caches are content-addressed (stale entries are ignored); dependency-file changes mint a fresh key; the sticky action pin, per-PR/protected key shape, commit: if-missing, and the same-repo/non-fork/non-dispatch gate all mirror the repo's established sticky uses. Fork PRs and dispatches keep the GitHub cache path and run on non-Blacksmith runners anyway.

User Impact

None at runtime — CI-only. Android-touching PRs stop paying full dependency re-resolution on every push after the first per task.

Evidence

  • YAML parse + actionlint clean; step order verified (toolchain → mount → env export → gradle run).
  • node scripts/run-vitest.mjs test/scripts/ci-workflow-guards.test.ts — 74 passed, no expectation changes needed.
  • The android build cannot run locally (Linux Blacksmith + Android SDK); this PR's own CI seeds the cold snapshots and a follow-up push shows the warm win — but this PR does not touch android paths, so the android lane may not run here; the live proof lands with the first android-touching PR after merge.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Jul 17, 2026
steipete added 2 commits July 16, 2026 20:37
The android lane's setup-java gradle cache almost never restores under the
repo's churned GitHub cache quota, so every run re-resolves the full
dependency graph (~501s observed for android-build-play). Mount a
task-scoped Blacksmith sticky disk at /var/tmp/openclaw-gradle and point
GRADLE_USER_HOME at it for same-repo non-fork non-dispatch runs, mirroring
the extension-boundary sticky pattern (per-PR-or-protected key,
commit: if-missing, identical trust gate). Fork PRs and manual dispatches
keep the existing GitHub cache path and non-Blacksmith runners.
Autoreview P2: if-missing froze the snapshot at first hydration, so
later build-cache entries never persisted. on-change commits when the
filesystem changed; content-addressed entries and task-scoped keys keep
it race-safe.
@steipete
steipete force-pushed the perf/ci-gradle-sticky branch from b4e0708 to 16ce687 Compare July 17, 2026 03:38

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 16ce687056

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/ci.yml
Comment on lines +3033 to +3034
mkdir -p /var/tmp/openclaw-gradle/gradle-user-home
echo "GRADLE_USER_HOME=/var/tmp/openclaw-gradle/gradle-user-home" >> "$GITHUB_ENV"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge Keep setup-java cache paths populated on cold sticky runs

For same-repo Blacksmith Android runs where setup-java's Gradle cache misses, this redirects Gradle to populate only /var/tmp/openclaw-gradle/gradle-user-home after the setup action has registered its post-cache save. The pinned actions/setup-java@ad2b... Gradle cache still saves fixed ${HOME}/.gradle/caches and ${HOME}/.gradle/wrapper paths, and its post action rethrows when those paths do not exist, so a cold run can finish the Gradle tasks and then fail during the Java cache post step. Disable the setup-java Gradle cache for sticky runs, or make the homedir cache paths exist/populate consistently.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 0c06de9 into main Jul 17, 2026
106 checks passed
@steipete
steipete deleted the perf/ci-gradle-sticky branch July 17, 2026 03:48
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 17, 2026
…enclaw#109605)

* perf(ci): carry Android Gradle caches on a Blacksmith sticky disk

The android lane's setup-java gradle cache almost never restores under the
repo's churned GitHub cache quota, so every run re-resolves the full
dependency graph (~501s observed for android-build-play). Mount a
task-scoped Blacksmith sticky disk at /var/tmp/openclaw-gradle and point
GRADLE_USER_HOME at it for same-repo non-fork non-dispatch runs, mirroring
the extension-boundary sticky pattern (per-PR-or-protected key,
commit: if-missing, identical trust gate). Fork PRs and manual dispatches
keep the existing GitHub cache path and non-Blacksmith runners.

* fix(ci): let the Gradle sticky snapshot keep learning

Autoreview P2: if-missing froze the snapshot at first hydration, so
later build-cache entries never persisted. on-change commits when the
filesystem changed; content-addressed entries and task-scoped keys keep
it race-safe.
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…enclaw#109605)

* perf(ci): carry Android Gradle caches on a Blacksmith sticky disk

The android lane's setup-java gradle cache almost never restores under the
repo's churned GitHub cache quota, so every run re-resolves the full
dependency graph (~501s observed for android-build-play). Mount a
task-scoped Blacksmith sticky disk at /var/tmp/openclaw-gradle and point
GRADLE_USER_HOME at it for same-repo non-fork non-dispatch runs, mirroring
the extension-boundary sticky pattern (per-PR-or-protected key,
commit: if-missing, identical trust gate). Fork PRs and manual dispatches
keep the existing GitHub cache path and non-Blacksmith runners.

* fix(ci): let the Gradle sticky snapshot keep learning

Autoreview P2: if-missing froze the snapshot at first hydration, so
later build-cache entries never persisted. on-change commits when the
filesystem changed; content-addressed entries and task-scoped keys keep
it race-safe.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant