Skip to content

fix: restore media uploads through protected egress - #144902

Merged
vincentkoc merged 4 commits into
mainfrom
openclaw/fix-proxy-media-content-length-20260911
Sep 13, 2026
Merged

vincentkoc merged 4 commits into
mainfrom
openclaw/fix-proxy-media-content-length-20260911

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #144662

What Problem This Solves

Fixes: destinations requiring a fixed request length reject uploads through protected egress even when the client supplies the correct file size.

User Impact

User impact: known-length uploads up to 100 MiB preserve their bytes and use the measured outgoing length after authorized secret substitution.

Buffered uploads share a 128 MiB reservation budget, including 256 KiB headroom per request, with at most 64 requests preparing or sending. Capacity exhaustion returns 503; the five-minute preparation/send deadline returns 504. Larger or unknown-length uploads retain scanned chunked streaming and can still be rejected by fixed-length-only destinations. Listed security-owner acceptance of this operating envelope remains outstanding.

Why This Change Was Made

The existing forwarding owner collects bounded bodies, rechecks current run/destination/credential authority, and reuses the binary scanner before sending. The allocation site also directly validates a safe, nonnegative integer length within the existing 100 MiB ceiling immediately before allocating. Routing, budgets, deadlines, TLS verification, and cleanup are unchanged; no clamping, new configuration, or body-file storage is introduced.

Evidence

  • Frozen head: d77f100320b6. The private checked allocator rejects non-safe-integer, negative, or above-100 MiB lengths immediately before allocation, without changing admission, budgets, deadlines, or streaming.
  • 95 functional tests pass: authenticated CONNECT/verified TLS, binary/PNG/MP4 byte identity, measured substituted lengths, exact 100 MiB backpressure/hash, refusals, revocation, and reservation cleanup. Production/proxy-test inputs are unchanged by the final companion-plugin test expectation alignment, so this proof remains applicable. Original baseline evidence retains six framing failures before and eleven transport cases passing afterward.
  • Exact-head CI, attempt 2: success. The first attempt hit ETXTBSY launching a native compiler in an unchanged tooling fixture. One targeted job retry and its dependent CI gate passed; source, tests, timeouts, and policies were not changed for the retry.
  • Exact-head CodeQL workflow: success. The aggregate finding check is neutral with zero annotations, retaining the separate warning about 16 missing baseline configurations. No queries, suppressions, or alert dispositions were changed; this is not a claim of complete repository-wide comparison coverage.
  • Fresh exact-head ClawSweeper review: no code/security findings; proof sufficient; needs-human for the compatibility decision above.
  • GitHub attachment acceptance/readback remains unverified. The earlier disclosed candidate/managed-proxy attempt returned HTTP 400. These results establish the stated transport/allocation behavior, not recovery of the entire GitHub endpoint path.

Worked on by @IWhatsskill and @VACInc.

@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: XL maintainer Maintainer-authored PR labels Sep 11, 2026
@roboclaw-bot
roboclaw-bot requested a review from a team September 11, 2026 12:06
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. labels Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 12, 2026, 10:01 PM ET / September 13, 2026, 02:01 UTC (Revision 12).

ClawSweeper review

What this changes

The PR preserves measured lengths for bounded uploads through the protected-egress proxy, adds resource and authorization coverage, documents limits, and aligns a companion-plugin test expectation.

Merge readiness

⛔ Blocked before merge - 4 items remain

This remains a useful correction: current main still loses fixed-length upload framing. No actionable code defect was found, but the documented operating-envelope decision remains outstanding.

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

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent owner-level correction with meaningful real transport coverage and no blocking code findings; owner acceptance remains a separate landing requirement.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The supplied before/after transport results and inspected production-proxy harness cover real authenticated CONNECT/TLS uploads, measured substituted lengths, forbidden destinations, binding replacement, and revocation with observed origin outcomes. This supports the bounded transport correction, not successful GitHub attachment creation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The supplied before/after transport results and inspected production-proxy harness cover real authenticated CONNECT/TLS uploads, measured substituted lengths, forbidden destinations, binding replacement, and revocation with observed origin outcomes. This supports the bounded transport correction, not successful GitHub attachment creation.
Evidence reviewed 11 items Pinned change and merge ownership: The checkout matches the pinned original head. The inspected test merge records the supplied base followed by that head; its result retains the egress changes but has no companion-plugin test delta against its main parent.
Current-main necessity: Current main still pipes transformed request bodies upstream without selecting a measured fixed length. The proposed correction remains absent from the inspected main implementation.
Latest supplied release remains affected: The source at the supplied v2026.9.4 release commit removes both Content-Length and Transfer-Encoding before forwarding; it does not contain the bounded measured-length path.
Findings None None.
Security None None.

