Skip to content

feat(gateway): download inline artifacts over HTTPS - #154673

Merged
steipete merged 4 commits into
mainfrom
codex/artifact-http-downloads
Sep 21, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/artifact-http-downloads

Conversation

@steipete

@steipete steipete commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Inline transcript artifacts travel as base64 JSON even when their original bytes can be downloaded over HTTPS. This adds roughly one-third to payload size and puts large transfers on the chat connection.

User Impact

The Control UI uses raw HTTP bytes for inline image, text, and JSON previews when connected to its own HTTPS origin. Binary previews provide a Download action that obtains fresh authority on every click, including after a cached preview is reopened. WebSocket-only clients retain base64 delivery. Missing, unreachable, or proxy-intercepted media routes fall back to the same authenticated RPC, preserving the original client, session, agent, and artifact scope. Closing a panel or reconnecting prevents stale in-flight saves.

Clients opt in with artifacts.download({ ..., transport: "http" }); omitted transport preserves the existing response. Proxies must forward /api/artifacts/download/ under the configured Control UI mount, in addition to WebSocket upgrades. No config migration or protocol-version bump is required.

Why This Change Was Made

The Gateway issues a five-minute opaque URL bound to the live connection and exact artifact. Each HTTP read rechecks requester authority, session generation, transcript membership, and content digest. GET, HEAD, and single byte ranges share that owner without persisting another artifact copy. Managed-media downloads retain their existing owner.

Responses force attachment handling, disable caching, and sandbox active content. The UI requires the attachment disposition and expected MIME before accepting HTTP bytes: a proxy's 200 text/html app page must not be mistaken for an HTML artifact. Chat preserves its raster-only image policy and bounded Blob cache; workspace previews preserve their text/image presentation. HTTP lazy-module extraction retains main's image-route registry and all 18 existing loaders, adding only the artifact loader.

