Skip to content

fix(docker): keep Telegram runtime dependencies in production images - #125580

Merged
obviyus merged 6 commits into
openclaw:mainfrom
AmAzing129:fix/docker-preserve-runtime-deps
Aug 18, 2026
Merged

obviyus merged 6 commits into
openclaw:mainfrom
AmAzing129:fix/docker-preserve-runtime-deps

Conversation

@AmAzing129

@AmAzing129 AmAzing129 commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #125584.

The official 2026.8.1-beta.2 Docker image could not start Telegram because production dependency pruning removed tr46, then grammY failed with Cannot find module 'tr46'. The package existed after installation and in pnpm metadata, but was absent from the final amd64 and arm64 images. Stable 2026.7.1-2 did not reproduce the failure.

Root Cause

The Docker plugin pruner represented dependency graph nodes by bare package name and always traversed root node_modules. That conflated coexisting pnpm package instances:

The kept traversal selected root node-fetch@3 instead of grammY's nested node-fetch@2, never discovered the retained tr46, and classified it as omitted-plugin-only.

Fix

Resolve each dependency relative to its actual importer. Track physical package instances by realpath. Remove only root package instances reached by the omitted closure and absent from every root, workspace, or retained-plugin closure. All seed paths retain their importer directory, covering version conflicts at both initial and transitive edges.

The Docker build imports grammy after pruning, making any future missing Telegram runtime dependency fail image construction. No direct tr46 dependency, compatibility path, or pruning bypass added.

Production delta: +21 lines net (Dockerfile +1; pruner +20). Test delta: +139 lines net. The production growth is the importer-relative graph identity and resolution boundary required to distinguish coexisting physical package instances.

Evidence

Exact pushed head: 5e6681264458da71b8a12b69785c51481af43e34.

  • Pre-fix owner-boundary reproduction: both new cases fail; pruning incorrectly removes node_modules/kept-transitive and node_modules/tr46.
  • Focused repaired suite: pnpm test src/plugins/prune-docker-plugin-dist.test.ts test/scripts/prune-docker-plugin-dist.test.ts src/dockerfile.test.ts — 44/44 passed across 3 Vitest shards on the exact pushed head.
  • git diff --check — passed.
  • After refreshing from current main, node scripts/check-changed.mjs -- Dockerfile scripts/prune-docker-plugin-dist.mjs src/dockerfile.test.ts src/plugins/prune-docker-plugin-dist.test.ts passed, including formatting, full typecheck, lint, import-cycle, boundary, and dependency checks. The maintainer follow-up only removed an impossible empty-stack guard; the exact pushed head then passed the focused 44-test suite and Docker proof again.
  • Exact-head linux/arm64 runtime-assets image build — passed, including OpenClaw package dist import closure passed.
  • Exact-head image runtime imports:
grammy=/app/node_modules/grammy/out/mod.js
node-fetch=/app/node_modules/grammy/node_modules/node-fetch/lib/index.js
whatwg-url=/app/node_modules/grammy/node_modules/whatwg-url/lib/public-api.js
tr46=/app/node_modules/tr46/index.js
grammy_import=ok
telegram_dist_import=ok

The original reviewed head 19f4de265d7025451dbf84d3239f44d3532198ec also passed an independently built linux/arm64 runtime-assets image with the same package resolutions and runtime imports.

AI-assisted: yes. The dependency resolution, tests, image contents, and runtime imports were reviewed and verified.

@clawsweeper

clawsweeper Bot commented Aug 18, 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 scripts Repository scripts docker Docker and sandbox tooling size: M labels Aug 18, 2026
@AmAzing129
AmAzing129 marked this pull request as ready for review August 18, 2026 04:12
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 18, 2026
@clawsweeper

clawsweeper Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 1:27 AM ET / 05:27 UTC.

ClawSweeper review

What this changes

The Docker dependency pruner now follows each package’s importer-relative resolution path and adds a grammY import smoke check after pruning.

Regression provenance

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

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

This PR remains necessary and appears to repair the Docker pruning owner boundary. No blocking patch defect was found; retain the exact-head runtime-image proof through merge review.

Priority: P1
Reviewed head: 5e6681264458da71b8a12b69785c51481af43e34

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong packaged-runtime proof and focused regression coverage support a bounded owner-boundary repair.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body includes exact-head production-image terminal output showing successful post-prune grammY and Telegram distribution imports.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body includes exact-head production-image terminal output showing successful post-prune grammY and Telegram distribution imports.
Evidence reviewed 7 items Current-main defect: Current main represents the retained closure by package name and resolves every dependency from root node_modules, so coexisting physical package versions cannot be distinguished.
Repair boundary: The PR resolves dependency names from the importing directory, tracks canonical physical package directories, and only removes root package instances not present in the retained closure.
Dependency graph contract: The locked graph contains node-fetch 2.7.0 -> whatwg-url 5.0.0 -> tr46 0.0.3, while the Telegram bundled plugin declares grammY as a runtime dependency.
Findings None None.
Security None None.

