Repository navigation
feat(gateway): download inline artifacts over HTTPS - #154673
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 5:26 PM ET / 21:26 UTC (Revision 7). ClawSweeper reviewWhat this changesAdds 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 Review scores
Verification
How this fits togetherThe 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]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +619, Tests +770, Docs +31, Other +4. Total +1424 across 31 files. View PR surface stats
Review metrics
Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
|
|
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 |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
bdc7bfa to
80156e2
Compare
80156e2 to
7008ad8
Compare
7008ad8 to
2cc9dff
Compare
|
Merged via squash.
|
* 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
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/htmlapp 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
2cc9dff9cee5d8f8c8dcf704914cd9be651b0a62, using the installed@openclaw/fs-safe0.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.--maxWorkers=1in 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.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 headc13ba5277e69652189b37418422cbfb90dc4b69apassed 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.