How this fits together

The protected-egress proxy lets Gateway-hosted commands use credentials without receiving their plaintext. It authenticates the run, checks destination bindings, substitutes protected values, and forwards HTTPS requests.

flowchart TD
  A[Gateway command upload] --> B[Authenticate run and destination]
  B --> C{Known length within limit?}
  C -->|Yes| D[Reserve memory and collect bytes]
  D --> E[Recheck bindings and substitute]
  E --> F[HTTPS with measured length]
  C -->|No| G[Scanned chunked streaming]
  G --> H[Destination response]
  F --> H
Loading

Decision needed

Question Recommendation
Does the listed security owner accept the 100 MiB buffering envelope, shared 128 MiB/64-request admission limits, and five-minute deadline for existing protected-egress users? Accept the documented envelope: Approve the bounded framing correction while keeping GitHub endpoint completion outside the proven claim.

Why: The implementation and transport proof support the bounded fix, but accepting new collection latency and capacity/timeout refusals requires owner judgment explicitly left outstanding in the PR.

Before merge

  • Resolve merge risk (P1) - Previously streaming known-length requests now wait for full collection and can fail with 503 under shared capacity pressure or 504 after five minutes; security-owner acceptance of this upgrade tradeoff is outstanding.
  • Resolve merge risk (P1) - Successful GitHub attachment creation and readback remain unverified; the transport proof does not establish resolution of the entire linked endpoint workflow.
  • Complete next step (P2) - Obtain listed security-owner acceptance of the buffering limits, collection latency, and new 503/504 behavior before merge.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +230, Tests +714, Docs +6. Total +950 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 3 282 52 +230
Tests 6 777 63 +714
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 1065 115 +950

Review metrics

Metric Value Why it matters
Upload operating envelope 100 MiB per request; 128 MiB shared; 64 requests; 5 minutes These new runtime limits determine which existing uploads can wait or receive capacity and timeout refusals.
Production versus test growth Production +230 net lines; tests +714 net lines Production growth is justified by bounded preparation and resource ownership; most added coverage exercises transport and lifecycle behavior.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #144662
Summary: This PR addresses the canonical report's proven framing defect; another open PR proposes a smaller buffering envelope.

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 bounded-upload compatibility (recommended)
    Have the listed security owner explicitly accept the documented collection latency and new capacity/timeout responses.
  2. Pause for revised limits
    Hold landing if existing upload workloads require different admission or deadline behavior.

Technical review

Best possible solution:

Keep one forwarding owner with measured lengths, unchanged scanning and revocation, and an explicitly accepted operating envelope for existing installations.

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

Yes: current main strips fixed-length framing, and the supplied real CONNECT/TLS control demonstrates rejection by a length-requiring origin. This read-only review did not execute a reproduction.

Is this the best way to solve the issue?

Yes for bounded fixed-length interoperability: the patch reuses the existing scanner and forwarding owner while checking current authority before sending. The operating limits still need explicit owner acceptance.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 745ee6af3429.

Labels

Label justifications:

  • P2: This fixes a demonstrated interoperability problem in the optional protected-egress upload path.
  • merge-risk: 🚨 compatibility: Existing known-length requests gain collection latency and new 503/504 failure conditions requiring owner acceptance.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 supplied before/after transport results and inspected production-proxy harness cover real authenticated CONNECT/TLS uploads, measured substituted lengths, forbidden destinations, binding replacement, and revocation with observed origin outcomes. This supports the bounded transport correction, not successful GitHub attachment creation.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied before/after transport results and inspected production-proxy harness cover real authenticated CONNECT/TLS uploads, measured substituted lengths, forbidden destinations, binding replacement, and revocation with observed origin outcomes. This supports the bounded transport correction, not successful GitHub attachment creation.

Evidence