Live Verification

Command: docker build --target runtime-assets -t openclaw-runtime-assets:pr .

Result: FAIL (partial)

docker build --target runtime-assets -t openclaw-runtime-assets:pr .
runner@runnervmzvulz:~/work/clawsweeper/clawsweeper/target-pr$ docker build --target runtime-assets -t openclaw-runtime-assets:pr .
docker build --target runtime-assets -t openclaw-runtime-assets:pr .
[+] Building 30.9s (27/36)                                                                                                                       docker:default
 =› =› extracting sha256:1d16e26333c51d432a005b1249d1dd1a284f6a5c90d0a790faee640b80beebf6                                                                  0.0s
 =› =› extracting sha256:2a516ff37099f6fc33f10fbab37ba28cecd78d7af3be45747dd0bcab7916ad60                                                                  2.0s
 =› =› extracting sha256:1b351d1b9ffdc0cd1381bd8884a78f6d3c120aecd002deec6cabb8caca1c9704                                                                  0.0s
 =› =› extracting sha256:7bf355e8dbdb6fb1a8ce3ce927e3d70077a0c0a6cd94705f24fa2bfe114c7148                                                                  0.0s
 =› [internal] load build context                                                                                                                          5.7s
 =› =› transferring context: 363.56MB                                                                                                                      5.6s
 =› [bun-binary 1/1] FROM docker.io/oven/bun:1.3.14@sha256:e10577f0db68676a7024391c6e5cb4b879ebd17188ab750cf10024a6d700e5c4                                9.2s
 =› =› resolve docker.io/oven/bun:1.3.14@sha256:e10577f0db68676a7024391c6e5cb4b879ebd17188ab750cf10024a6d700e5c4                                           0.0s
 =› =› sha256:e10577f0db68676a7024391c6e5cb4b879ebd17188ab750cf10024a6d700e5c4 1.61kB / 1.61kB                                                             0.0s
 =› =› sha256:50317d83cd5a5ae1d8b35b3379c69f57ce1a0dbf4def91f0965653d767851834 1.43kB / 1.43kB                                                             0.0s
 =› =› sha256:59cef0f85ea477b70c4d6428d4a986d4fced461012f46a745fa15d19a523b56f 3.84kB / 3.84kB                                                             0.0s
 =› =› sha256:ca84d48c60efb21cccddf0a95b9031873bfbd39005fdfbd527db491223667d9b 294B / 294B                                                                 0.9s
 =› =› sha256:307f8152a55ef1e9eeb1acbbee7bc81232615329eaeb00d8dd93b46be297f34c 49.30MB / 49.30MB                                                           1.3s
 =› =› sha256:fb0bca77592deb00348bede92ee8ec62b619f7f922857e5c4c1a09adb74b61d3 36.61MB / 36.61MB                                                           1.6s
 =› =› sha256:2cd732119d01b01fb8a0e7c8410a43170a41fca0ab4a7bd1ab58ac09165f7540 185B / 185B                                                                 1.6s
 =› =› sha256:ababeddb66900f6e369fbfb251c243c1ae82b782cf7d7786d373d980819eb7c8 3.40kB / 3.40kB                                                             1.6s
 =› =› sha256:553e58e1f15834fedea8a2294706dcc12d7201f7d2c3405c3f2e4fb7048c7a05 139B / 139B                                                                 1.7s
 =› =› extracting sha256:307f8152a55ef1e9eeb1acbbee7bc81232615329eaeb00d8dd93b46be297f34c                                                                  4.0s
 =› =› extracting sha256:ca84d48c60efb21cccddf0a95b9031873bfbd39005fdfbd527db491223667d9b                                                                  0.0s
 =› =› extracting sha256:fb0bca77592deb00348bede92ee8ec62b619f7f922857e5c4c1a09adb74b61d3                                                                  1.5s
 =› =› extracting sha256:2cd732119d01b01fb8a0e7c8410a43170a41fca0ab4a7bd1ab58ac09165f7540                                                                  0.0s
 =› =› extracting sha256:ababeddb66900f6e369fbfb251c243c1ae82b782cf7d7786d373d980819eb7c8                                                                  0.0s
 =› =› extracting sha256:5
… output truncated …

Assertions:

  • FAIL expect_output: OpenClaw package dist import closure passed
  • FAIL expect_output: grammy_import=ok

How this fits together

OpenClaw’s Docker runtime-assets stage removes packages only needed by omitted bundled plugins before copying dependencies to the production Gateway image. That pruning must preserve every package a retained bundled channel needs when it loads.

flowchart LR
  A[Installed packages] --> B[Docker runtime-assets stage]
  B --> C[Dependency pruner]
  C --> D[Importer-relative closure]
  D --> E[grammY import smoke check]
  E --> F[Gateway production image]
Loading

