Skip to content

improve(docker): shorten release image preparation - #135877

Merged
steipete merged 3 commits into
mainfrom
codex/release-docker-export-speed
Sep 2, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/release-docker-export-speed

Conversation

@steipete

@steipete steipete commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Docker release preparation spends time copying an already-installed production dependency tree, compressing image layers, and transferring a remote build cache with little useful reuse. The fresh baseline took 14m13s. This follows #135832, which reduced the previously much larger full-stage cache export.

Why This Change Was Made

Runtime assembly now inherits production dependencies and overlays build output after removing development dependencies. The stamped release manifest arrives with the output, eliminating the separate version-restoration copy. Both fresh frozen installs remain; compiled workspaces, generated plugin assets, nested runtime dependencies, native lifecycle output and the SDK bridge remain covered.

Both OCI exporters use gzip level 1 for newly compressed layers. This retains the existing Skopeo transport and digest-preserving promotion. Existing compressed blobs are reusable without forced recompression. The measured tradeoff is 12–14% larger combined default/browser artifacts.

The workflow removes both remote GHA cache imports/exports and retains the shared builder's internal cache. In the source-matched warm run, only four default-image setup vertices were cached; both dependency installs and compilation reran. Those setup steps had finished well before runtime assembly in the cold run. All 57 browser cache hits matched work already handled by the preceding default build. Remote exports added serial tail work without demonstrated elapsed-time savings. Docker documents internal caching separately from remote export/import.

User Impact

Source-built images avoid recopying production dependencies. Release preparation also reduces compression work and removes remote cache transfers. Fresh runners rebuild runtime setup, including mutable Debian and npm updates, as existing cold builds already do. The workflow still uses one builder for both variants and retains all OCI, version, dependency, non-root, browser, attestation, sealing and publication checks.

Evidence

Preparation run Source Tooling Elapsed Image checks and seal
Fresh baseline d157f910a295 d157f910a295 14m13s Passed
Assembly change 3b60e6bff745 3b60e6bff745 14m51s Passed
+ gzip level 1 3b60e6bff745 389196db509f 12m48s Passed
Without remote cache 3b60e6bff745 aa861f0c0248 10m29s Passed

The final preparation saved 3m44s (26.3%) against the 14m13s baseline, and 2m19s (18.1%) against the gzip run with remote caching. All four exports have no remote cache arguments or cache-export phase; both browser solves retained 56 local cache hits. These are observed runs, not a guaranteed duration.

The replacement copy fell from 32.9s to 6.9s on amd64 and 30.4s to 5.3s on arm64. Assembly alone did not improve whole-run time: longer cache uploads outweighed that saving. Gzip reduced default layer export from 85.1s to 33.1s on amd64 and 57.6s to 26.0s on arm64. Combined default/browser OCI artifacts grew from 2.62 to 2.98 GB on amd64 (+13.5%) and 2.64 to 2.96 GB on arm64 (+12.5%); these include duplicated shared blobs and are not individual image sizes.

The assembly/gzip/cache comparisons freeze application source at 3b60e6bf and change workflow tooling. The first comparison changes the Dockerfile on the baseline source. All use version v2026.8.1, diagnostics-otel,codex, native 4-CPU GitHub runners, and the same Buildx/BuildKit versions; normal build timestamps vary. Completed default solves had zero cached vertices, and the browser variants reused the same-job builder. The final run imports no remote cache. Full workflow time includes setup, uploads and cleanup; component timings are not sums of overlapping BuildKit work. No package, registry image or release is published by these runs.

45 focused Docker/plugin tests and 139 release artifact/workflow tests passed. The executable assembly fixture covers both plugin-directory names, production native files and metadata, nested dependencies, the workspace link, generated SDK assets, and a correction version differing from the production manifest. CI caught TS18048 in its optional regex capture; the guard is fixed, all 34 Dockerfile tests pass again, and the exact failed core-test stripe passes.

Workflow validators, formatting and diff checks pass, and Codex autoreview is scoped-clean at the default P0 threshold. CI on the gzip head passed 204 jobs; final-head CI also passed all 204 selected jobs. The final native preparation passed both architectures, both variants, OCI checks and sealing. This completes the latest ClawSweeper timing/image evidence request; a refresh for the remote-cache change was requested before landing.

The successful gzip run recorded recovered BuildKit cache-write messages. Both it and the final run recorded a non-fatal amd64 builder-volume cleanup timeout after image validation/upload; those 20 seconds remain included in the timings, and both architecture jobs plus sealing passed. Default smoke exercises workspace bootstrap without provider credentials; it does not prove an authenticated provider turn. The Matrix native-addon check is outside this selected-plugin matrix.