What I checked:

  • Pinned change and merge ownership: The checkout matches the pinned original head. The inspected test merge records the supplied base followed by that head; its result retains the egress changes but has no companion-plugin test delta against its main parent. (14e994ac9d44)
  • Current-main necessity: Current main still pipes transformed request bodies upstream without selecting a measured fixed length. The proposed correction remains absent from the inspected main implementation. (src/secrets/egress-proxy/proxy-forward.ts:210, 745ee6af3429)
  • Latest supplied release remains affected: The source at the supplied v2026.9.4 release commit removes both Content-Length and Transfer-Encoding before forwarding; it does not contain the bounded measured-length path. (src/secrets/egress-proxy/proxy-server.ts:230, 3a9d69db306c)
  • Allocation, admission, and send ownership: The forwarding owner validates allocation size locally, reserves payload plus headroom, limits concurrent buffered requests, and holds reservations through upstream send completion or closure. Buffered requests receive freshly measured framing. (src/secrets/egress-proxy/proxy-forward.ts:241, d77f100320b6)
  • Current authority at forwarding: Buffered preparation rereads destination and sentinel bindings before creating the upstream request. Registration revocation destroys owned streams; the existing resolver requires an active registration and matching destination. The changed owner uses OpenClaw's sentinel and Node HTTPS implementations, with no Codex dependency contract. (src/secrets/egress-proxy/proxy-server.ts:393, d77f100320b6)
  • Real transport and forbidden-case coverage: Inspected tests exercise the production proxy through authenticated CONNECT and real TLS against a local HTTPS origin: byte-identical binary/PNG/MP4 uploads, substituted lengths, wrong-host refusal, binding replacement, revocation, cancellation, capacity recovery, and a 100 MiB transfer. HTTPS spies delegate to real transport. The captured PR body reports 95 passing cases and retained baseline framing failures; no tests were executed during this review. (src/secrets/egress-proxy/proxy-server.lifecycle.test.ts:187, d77f100320b6)

