Skip to content

fix(ci): stop rebuilding dependencies from stale snapshots - #123040

Merged
steipete merged 1 commit into
mainfrom
amp/ci-immutable-dependency-cache
Aug 13, 2026
Merged

steipete merged 1 commit into
mainfrom
amp/ci-immutable-dependency-cache

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #122913

What Problem This Solves

Fixes canonical main and same-repository pull request CI repeatedly rebuilding pnpm dependencies because Blacksmith acknowledged mutable StickyDisk commits but later runs continued restoring an empty or stale filesystem.

Why This Change Was Made

Replace the failed mutable dependency snapshot with one exact immutable actions/cache archive containing root node_modules and a workspace-local pnpm store. Preflight is the sole writer; every same-repo Blacksmith Node consumer waits for it, uses the same semantic fingerprint key, and falls back to the ordinary pnpm-store cache on a miss. Fork, manual, and hosted retry paths remain on the ordinary cache, and canonical CI does not delegate to Crabbox or Testbox.

The two trees are archived together so GNU tar preserves pnpm hard links. Exact restores still run frozen reconciliation; failed or partial restores are cleared before fallback, and failed reconciliation progressively relinks from the restored store and then retries from an empty store.

User Impact

Canonical CI can reuse an immutable dependency tree instead of serializing every Node-relevant run behind the same cold rebuild. Coverage, runner fanout, shard ownership, and trust routing are unchanged.

Evidence

  • Root cause: six serialized canonical-main preflights rebuilt about 12.96 GiB under the same v7 StickyDisk key, reported successful commits, and later restored an approximately 12 KiB empty filesystem: issue evidence.
  • Behavioral owner test starts a local registry, installs into the workspace-local store, archives/restores node_modules and the store together, stops the registry, and proves offline importer relinking with preserved hard-link identity (reused 1, downloaded 0).
  • Focused validation: 389/389 workflow/dead-code/routing tests pass; the post-format workflow guard rerun passes 116/116; two touched package-workflow contracts pass; workflow lint/zizmor, docs inventory, formatting, and git diff --check pass.
  • Full local pnpm test exercised all 12 top-level shards. Unrelated orb limitations remained: one loopback/LAN-isolation test fails under the orb network model (exact rerun: 15,511 pass, 34 skip, 1 failure), package-workflow cases require missing zip/a newer jq, and the broad extensions config reached its existing 15-minute no-output watchdog. No affected cache-owner test failed.
  • Current local dependency trees compress to an estimated 3.578 GiB in 42 seconds. Blacksmith documents 25 GB free cache storage per repository per week; hosted exact-head CI must confirm the real save/restore size, timings, and quota behavior before landing.
  • Independent read-only review found no blocking findings and judged the immutable cache the best owner-boundary repair. Bundled autoreview's TruffleHog scan passed, but its Codex executable is unavailable in this orb.

No Crabbox or Testbox execution was used.

@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: XL maintainer Maintainer-authored PR labels Aug 13, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 13, 2026
@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 13, 2026, 3:23 AM ET / 07:23 UTC.

ClawSweeper review

What this changes

This PR replaces the mutable Blacksmith dependency snapshot with an exact Actions cache for root dependencies and the pnpm store, restored by CI preflight and downstream Node jobs.

Regression provenance

Possible regression — probable (reproduction; failure trace). No predecessor PR is attributed.

Merge readiness

⛔ Blocked by patch quality or review findings - 6 items remain

Keep open. The immutable-cache replacement is a coherent fix for the linked StickyDisk regression, but allowing every same-repository PR to save a multi-gigabyte branch-scoped archive can evict the canonical main cache and recreate the cold-install problem.