Production build/workflow delta: +15/-17 lines; tests: +29/-26; docs: +15/-8. No new runtime/configuration surface.

The latest ClawSweeper review has no code findings. Its timing and sealing requests are satisfied by the completed run above. The application source stayed frozen for comparison: it contains the byte-identical changed Dockerfile, while tooling is the final PR head. An additional native run for the intervening docs/test changes is unnecessary; final-head CI passed. The reviewer environment's upstream/main access gap was covered by direct Docker/BuildKit contract inspection and a current-main comparison of all five changed paths. The documented artifact-size tradeoff is accepted for the requested preparation speedup.

Follow-up

Standalone partial Docker reruns need separate recovery proof: resolve records an artifact name for its attempt, while sealing validates current-attempt metadata. This pre-existing source-identified coupling is unchanged here; all measurements use fresh workflow dispatches.

The repeated amd64 Buildx volume-cleanup timeout is a separate upstream cleanup follow-up; the measured preparation result includes it.

@clawsweeper

clawsweeper Bot commented Sep 2, 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 docker Docker and sandbox tooling size: S maintainer Maintainer-authored PR labels Sep 2, 2026
@steipete
steipete marked this pull request as ready for review September 2, 2026 03:56
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 12:43 AM ET / 04:43 UTC.

ClawSweeper review

What this changes

The PR speeds Docker release preparation by reusing the production dependency layer, exporting OCI images with fast gzip, and removing remote GitHub Actions build-cache transfers.

Merge readiness

⚠️ Ready for maintainer review - 5 items remain

Keep open for maintainer review. No concrete defect is visible in the introduced Docker stage or workflow wiring, but the exact-head two-architecture OCI preparation and sealing results are still incomplete and the artifact-size/performance tradeoff needs acceptance.

Priority: P3
Reviewed head: aa861f0c0248634178f9ee24000242144ebc3d6d
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation is focused and contract-aware, but exact-head native preparation and sealing evidence is still pending.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository State identifies this as a maintainer-authored PR, so the external-contributor proof gate does not apply; the in-progress hosted OCI smoke and sealing results remain the relevant release-path validation.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository State identifies this as a maintainer-authored PR, so the external-contributor proof gate does not apply; the in-progress hosted OCI smoke and sealing results remain the relevant release-path validation.
Evidence reviewed 7 items Runtime assembly owner: The new runtime-assets stage inherits production-deps and overlays dependency-free build output; the final image copies its runtime files exclusively from that stage.
Release workflow consumer: Both native image variants use the changed OCI exporter settings before the existing artifact preparation and sealing steps.
Publication boundary retained: The later Docker Release workflow invokes preparation without publication permissions; registry write remains confined to its publication job.
Findings None None.
Security None None.

How this fits together

Docker release preparation builds default and browser OCI images for both native architectures, validates and seals them, then supplies the sealed artifacts to the separate publication workflow. The changed runtime-assets stage supplies the final image's compiled application files and production dependencies.

flowchart LR
  A[Release source and metadata] --> B[Docker release preparation]
  B --> C[Production dependency image]
  B --> D[Compiled build output]
  C --> E[Runtime image assembly]
  D --> E
  E --> F[OCI smoke and attestation checks]
  F --> G[Sealed publication artifacts]
Loading

Decision needed

Question Recommendation
After the exact-head native preparation and sealing jobs pass, should release owners accept the measured OCI artifact-size increase in exchange for shorter preparation work? Accept after sealed native proof: Land after both exact-head architecture jobs and the sealing job succeed and maintainers accept the documented artifact-size tradeoff.

Why: The code preserves the existing authority boundary and targeted assembly contract, but the release-path performance versus artifact-size tradeoff is operational policy rather than a purely mechanical correctness choice.

Before merge

  • Resolve merge risk (P1) - Until the exact-head amd64 and arm64 OCI smoke and sealing jobs complete successfully, the changed Buildx exporter and runtime-image integration path remains unverified.
  • Resolve merge risk (P1) - The PR intentionally trades roughly 12–14% larger combined OCI artifacts for less release-preparation work; release owners should accept that operational tradeoff after the exact-head results.
  • Resolve merge risk (P1) - The checkout is blob-filtered and GitHub/Docker upstream access was unavailable because DNS resolution failed, so independent upstream Buildx exporter-contract inspection and a full current-main reread could not be completed in this review environment.
  • Complete next step (P2) - Exact-head native OCI preparation and sealing are still running, and release owners must accept the documented artifact-size tradeoff before merge.
Agent review details

Security

None.

PR surface

Tests +3, Docs +7, Config -3, Other +1. Total +8 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 29 26 +3
Docs 2 15 8 +7
Config 1 6 9 -3
Generated 0 0 0 0
Other 1 9 8 +1
Total 5 59 51 +8