Likely related people:

  • openclaw/openclaw-secops: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (11 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-12T23:08:07.833Z sha 8602bab0f1ef926850aa0148dfb4a881d0b41109 :: blocked before merge. :: none
  • reviewed 2026-09-12T23:15:08.261Z sha 8602bab0f1ef926850aa0148dfb4a881d0b41109 :: blocked before merge. :: none
  • reviewed 2026-09-12T23:26:09.527Z sha 1ea7231 :: blocked before merge. :: none
  • reviewed 2026-09-12T23:50:35.740Z sha 1ea7231 :: blocked before merge. :: none
  • reviewed 2026-09-13T00:14:48.868Z sha be9ab76 :: blocked before merge. :: none
  • reviewed 2026-09-13T00:34:34.435Z sha be9ab76 :: blocked before merge. :: none
  • reviewed 2026-09-13T01:01:43.027Z sha f2967ed :: blocked before merge. :: none
  • reviewed 2026-09-13T01:30:00.795Z sha d77f100 :: blocked before merge. :: none

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review September 11, 2026 12:19
@IWhatsskill IWhatsskill self-assigned this Sep 11, 2026
@VACInc VACInc self-assigned this Sep 12, 2026
@roboclaw-bot
roboclaw-bot force-pushed the openclaw/fix-proxy-media-content-length-20260911 branch from cf6d822 to 8602bab Compare September 12, 2026 23:01
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

Please review head 8602bab0f1ef926850aa0148dfb4a881d0b41109. This refresh rebases the same PR and removes redundant small-fixture SHA assertions while retaining complete Buffer equality and the 100 MiB lifecycle hash. Production and the documented operating envelope are unchanged. Review only; no repair or merge requested.

@clawsweeper

clawsweeper Bot commented Sep 12, 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:

@roboclaw-bot
roboclaw-bot force-pushed the openclaw/fix-proxy-media-content-length-20260911 branch from 8602bab to 1ea7231 Compare September 12, 2026 23:18
@roboclaw-bot

roboclaw-bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

Head f2967edcadd8efd071a73ff304ae827d848cc958: private checked allocator; limits and security behavior unchanged. 95/95 functional tests pass (test source); repository checks and fresh autoreview pass. CodeQL workflow succeeded: current-head core-auth-secrets analysis has 0 results across 60 rules; the analyzed merge includes this head. Aggregate CodeQL is neutral with 0 annotations and the separate 16-configuration coverage warning. CI and fresh ClawSweeper review remain under observation. No suppression/dismissal or merge; SecOps acceptance and live GitHub attachment acceptance remain unresolved.

roboclaw-bot and others added 4 commits September 13, 2026 01:12
Preserve fixed-length upload framing after bounded, destination-authorized
substitution while retaining larger and unknown-length streaming.

Co-authored-by: IWhatsskill <[email protected]>
Co-authored-by: VACInc <[email protected]>
Validate the safe-integer, nonnegative, and 100 MiB contract at the allocation boundary. Keep routing, aggregate reservations, request count, and deadlines unchanged; use the existing refusal and cleanup path.

Co-authored-by: IWhatsskill <[email protected]>
Co-authored-by: VACInc <[email protected]>
Keep safe-integer, nonnegative, and inclusive 100 MiB validation beside Buffer.allocUnsafeSlow in a private owner. Preserve admission, resource limits, streaming, and the existing caller cleanup boundary.

Co-authored-by: IWhatsskill <[email protected]>
Co-authored-by: VACInc <[email protected]>
Keep the exact upgrade-survivor assertion aligned with the upstream producer, which now supplies the default discord plugin ID. Retain strict equality for all four baseline versions; no runtime or allocator contract changes.

Co-authored-by: IWhatsskill <[email protected]>
Co-authored-by: VACInc <[email protected]>
@roboclaw-bot
roboclaw-bot force-pushed the openclaw/fix-proxy-media-content-length-20260911 branch from f2967ed to d77f100 Compare September 13, 2026 01:23

@vincentkoc vincentkoc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

SecOps reviewed exact head d77f100320b6241eb02b0ac83b7a26e9027a824c and accepts the documented 100 MiB per-request, 128 MiB shared, 64-request, and five-minute buffering envelope. The change preserves per-run proxy authentication, exact-host secret binding, send-time authority checks, binary sentinel scanning, TLS verification, and run-revocation resource ownership.

Approved for the demonstrated transport/framing restoration. Successful authenticated GitHub attachment acceptance/readback remains separate product proof. A separate narrow follow-up will tighten cancellation granularity while sending an already-buffered body, without changing these limits or security boundaries.

@vincentkoc vincentkoc self-assigned this Sep 13, 2026
@vincentkoc
vincentkoc merged commit 908e90a into main Sep 13, 2026
317 of 319 checks passed
@vincentkoc
vincentkoc deleted the openclaw/fix-proxy-media-content-length-20260911 branch September 13, 2026 07:07
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '2acbeee461474b6ba41f5186ae1a4e0e80f4087a': (117 commits)
  fix(ui): import the shared deferred helper in sidebar scope tests (#146862)
  fix(ui): copy chat content from its context menu (#146679)
  perf(memory): defer legacy sidecar writer imports (#146815)
  fix(e2e): accept expected Kitchen Sink worker rejection (#146681)
  fix(ui): distinguish absolute and relative file links (#146572)
  feat(ui): keep file previews in tabs and render HTML (#146672)
  refactor: reuse shared deferred promises in UI tests (#146670)
  fix: gateway stop/restart refuses a healthy gateway when the Windows process snapshot misses (#146387)
  improve(crabbox): keep healthy cloud desktops warm on resume (#146816)
  fix: report blocked SQLite WAL checkpoints in status and doctor (#146775)
  feat: share browser dashboards with agents (#146702)
  fix(doctor): continue repairs after legacy agent directory collisions (#146092)
  feat(agents): retry cyber-refused embedded turns on Daybreak (#145291)
  fix: restore media uploads through protected egress (#144902)
  refactor(qa): share capture filter rendering (#146696)
  fix(cli): keep running stream jobs visible as running (#146793)
  refactor(parallels): share gateway readiness loop (#146694)
  fix(sessions): avoid rewriting already-consumed input on release (#146795)
  fix: preserve scheduled conversation delivery after Doctor (#146794)
  perf(ui): avoid redundant session-row provenance work (#146797)
  ...
vincentkoc added a commit that referenced this pull request Sep 13, 2026
Send buffered protected-egress uploads in cancellation-aware 64 KiB slices, honoring backpressure and rechecking live run authority before each write and final end. Preserve measured framing, substitution, TLS, destination authorization, and transport-owned reservation release.

Six deterministic cancellation regressions cover revoke, stop, and disconnect across drain and next-turn continuations. Exact-head CI and security checks pass; ClawSweeper reports no findings. Already-submitted bytes remain in flight.

Follow-up to #144902.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
Preserve fixed-length upload framing after bounded, destination-authorized secret substitution while retaining larger and unknown-length streaming. Keep per-run authentication, exact-host binding, current authorization checks, binary integrity, TLS verification, and revocation resource ownership.

SecOps accepts the documented 100 MiB per-request, 128 MiB shared, 64-request and five-minute operating envelope. Real transport coverage proves the framing correction; authenticated GitHub attachment acceptance/readback remains separate product proof.

Related: openclaw#144662

Co-authored-by: IWhatsskill <[email protected]>
Co-authored-by: VACInc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
…w#146840)

Send buffered protected-egress uploads in cancellation-aware 64 KiB slices, honoring backpressure and rechecking live run authority before each write and final end. Preserve measured framing, substitution, TLS, destination authorization, and transport-owned reservation release.

Six deterministic cancellation regressions cover revoke, stop, and disconnect across drain and next-turn continuations. Exact-head CI and security checks pass; ClawSweeper reports no findings. Already-submitted bytes remain in flight.

Follow-up to openclaw#144902.
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 gateway Gateway runtime maintainer Maintainer-authored PR 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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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.

5 participants