Priority: P2
Reviewed head: 3105488c733ca83e25fde90a0ae4e28f0547d2d5
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The root-cause direction is sound, but the PR's PR-scoped cache writer creates a concrete capacity regression that must be corrected before merge.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored CI PR is exempt from the external-contributor proof gate; exact-head hosted CI remains the appropriate operational validation.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored CI PR is exempt from the external-contributor proof gate; exact-head hosted CI remains the appropriate operational validation.
Evidence reviewed 6 items Current-main behavior: Current main still mounts the mutable StickyDisk only for canonical main preflight, so the linked stale-snapshot problem is not already implemented away.
PR-scoped writer: The proposed preflight condition includes same-repository pull requests and requests an exact-cache save; the saved paths include both node_modules and the workspace-local pnpm store.
Cache-size exposure: The PR body estimates a compressed dependency archive at 3.578 GiB; three distinct PR-scoped archives exceed the official 10 GB repository cache limit before existing caches.
Findings 1 actionable finding [P1] Keep large exact-cache writes off pull-request refs
Security None None.

How this fits together

CI preflight selects validation work, prepares dependency state, then unblocks Blacksmith Node jobs. The changed action supplies the dependency tree each job reconciles before running checks or builds.

flowchart LR
  A[Push or pull request] --> B[CI preflight]
  B --> C[Dependency fingerprint]
  C --> D[Exact dependency cache]
  D --> E[PNPM reconciliation]
  E --> F[Blacksmith Node jobs]
  E --> G[Hosted and fork jobs]
Loading

Decision needed

Question Recommendation
Should same-repository pull requests create 3.578 GiB branch-scoped dependency archives despite the Actions-cache quota and default-branch eviction risk? Keep the exact writer on main only: Remove same-repository pull requests from the exact-cache save condition while retaining their exact restore and pnpm-store miss fallback.

Why: The tradeoff is between PR-local reuse and protecting the canonical main seed; the official cache contract makes the branch-scoping cost concrete, but maintainers own the CI-capacity policy.

Before merge

  • Keep large exact-cache writes off pull-request refs (P1) - The new condition lets every same-repository PR save the full dependency tree. At the stated 3.578 GiB archive size, three PR-scoped entries exceed actions/cache's 10 GB repository quota; those entries cannot seed default-branch CI, and the official action warns they can thrash its cache. Restrict saves to canonical main and retain the store-cache miss path for PRs.
  • Resolve merge risk (P1) - Hosted exact-head CI still needs to show the actual archive size, save/restore timing, and quota behavior after the writer scope is corrected.
  • Complete next step (P2) - A maintainer must choose the cache-writer scope because the remaining blocker is CI-capacity policy, not an ambiguous implementation location.
  • Improve patch quality - Restrict exact cache saves to canonical main.
  • Improve patch quality - Use exact-head CI to confirm main save/restore size and timing after that change.

Findings

  • [P1] Keep large exact-cache writes off pull-request refs — .github/workflows/ci.yml:876-882
Agent review details

Security

None.

PR surface

Tests -219, Docs +2, Config -676, Other -6. Total -899 across 19 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 319 538 -219
Docs 2 34 32 +2
Config 11 168 844 -676
Generated 0 0 0 0
Other 3 0 6 -6
Total 19 521 1420 -899

Review metrics

Metric Value Why it matters
Production versus test delta operational code +168/-849; docs and skill guidance +34/-32; tests and test support +319/-539 The patch is deletion-dominant, but its small added workflow policy controls repository-wide CI dependency reuse.
Exact-cache writer scope 1 preflight writer, expanded from canonical main to canonical main plus same-repository pull requests The additional branch scope is what creates non-shareable large archives and the cache-quota risk.

Stored data model

Persistent data-model change detected: persistent cache schema: .agents/skills/openclaw-ci-limits/SKILL.md, persistent cache schema: .github/actions/setup-node-env/action.yml, persistent cache schema: .github/workflows/ci-check-testbox.yml, persistent cache schema: .github/workflows/ci.yml, persistent cache schema: test/scripts/ci-workflow-guards.test.ts, persistent cache schema: test/scripts/package-acceptance-workflow.test.ts, and 1 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #122913
Summary: This PR explicitly targets the canonical StickyDisk stale-snapshot regression, although its cache-writer scope needs correction.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Restrict the exact cache writer to main (recommended)
    Preserve the immutable cache design but make canonical main the only writer, with same-repository PRs falling back to the normal pnpm-store cache on an exact miss.
  2. Accept PR cache churn with a quota plan
    Retain the PR writer only with hosted evidence that its archives and cleanup policy cannot evict the canonical main cache.