Review metrics

Metric Value Why it matters
Production versus test delta production -2 lines; tests +3 lines; docs +7 lines The runtime/workflow change is net smaller while focused coverage expands the two plugin-directory and release-version assembly cases.

Merge-risk options

Maintainer options:

  1. Require sealed native results (recommended)
    Wait for the current exact-head amd64 and arm64 OCI smoke checks plus sealing to pass before merging the compression and assembly changes.
  2. Accept the release tradeoff
    After successful native results, accept the documented larger OCI artifacts if shorter preparation is the preferred release-operations outcome.

Technical review

Best possible solution:

Retain the single production-dependency base plus dependency-free build overlay, and land it only after exact-head native smoke/seal evidence confirms the compressed OCI artifacts preserve the existing release contract.

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

Not applicable: this PR changes release-image preparation performance rather than reporting a user-facing defect; the relevant verification is the hosted two-architecture OCI preparation path.

Is this the best way to solve the issue?

Yes, conditionally: inheriting production dependencies and overlaying dependency-free build output removes the redundant tree copy while preserving the existing final-image source boundary; exact-head smoke and sealing evidence remains required.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 54a9f3481d87.

Labels

Label justifications:

  • P3: This is release-preparation performance work, not a user-facing outage or correctness regression.
  • merge-risk: 🚨 compatibility: The Dockerfile changes how existing production dependencies and compiled workspace output are combined into release images.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository State identifies this as a maintainer-authored PR, so the external-contributor proof gate does not apply; the in-progress hosted OCI smoke and sealing results remain the relevant release-path validation.

Evidence

What I checked:

  • Runtime assembly owner: The new runtime-assets stage inherits production-deps and overlays dependency-free build output; the final image copies its runtime files exclusively from that stage. (Dockerfile:185, aa861f0c0248)
  • Release workflow consumer: Both native image variants use the changed OCI exporter settings before the existing artifact preparation and sealing steps. (.github/workflows/docker-release-prepare.yml:179, aa861f0c0248)
  • Publication boundary retained: The later Docker Release workflow invokes preparation without publication permissions; registry write remains confined to its publication job. (.github/workflows/docker-release.yml:151, aa861f0c0248)
  • Assembly contract coverage: The focused test checks both bundled-plugin directory layouts, removes development dependency trees, preserves production native files and workspace links, and verifies the stamped package version survives the overlay. (src/dockerfile.test.ts:447, aa861f0c0248)
  • Introduced scope: The pinned merge-base-to-head diff changes the Dockerfile hand-off, two OCI outputs, their documentation, and the focused Dockerfile test; it is whitespace-clean and has a net production decrease. (Dockerfile:178, aa861f0c0248)
  • Area history: Peter Steinberger has repeatedly maintained Dockerfile behavior, including a pnpm 12 Docker-install change that is an ancestor of fetched main; exact source-line introduction could not be revalidated because promised historical blobs require the unavailable network. (Dockerfile:185, b85a049da5e8)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Publish the completed exact-head hosted OCI smoke/sealing result and comparable timing result.

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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-02T04:04:30.151Z sha 3b60e6b :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T04:18:23.852Z sha 389196d :: needs maintainer review before merge. :: none

@steipete steipete self-assigned this Sep 2, 2026
@steipete steipete changed the title improve(docker): speed up runtime image builds improve(docker): speed up runtime assembly and release export Sep 2, 2026
@steipete steipete changed the title improve(docker): speed up runtime assembly and release export improve(docker): shorten release image preparation Sep 2, 2026
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The final head aa861f0c0248634178f9ee24000242144ebc3d6d also removes the remote GHA build caches. The matched warm run reused only four runtime setup steps, while every browser cache hit was already available from the preceding default build; the shared builder remains in place. The PR body records the measured cache cost and mutable-package/retry tradeoffs.

Final-head CI passed all 204 selected jobs. The assembly and gzip preparations passed both native default/browser image checks and sealing; gzip reduced the whole preparation from 14m51s to 12m48s, with 12–14% larger combined artifacts. The final preparation is finishing with the source frozen at 3b60e6bf and workflow tooling at this exact head. That frozen source contains the identical changed Dockerfile; subsequent differences are workflow, docs and a test type guard. Its completed timing and image/seal results remain the final landing gate.

@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete merged commit 6e5bac0 into main Sep 2, 2026
295 checks passed
@steipete
steipete deleted the codex/release-docker-export-speed branch September 2, 2026 04:52
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 3, 2026
* perf(docker): inherit production dependencies during runtime assembly

* perf(ci): use fast gzip for Docker release export

* perf(ci): avoid unproductive release image cache transfers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Docker and sandbox tooling docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant