Skip to content

fix(skills): bound installer downloads - #81818

Closed
afurm wants to merge 1 commit into
openclaw:mainfrom
afurm:af/cap-skill-download-size
Closed

afurm wants to merge 1 commit into
openclaw:mainfrom
afurm:af/cap-skill-download-size

Conversation

@afurm

@afurm afurm commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #81817.

The skill installer streamed remote download responses directly into
.openclaw-download-staging without a byte limit. A remote skill download could
therefore become an unbounded local disk write when the server omitted or lied
about Content-Length.

Why This Change Was Made

The owning boundary is src/skills/lifecycle/install-download.ts, reached by
installSkill() before copy or archive extraction. The previous PR
implementation targeted the former src/agents/skills-install-download.ts
location; that stale path is not carried forward.

The canonical repair:

  • caps skill installer downloads at 256 MiB;
  • reuses parseMediaContentLength for strict advertised-size validation;
  • cancels response bodies rejected by malformed or oversized lengths;
  • streams through one byte-counting Transform so headerless and misleading
    responses cannot exceed the same limit;
  • keeps cleanup in the downloader's existing finally path; and
  • documents the operator-visible limit.

No fallback downloader, compatibility shim, or duplicate policy remains.

User Impact

Oversized skill downloads now fail before they can consume unbounded disk
space. Partial staging files are removed, and the installer returns the size
limit in its error.

Production delta: +60/-7, net +53. The growth establishes the download
security boundary at its lifecycle owner and a small internal test seam that
proves streamed overflow without allocating the production-sized limit. Tests
are counted separately.

Maintainer Decision

Accepted the documented 256 MiB compatibility boundary. It is deliberately generous for skill packages, closes the unbounded disk-write class, and returns an explicit operator-visible error.

Evidence

Validated exact head:
e3320ba98cfc6b3772162ecadb56c80c28850c4f

  • Signed maintainer rebase onto 1f3d45b76f51298699423b8a3331b42b6d51b962
    preserved Andrii Furmanets co-author credit. Later main drift through
    72fd25d47d1d5ae772de8af052623cc869bf2af0 had no touched-path overlap and
    produced a clean merge tree, so the reviewed head was not churned again.

  • Post-rebase node scripts/run-vitest.mjs src/skills/lifecycle/install-download.test.ts -- --reporter=verbose passed 10/10 tests; git diff --check passed.

  • Failure-first on current main: both an advertised 268435457-byte response
    and a headerless 268435463-byte stream returned ok: true.

  • node scripts/run-vitest.mjs src/skills/lifecycle/install-download.test.ts packages/media-core/src/content-length.test.ts -- --reporter=verbose
    passed 25/25 tests.

  • A second focused owner run covering
    src/skills/lifecycle/install-download.test.ts and
    src/skills/lifecycle/install.test.ts passed 16/16 tests.

  • The streamed-overflow integration test uses a 7-byte partial chunk and a
    2-byte overflow against an injected 8-byte limit. It asserts that pipeline
    destroys the still-open upstream stream, installs nothing, and removes the
    partial staging file.

  • Direct oxfmt, focused oxlint, node scripts/docs-list.js, and
    git diff --check: passed.

  • Fresh exact-branch autoreview: no accepted or actionable findings; patch
    correct at 0.99 confidence.

Real installer-boundary proof used a real loopback node:http server and native
fetch/Response streaming while leaving production download, staging, copy,
limit, and cleanup code unmodified:

  • Advertised Content-Length: 268435457 failed with
    download too large: 268435457 bytes (limit: 268435456 bytes);
    response closed, no install occurred, and staging was empty.
  • A headerless chunked response created a real nonempty partial staging file,
    then crossed the limit at 268435463 bytes and failed with
    download too large: 268435463 bytes (limit: 268435456 bytes);
    the response closed, no install occurred, and cleanup removed every staging
    entry.
  • Runtime proof suite: 2/2 passed.

The shared TUI PTY scheduler repair landed on main as
17ef7771a66d21af51d26558a9a01ec7d01a227d. This branch includes that
repair; fresh exact-head hosted CI and ClawSweeper review are running.

Punchcard-Session: cobalt-brook-meadow-m9

@openclaw-barnacle openclaw-barnacle Bot added triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. docs Improvements or additions to documentation agents Agent runtime and tooling size: S labels May 14, 2026
@afurm
afurm marked this pull request as ready for review May 14, 2026 13:43
@clawsweeper

clawsweeper Bot commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

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

ClawSweeper review

What this changes

The PR rejects remote skill-installer downloads above 256 MiB through strict header validation and streamed-byte counting, with cleanup coverage and documentation.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open: current main still writes skill downloads without a size bound, and this PR places one at the lifecycle owner with no actionable correctness finding. A maintainer should explicitly accept the documented 256 MiB compatibility boundary before merge.

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

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) The patch repairs the owner boundary with direct runtime proof, targeted cleanup coverage, and no supported correctness finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides after-fix loopback HTTP and native streaming output for advertised and headerless overflow, including response closure, no install, and cleanup; no private data is shown.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides after-fix loopback HTTP and native streaming output for advertised and headerless overflow, including response closure, no install, and cleanup; no private data is shown.
Evidence reviewed 8 items Current-main defect: The current lifecycle downloader sends the response stream directly to the staging-file pipeline with no advertised-size check or streamed-byte limit.
Entry point and owner boundary: Every download install spec is dispatched to this lifecycle downloader before copy or archive extraction.
Proposed enforcement: The PR validates the Content-Length before opening the output stream and unconditionally counts stream chunks before the staged artifact can be copied.
Findings None None.
Security None None.

How this fits together

The skill installer fetches remote artifacts into temporary staging before copying or extracting them into a skill’s tools directory. This change bounds that staging download so a remote response cannot consume unbounded local disk.