Technical review

Best possible solution:

Keep the exact dependency archive main-only; let same-repository PRs restore the default-branch seed or use the existing pnpm-store fallback on a changed dependency fingerprint.

Do we have a high-confidence way to reproduce the issue?

Yes in source: three branch-scoped archives at the PR's stated 3.578 GiB each exceed the official 10 GB cache limit, while those archives are not reusable by default-branch CI.

Is this the best way to solve the issue?

No. The immutable archive is the right owner-boundary replacement, but its writer should remain canonical-main-only so PR-local caches cannot displace the shared seed.

Full review comments:

  • [P1] Keep large exact-cache writes off pull-request refs — .github/workflows/ci.yml:876-882
    The new condition lets every same-repository PR save the full dependency tree. At the stated 3.578 GiB archive size, three PR-scoped entries exceed actions/cache's 10 GB repository quota; those entries cannot seed default-branch CI, and the official action warns they can thrash its cache. Restrict saves to canonical main and retain the store-cache miss path for PRs.
    Confidence: 0.95

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1d45930162ca.

Labels

Label changes:

  • add P2: This is a bounded CI reliability repair with repository-wide validation latency impact but no released runtime failure.
  • add merge-risk: 🚨 automation: The patch changes the shared preflight dependency-cache writer used before CI fanout, and its PR write scope can evict canonical CI caches.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored CI PR is exempt from the external-contributor proof gate; exact-head hosted CI remains the appropriate operational validation.

Label justifications:

  • P2: This is a bounded CI reliability repair with repository-wide validation latency impact but no released runtime failure.
  • merge-risk: 🚨 automation: The patch changes the shared preflight dependency-cache writer used before CI fanout, and its PR write scope can evict canonical CI caches.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored CI PR is exempt from the external-contributor proof gate; exact-head hosted CI remains the appropriate operational validation.

Evidence

What I checked:

  • Current-main behavior: Current main still mounts the mutable StickyDisk only for canonical main preflight, so the linked stale-snapshot problem is not already implemented away. (.github/actions/setup-node-env/action.yml:125, 1d45930162ca)
  • PR-scoped writer: The proposed preflight condition includes same-repository pull requests and requests an exact-cache save; the saved paths include both node_modules and the workspace-local pnpm store. (.github/workflows/ci.yml:876, 3105488c733c)
  • Cache-size exposure: The PR body estimates a compressed dependency archive at 3.578 GiB; three distinct PR-scoped archives exceed the official 10 GB repository cache limit before existing caches. (.github/actions/setup-node-env/action.yml:367, 3105488c733c)
  • Actions cache contract: The locally installed official actions/cache source states that caches are branch-scoped, only default-branch caches are shared to other branches, and the repository limit is 10 GB; it specifically warns that PR caches can thrash default-branch caches.
  • Failure handling and sibling coverage: The guard test requires one preflight writer, preflight dependencies for every listed consumer, no prefix restore, and a local archive/offline relink scenario. (test/scripts/ci-workflow-guards.test.ts:2969, 3105488c733c)
  • Area provenance: Blame attributes the pre-existing setup-action surface to Peter Steinberger and the new cache inputs to the PR commit; available history establishes shared ownership but not a predecessor PR for the regression. (.github/actions/setup-node-env/action.yml:34, 05ffeee016f0)

Likely related people:

  • steipete: Peter Steinberger authored the current-main setup-action baseline and is also driving the linked cache-regression repair. (role: recent CI cache owner; confidence: high; commits: 05ffeee016f0; files: .github/actions/setup-node-env/action.yml, .github/workflows/ci.yml)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete force-pushed the amp/ci-immutable-dependency-cache branch 2 times, most recently from 68771f6 to 16a30e9 Compare August 13, 2026 07:35