Before merge

  • Resolve merge risk (P1) - Production pruning grows by 21 net lines in a destructive packaging path; the physical-package identity is justified because a name-only closure cannot represent the locked concurrent dependency branches.
  • Resolve merge risk (P1) - Node resolver documentation/source was unavailable to this read-only worker after network resolution failed, so merge review should retain the Node-backed regression cases and submitted packaged-image trace as the contract evidence.
  • Complete next step (P2) - Normal maintainer merge review should retain the resolved-head Docker smoke proof; no mechanical repair is currently indicated.
Agent review details

Security

None.

PR surface

Tests +139, Other +21. Total +160 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 140 1 +139
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 64 43 +21
Total 4 204 44 +160

Review metrics

Metric Value Why it matters
Production versus test delta production +64/-43 (net +21); tests +140/-1 (net +139) The production growth is bounded to importer-aware package identity; the larger test change covers nested and hoisted dependency-resolution regressions.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #125584
Summary: This PR is the concrete candidate fix for the linked production-image dependency omission.

Members:

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

Merge-risk options

Maintainer options:

  1. Validate the resolved runtime image (recommended)
    Run the runtime-assets Docker build and post-prune grammY import smoke check on the resolved head before merging.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Validate the resolved head with the runtime-assets Docker build and post-prune grammY import smoke check.

Technical review

Best possible solution:

Keep one importer-relative physical-package closure in the pruner and verify the resolved production image still imports grammY after pruning.

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

Yes—source-reproducible: current main’s root-only closure conflicts with the locked nested grammY dependency graph, and the linked report supplies a packaged-image reproduction path. I did not execute contributor code in this read-only review.

Is this the best way to solve the issue?

Yes—the pruner owns package retention, and importer-relative realpath identity fixes the conflation without adding a dependency override, runtime fallback, or Telegram-specific exception.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: Affected production images can leave the bundled Telegram channel unavailable when the Gateway starts.
  • merge-risk: 🚨 compatibility: The PR changes which installed package instances survive production-image pruning.
  • merge-risk: 🚨 availability: An incorrect retained closure can prevent a bundled channel from importing at Gateway startup.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes exact-head production-image terminal output showing successful post-prune grammY and Telegram distribution imports.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes exact-head production-image terminal output showing successful post-prune grammY and Telegram distribution imports.

Evidence

What I checked:

  • Current-main defect: Current main represents the retained closure by package name and resolves every dependency from root node_modules, so coexisting physical package versions cannot be distinguished. (scripts/prune-docker-plugin-dist.mjs:71, c5c8a1e4c03f)
  • Repair boundary: The PR resolves dependency names from the importing directory, tracks canonical physical package directories, and only removes root package instances not present in the retained closure. (scripts/prune-docker-plugin-dist.mjs:60, 5e6681264458)
  • Dependency graph contract: The locked graph contains node-fetch 2.7.0 -> whatwg-url 5.0.0 -> tr46 0.0.3, while the Telegram bundled plugin declares grammY as a runtime dependency. (pnpm-lock.yaml:14709, c5c8a1e4c03f)
  • Regression coverage: The new tests model both a kept plugin’s nested version and the grammY/node-fetch/whatwg-url/tr46 conflict, then use Node’s createRequire path to verify the retained runtime import. (src/plugins/prune-docker-plugin-dist.test.ts:197, 5e6681264458)
  • Packaged behavior proof: The PR body records an exact-head linux/arm64 runtime-assets build and successful post-prune grammY and Telegram distribution imports. (5e6681264458)
  • Feature provenance: The Docker omitted-plugin dependency pruner appears to date to the original runtime-pruning change, with later history continuing to maintain this script and its tests. (scripts/prune-docker-plugin-dist.mjs:145, 23c58081d062)

Likely related people:

  • Vincent Koc: History identifies the original Docker omitted-plugin runtime-dependency pruning change. (role: feature introducer; confidence: high; commits: 23c58081d062; files: scripts/prune-docker-plugin-dist.mjs, src/plugins/prune-docker-plugin-dist.test.ts)
  • Peter Steinberger: Recent main history shows repeated Docker runtime and packaging maintenance across the Dockerfile and its tests. (role: recent adjacent contributor; confidence: medium; commits: 8190c326ce49, d5a374070794; files: Dockerfile, src/dockerfile.test.ts)

Rank-up moves

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

  • Retain the runtime-assets import smoke proof on the resolved merge head.

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.

@AmAzing129

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 18, 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:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 18, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Aug 18, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Aug 18, 2026
@AmAzing129

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 18, 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:

@obviyus obviyus self-assigned this Aug 18, 2026
@obviyus
obviyus merged commit fc2529e into openclaw:main Aug 18, 2026
239 of 241 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 20, 2026
…w#125580)

Resolve retained dependency closures from each physical importer so Docker pruning preserves concurrent nested package versions required at runtime.

Add importer-bound regressions and a post-prune grammY import gate.

Co-authored-by: AmAzing129 <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Docker and sandbox tooling merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: M 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.

[Bug]: Source-built runtime omits tr46, breaking Telegram during Gateway startup

2 participants