flowchart LR
  A[Skill install request] --> B[Remote artifact response]
  B --> C[Download and staging boundary]
  C --> D{Within 256 MiB?}
  D -->|Yes| E[Staged artifact]
  E --> F[Copy or extract skill]
  D -->|No| G[Cancel response and clean staging]
Loading

Decision needed

Question Recommendation
Should OpenClaw accept a hard 256 MiB limit for existing remote skill artifacts, requiring larger artifacts to be repackaged? Accept the documented cap: Merge with the 256 MiB hard limit and visible error because it bounds disk use while retaining normal installer flow for ordinary artifacts.

Why: Current main has no limit, so this security boundary deliberately changes the outcome for a class of existing remote artifacts; source review cannot establish operator prevalence or product acceptance.

Before merge

  • Resolve merge risk (P1) - The intentional 256 MiB cap changes existing behavior for any operator whose remote skill artifact exceeds that size; the repository evidence cannot establish how common those artifacts are.
  • Complete next step (P2) - The implementation PR is already present and has no mechanical repair finding; the remaining blocker is maintainer acceptance of its compatibility boundary.
Agent review details

Security

None.

PR surface

Source +53, Tests +130, Docs +1. Total +184 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 60 7 +53
Tests 1 131 1 +130
Docs 1 2 1 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 193 9 +184

Review metrics

Metric Value Why it matters
Production versus test LOC production +53 net; tests +130 net The production growth establishes the download security boundary at its lifecycle owner, while the larger test delta exercises advertised and streamed overflow cleanup.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #81817
Summary: This PR is the concrete candidate repair for the linked unbounded skill-installer download report.

Members:

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

Merge-risk options

Maintainer options:

  1. Accept the documented 256 MiB boundary (recommended)
    Merge after accepting that existing remote artifacts above 256 MiB now fail with a clear size-limit error.
  2. Adjust the supported artifact limit
    Choose and document a different fixed maximum if the compatibility impact of 256 MiB is unacceptable.

Technical review

Best possible solution:

Retain one documented 256 MiB limit at the lifecycle downloader, preserving the existing cleanup path, once the compatibility boundary is accepted and exact-head gates settle.

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

Yes—current main is source-reproducible because the sole download-installer path directly pipelines an arbitrary response to staging without a byte bound. The PR body also supplies after-fix loopback HTTP evidence for advertised and headerless overflow cases.

Is this the best way to solve the issue?

Yes—the lifecycle downloader is the narrowest owner because every download spec reaches it before copying or extraction; downstream archive limits cannot prevent the initial unbounded write.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a focused installer hardening change with bounded blast radius and no evidence of an active core-runtime outage.
  • merge-risk: 🚨 compatibility: Remote skill artifacts larger than 256 MiB that previously installed will instead fail at the documented installer boundary.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides after-fix loopback HTTP and native streaming output for advertised and headerless overflow, including response closure, no install, and cleanup; no private data is shown.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix loopback HTTP and native streaming output for advertised and headerless overflow, including response closure, no install, and cleanup; no private data is shown.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame ties both the direct staging pipeline and the download-spec dispatcher to the same recent split implementation. (role: current implementation author; confidence: medium; commits: 195b0ea3fa83; files: src/skills/lifecycle/install-download.ts, src/skills/lifecycle/install.ts, src/plugins/marketplace.ts)

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 (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-04T16:03:12.483Z sha b93b63025f4eab1d3a78b7b14b0f6ffa99c72db1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-04T16:34:39.112Z sha b93b63025f4eab1d3a78b7b14b0f6ffa99c72db1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-04T17:19:19.914Z sha b93b63025f4eab1d3a78b7b14b0f6ffa99c72db1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-04T17:34:09.378Z sha b93b63025f4eab1d3a78b7b14b0f6ffa99c72db1 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-04T18:07:30.472Z sha b93b63025f4eab1d3a78b7b14b0f6ffa99c72db1 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-04T19:23:29.306Z sha b93b63025f4eab1d3a78b7b14b0f6ffa99c72db1 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-05T00:16:51.836Z sha 902aacd2cf6b14ce279a3488e233f87b22410327 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-05T00:25:29.592Z sha 902aacd2cf6b14ce279a3488e233f87b22410327 :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. labels May 14, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 14, 2026
@stielemans

This comment was marked as low quality.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 2, 2026
@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jun 2, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 15, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jun 15, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 28, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 31, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Aug 1, 2026
@clawsweeper clawsweeper Bot added 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. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 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 repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Aug 4, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 4, 2026
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@vincentkoc

Copy link
Copy Markdown
Member

Exact-head real installer proof is now in the PR body for the active
ClawSweeper review.

Both advertised and headerless streamed overflow paths used a real HTTP server
and native response streaming. Each rejected at the 256 MiB boundary, closed
the response, installed nothing, and left staging empty; the streamed case also
observed a real nonempty partial staging file before cleanup. Runtime proof
passed 2/2 at b93b63025f4eab1d3a78b7b14b0f6ffa99c72db1.

@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. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 4, 2026
@vincentkoc
vincentkoc force-pushed the af/cap-skill-download-size branch from b93b630 to 902aacd Compare August 5, 2026 00:07
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 5, 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 repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

Co-authored-by: Andrii Furmanets <[email protected]>
Punchcard-Session: cobalt-brook-meadow-m9
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Aug 5, 2026
@vincentkoc
vincentkoc force-pushed the af/cap-skill-download-size branch from 902aacd to e3320ba Compare August 5, 2026 05:25
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 5, 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 repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Aug 6, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Aug 6, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #clawtributors on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S stale Marked as stale due to inactivity 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.

Skill download installers allow unbounded remote responses

3 participants