@steipete
steipete force-pushed the amp/ci-immutable-dependency-cache branch from 16a30e9 to ba1eecd Compare August 13, 2026 07:43
@steipete steipete self-assigned this Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready proof for exact head ba1eecd1151592cb1f22591d04e4f0cc38318f24:

  • CI run 31678949987 completed successfully; openclaw/ci-gate and all required compact Node jobs passed.
  • Preflight job 94379854329 completed in 1m13s with exact key openclaw/openclaw-node-deps-v2-os-Linux-arch-X64-node-v24.19.0-v2-dde16eada6a88e27a364f9663c2e5a6d04995a1e299b45584d14d4572dd9dc64.
  • The final importer-complete archive is 1,201,753,877 bytes (~1.12 GiB). Consumer job 94380136655 restored it in roughly 12 seconds, then completed frozen offline reconciliation with Already up to date, reused 0, and downloaded 0.
  • The behavioral owner test archives/restores the real importer trees and workspace-local pnpm store together, stops its local registry, proves offline relinking, and verifies pnpm hard-link identity. Workflow guards passed 116/116; root test typing, workflow validation, docs inventory, formatting, and git diff --check passed.
  • The full local suite exercised all 12 top-level shards; its remaining failures were orb/tooling-specific (LAN isolation, unavailable zip/jq compatibility, and the existing extensions watchdog). The exact-head hosted full CI is green.
  • Final independent review after the v2 importer-tree correction found no blocking or nonblocking findings. The bundled autoreview secret scan passed, but no Codex/Claude/Pi review executable is installed in this orb; no result was invented.

ClawSweeper's reviewed-head writer-scope concern was evaluated rather than silently skipped. The 3.578 GiB local estimate it used did not match hosted reality: the complete archive is ~1.12 GiB. Blacksmith transparently backs actions/cache, currently documents 25 GB free per repository per week, branch-protected caches, and LRU expiry for entries not used for more than seven days: https://docs.blacksmith.sh/blacksmith-caching/dependencies-actions. Unchanged-fingerprint PRs restore the default-branch entry and do not save because the exact cache hits; only a trusted same-repository dependency-changing PR can publish one merge-ref-scoped miss so its downstream jobs avoid independent cold installs. Keeping that bounded writer is intentional.

The repository-native prepare gate reused this exact hosted run (hosted_exact_or_recent_parent); it launched neither Testbox nor Crabbox. Canonical PR/main CI contains no Crabbox/Testbox delegation, adds no fanout, and removes no coverage.

@steipete
steipete merged commit 3b6e540 into main Aug 13, 2026
110 checks passed

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete
steipete deleted the amp/ci-immutable-dependency-cache branch August 13, 2026 08:13

Copy link
Copy Markdown
Contributor Author

Post-land verification completed on exact squash commit 3b6e54041f1898e13f6fd0e313e2f9169d041668:

  • Canonical main CI run 31681118857 completed success; openclaw/ci-gate passed. The run had 63 successful jobs and 10 intentional skips.
  • Preflight job 94387788645 started after the previous canonical single-flight run finished. Because the squash commit changed the fingerprint helper itself, it correctly took the one-time cold path: pnpm installed in 20.2s, then the exact archive saved 1,203,589,855 bytes in 9.7s under the expected v2 key.
  • Downstream job 94388150387 restored that exact archive (~1148 MB) in about 14.2s, then completed frozen reconciliation with reused 4, downloaded 0; it did not attempt to save the dependency archive.
  • Unchanged-fingerprint descendant main run 31682258389 also completed success; openclaw/ci-gate passed. Preflight job 94390281504 restored the same exact archive, reconciled in 2.6s with downloaded 0, and skipped both exact-cache and pnpm-store saves. That proves the steady-state warm no-publication path.

This removes the repeated 5m35s mutable-snapshot rebuild/promotion failure from the canonical path. No fanout or coverage changed. No Crabbox or Testbox was launched or delegated by this work; the unrelated Blacksmith Testbox workflow visible at the landed SHA was dispatched independently by blacksmith-sh[bot], not by canonical CI or the repository-native prepare gate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: v6 dependency snapshot keeps restoring its original stale generation

2 participants