Evidence

  • Real authenticated WSS/HTTPS Gateway test: certificate-verified exact binary/SVG/empty bytes, base64 equivalence, GET/HEAD/ranges, proxy mount with dashboard hosting disabled, tampered/expired links, scope denial, same-ID content replacement, transcript removal, and disconnect revocation. The pre-change handler failed the expected bytes-versus-URL assertion. Fresh run at 2cc9dff9cee5d8f8c8dcf704914cd9be651b0a62, using the installed @openclaw/fs-safe 0.18.0 dependency: test 17.730 s, Vitest 37.11 s, wrapper 365.93 s including runtime rebuild. The final follow-up changes only UI response validation and its fixtures; Gateway code is unchanged.
  • Artifact RPC, requester authority, task-read, transcript-image, managed-lifecycle, and HTTP lazy-loading coverage passed. Post-extraction owner suites passed 45 tests in 57.02 s wrapper time. All four lazy-loading cases passed again on the final integration.
  • 348 focused UI/browser tests passed for renewal, exact bytes, fallback, reconnect cancellation, and preview removal. Final HTML-response regressions failed on the original code for both missing and inline disposition; after the guard, all 69 affected UI tests passed with --maxWorkers=1 in 9.69 s wrapper / 5.68 s Vitest. The new cases took 53 ms and 51 ms and verify actual artifact content plus preserved RPC scope.
  • Full build passed in 396.30 s; production UI fixture build passed in 8.77 s. Protocol generation/check passed with no generated drift; documentation audit checked 14,260 links with zero broken links. The final UI guard passed the complete selected typecheck, lint, and repository-guard plan in 401.42 s, and fresh independent P0–P2 review was clean. Earlier feature and renewal reviews were also clean.
  • CI uncovered unrelated fixtures already repaired on main: rendered Bun directive assertions (087ccde18c3) and native-turn readiness before interruption (fix(test): await native turn admission before interrupting #155140, a7c27c04a3d). Both fixes are included in this rebase. Final head c13ba5277e69652189b37418422cbfb90dc4b69a passed CI run 35656186223 and the required aggregate gate, including iOS smoke. The three UI CI jobs took 318 s, 453 s, and 279 s including setup and their existing suites. Final ClawSweeper review reported no actionable findings and confirmed the proxy-response repair.

Inspected browser proof

A production-built Control UI fixture with mocked RPC and real HTTPS bytes reproduced the old binary-expiry failure: the cached link returned 404 without a new RPC. The repaired button issued one fresh RPC/ticket, fetched HTTP 200, and saved exactly 8,192 bytes with SHA-256 dc404a613fedaeb54034514bc6505f56b933caa5250299ba7d094377a51caa46. The inline PNG preview also used raw HTTPS bytes, with no browser errors. This complements the separate real-Gateway TLS proof; no production Gateway deployment was performed.

The following screenshots contain only inspected synthetic data and were also delivered in chat. Both PR images were verified rendered.

Before: cached binary link expires

After: Download requests fresh authority

@clawsweeper

clawsweeper Bot commented Sep 21, 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.

@steipete
steipete marked this pull request as ready for review September 21, 2026 09:08
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: XL maintainer Maintainer-authored PR labels Sep 21, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 5:26 PM ET / 21:26 UTC (Revision 7).

ClawSweeper review

What this changes

Adds short-lived HTTPS downloads for inline transcript artifacts and updates Control UI previews and download actions while preserving authenticated base64 fallback.

Merge readiness

✅ Ready for maintainer review

The previous proxy-response finding is resolved, and no new blocking defect was identified. The feature remains absent from current main and the latest release; this maintainer-owned PR remains useful.

Priority: P2
Reviewed head: c13ba5277e69652189b37418422cbfb90dc4b69a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent implementation with strong boundary evidence and the prior blocking finding resolved.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Reported real Gateway WSS/HTTPS evidence exercises ticket issuance through final byte delivery and rejects insufficient scope, tampering, expiry, replacement, removal, and disconnect. Inspected screenshots and recorded browser transfer results cover renewed downloads; the final response guard has focused red/green regression evidence. No execution was performed during this review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Reported real Gateway WSS/HTTPS evidence exercises ticket issuance through final byte delivery and rejects insufficient scope, tampering, expiry, replacement, removal, and disconnect. Inspected screenshots and recorded browser transfer results cover renewed downloads; the final response guard has focused red/green regression evidence. No execution was performed during this review.
Evidence reviewed 9 items Pinned introduction and review continuity: Reviewed the merge-base-to-head introduced hunks. GitHub's exact-head commit patch confirms the final follow-up adds attachment-disposition validation and corresponding UI regressions; Gateway production code is unchanged from the previously exercised head. The supplied test merge is stale and was not used to infer removals from main.
Previous finding resolved: HTTP bytes now require attachment disposition and the expected MIME. The HTML regression cases supply a proxy application page with missing or inline disposition and assert recovery of actual artifact content using the original client, session, agent, and artifact.
Authority and final response boundary: Tickets retain the original request authority and exact artifact reader. HTTP handling checks connection membership, invalidation, expiry, and current authorization before and after the awaited read, then verifies content identity before responding. Responses force attachment handling, sandbox active content, and disable caching.
Findings None None.
Security None None.

How this fits together

The Gateway resolves artifacts from authorized session transcripts and supplies their contents to clients. The Control UI uses the returned bytes for chat images, workspace previews, and explicit file downloads.

flowchart LR
  A[Control UI or client] --> B[Authenticated artifact request]
  B --> C[Session and artifact authorization]
  C --> D{Requested transport}
  D --> E[Base64 response]
  D --> F[Connection-bound download ticket]
  F --> G[HTTP read rechecks live authority]
  G --> H[Preview or saved file]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +619, Tests +770, Docs +31, Other +4. Total +1424 across 31 files.

View PR surface stats
Area Files Added Removed Net
Source 20 756 137 +619
Tests 8 1006 236 +770
Docs 2 31 0 +31
Config 0 0 0 0
Generated 0 0 0 0
Other 1 5 1 +4
Total 31 1798 374 +1424

Review metrics

Metric Value Why it matters
Protocol surface 1 optional transport parameter; 0 new configuration settings Clients opt into HTTP while omitted transport preserves existing delivery.
Production versus test growth Production net +623 lines; tests and test support net +770 lines Production growth is justified by the new transfer boundary and UI download lifecycle; coverage includes real TLS transport and fallback regressions.

Technical review

Best possible solution:

Keep transport selection within the existing artifact owner, with live-bound tickets, fresh authority on download clicks, and same-scope base64 recovery.

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

Not applicable as a feature request; main's schema confirms the missing transport capability, and supplied production-boundary evidence exercises the proposed behavior.

Is this the best way to solve the issue?

Yes. Extending the existing artifact RPC and reusing its authorization and transcript readers avoids a competing artifact store while preserving existing clients.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Reported real Gateway WSS/HTTPS evidence exercises ticket issuance through final byte delivery and rejects insufficient scope, tampering, expiry, replacement, removal, and disconnect. Inspected screenshots and recorded browser transfer results cover renewed downloads; the final response guard has focused red/green regression evidence. No execution was performed during this review.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a bounded artifact-transfer improvement with preserved fallback behavior and no demonstrated urgent user regression.
  • 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 (live_output): Reported real Gateway WSS/HTTPS evidence exercises ticket issuance through final byte delivery and rejects insufficient scope, tampering, expiry, replacement, removal, and disconnect. Inspected screenshots and recorded browser transfer results cover renewed downloads; the final response guard has focused red/green regression evidence. No execution was performed during this review.
  • proof: sufficient: Contributor real behavior proof is sufficient. Reported real Gateway WSS/HTTPS evidence exercises ticket issuance through final byte delivery and rejects insufficient scope, tampering, expiry, replacement, removal, and disconnect. Inspected screenshots and recorded browser transfer results cover renewed downloads; the final response guard has focused red/green regression evidence. No execution was performed during this review.

Evidence

What I checked:

  • Pinned introduction and review continuity: Reviewed the merge-base-to-head introduced hunks. GitHub's exact-head commit patch confirms the final follow-up adds attachment-disposition validation and corresponding UI regressions; Gateway production code is unchanged from the previously exercised head. The supplied test merge is stale and was not used to infer removals from main. (ui/src/api/artifact-download.ts:89, c13ba5277e69)
  • Previous finding resolved: HTTP bytes now require attachment disposition and the expected MIME. The HTML regression cases supply a proxy application page with missing or inline disposition and assert recovery of actual artifact content using the original client, session, agent, and artifact. (ui/src/pages/chat/components/chat-session-workspace-artifacts.test.ts:424, c13ba5277e69)
  • Authority and final response boundary: Tickets retain the original request authority and exact artifact reader. HTTP handling checks connection membership, invalidation, expiry, and current authorization before and after the awaited read, then verifies content identity before responding. Responses force attachment handling, sandbox active content, and disable caching. (src/gateway/artifact-downloads.ts:109, c13ba5277e69)
  • Production-boundary proof: The captured PR body reports a certificate-verified WSS/HTTPS run at 2cc9dff: exact binary/SVG/empty bytes, base64 equivalence, mounted routes, ranges, insufficient-scope denial, tampering, expiry, replacement, removal, and disconnect rejection. Inspection confirms the scenario uses the real Gateway, authenticated client, HTTPS transport, and transcript persistence owners. Reported test duration was 17.730 seconds; this review did not execute it. (src/gateway/artifacts-download.https.e2e.test.ts:19, c13ba5277e69)
  • Inspected visual evidence: Both prepared screenshots were inspected: the earlier preview contains an expiring link, while the repaired preview presents a Download button. The captured body separately records a fresh RPC/ticket, HTTP 200, and an 8,192-byte saved file with the expected SHA-256 in a production-built UI fixture using mocked RPC and real HTTPS bytes. Screenshots establish the visible change, not the security boundary. Evidence was assessed from supplied sourceRevision ca17e2a02c1271123c75bef326410ae25ba88319d90b3b2b8cfb19af8c76dc2e.
  • Current main still needs the feature: Current main's closed download-parameter schema has no transport field. Existing managed-media URLs and transcript scan optimization do not provide this inline-artifact HTTP transport. (packages/gateway-protocol/src/schema/artifacts.ts:70, b4f6bb9bfa61)

Likely related people:

  • 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 (6 earlier review cycles)
  • reviewed 2026-09-21T09:16:26.878Z sha 8130ffa :: needs real behavior proof before merge. :: [P2] Renew binary download tickets when the user opens the artifact
  • reviewed 2026-09-21T10:31:01.079Z sha 0882267 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T16:53:49.340Z sha 80156e2 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T17:24:58.135Z sha 80156e2 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T20:01:15.156Z sha 7008ad8db227c84ad6b8d9b010c3b35b02b20261 :: needs changes before merge. :: [P2] [P2] Reject application fallback pages for HTML artifact downloads
  • reviewed 2026-09-21T20:59:56.280Z sha 2cc9dff :: blocked before merge. :: [P2] [P2] Reject application fallback pages for HTML artifact downloads

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: c13ba5277e69652189b37418422cbfb90dc4b69a
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/server-http.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@steipete

Copy link
Copy Markdown
Contributor Author

Fixed the cached binary-link finding in 0882267: previews retain a Download action, and each click requests fresh authority. The existing detail panel owns pending/error state, cancellation, and saving; HTTP failure falls back to base64 on the same connection.

The PR body now includes inspected before/after screenshots and browser network evidence: the old cached link returned 404 after expiry, while the repaired action issued one fresh RPC and saved the expected 8,192 bytes. Both PR images render. Fresh P0–P2 review and the follow-up checks passed; 348 focused UI/browser tests passed. The unchanged real Gateway WSS/HTTPS proof also passed. The WebSocket-only fallback was additionally verified in normal Chrome with the same downloaded-byte hash.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 21, 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 21, 2026
@steipete
steipete force-pushed the codex/artifact-http-downloads branch 2 times, most recently from bdc7bfa to 80156e2 Compare September 21, 2026 16:43
@steipete
steipete force-pushed the codex/artifact-http-downloads branch from 80156e2 to 7008ad8 Compare September 21, 2026 19:32
@clawsweeper clawsweeper Bot added 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. and removed 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 21, 2026
@steipete
steipete force-pushed the codex/artifact-http-downloads branch from 7008ad8 to 2cc9dff Compare September 21, 2026 20:26
@clawsweeper clawsweeper Bot added 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: 🦐 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 Sep 21, 2026
@steipete
steipete merged commit 97dd4d2 into main Sep 21, 2026
223 of 224 checks passed
@steipete
steipete deleted the codex/artifact-http-downloads branch September 21, 2026 21:52
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 22, 2026
* feat(gateway): download inline artifacts over HTTPS

* fix(ui): renew binary artifact downloads on click

* refactor(gateway): keep artifact read validation with session resolution

* fix(ui): reject proxy app pages during artifact downloads
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR 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. security-sensitive-changed 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.

1 participant