Repository navigation
Honor upload_target on cloud-agent attachment uploads - #14795
Conversation
The prepare-upload response now carries the standard `UploadTarget` alongside the deprecated `upload_url`. `upload_url` only describes a presigned PUT, so teams whose attachments live in self-hosted S3 storage could not upload at all — their target is a presigned POST form. Parse `upload_target` and route attachment uploads through the existing `upload_to_target` helper, which already handles both PUT and multipart POST targets. When the field is absent, synthesize a PUT target from `upload_url` so the client keeps working against servers that predate the contract. Also fix `UploadFieldValue::ContentCrc32C`, whose derived `snake_case` tag was `content_crc32_c` rather than the `content_crc32c` the server sends. Every presigned POST target failed to deserialize because of it. Co-Authored-By: Warp <[email protected]>
The server marshals an unset header map as `null`, which is what an S3 presigned POST target carries. Deserializing it into a plain `HashMap` failed the whole target, so pin the client's test fixtures to the exact bytes the prepare-upload handler emits instead of hand-written approximations. Co-Authored-By: Warp <[email protected]>
…-attachment-upload-target
There was a problem hiding this comment.
Overview
This PR consumes the server-provided attachment upload_target, retaining a legacy PUT fallback, and the code and focused regression coverage align with the attachment-only contract. The client diff has no code-level findings, but it cannot be accepted while required CI has not executed.
Concerns
GitHub Actions infrastructure prevented the required code gates: CodeQL failed before checkout/action setup with Service Unavailable, and Warp CI's parameter job was never acquired by a hosted runner. The downstream compilation, clippy, and test jobs were skipped rather than passed; rerun CI and return this PR for review after the matrix is terminal and green.
Verdict
Checks: local format/clippy/inline/clang/WGSL ✅ · focused upload-target tests ✅ (7) · full local workspace test compilation unavailable (sandbox SIGKILL) · CI ❌ (GitHub Actions infrastructure; substantive gates skipped) · visual proof n/a (no rendered surface)
Found: 0 critical, 1 important
Request changes
Summary
Client half of REMOTE-2548. warp-server PR #13971 migrates cloud-agent input attachments onto the owner-resolved
ObjectStore, and the prepare-upload response now returns the standardupload_targetalongside the deprecatedupload_url.upload_urlcan only ever describe a presignedPUT. Teams whose attachments are mapped to self-hosted S3 storage get a presigned POST form instead, so a client that only readsupload_urlcannot upload their attachments at all.This teaches the client to honor
upload_target, reusing the upload-target support that already exists in this repo for artifact and snapshot uploads:AttachmentUploadInfonow parsesupload_target, andresolve_upload_target()prefers it — falling back to a synthesized presignedPUTbuilt fromupload_urlwhen the field is absent, so the client keeps working against a server that has not deployed docs(specs): markdown viewer raw-HTML <img> support (rendering + sizing) (GH13721) #13971 yet.upload_pending_attachments_to_task(app/src/terminal/input.rs) routes through the existingpresigned_upload::upload_to_targethelper instead of a hand-rolledPUT. That helper already handles plain-bodyPUTs and multipartPOSTforms, including the CRC32C computation S3 requires.Two pre-existing deserialization bugs, also fixed
Pinning the tests to the bytes the server actually emits surfaced two mismatches in the shared
UploadTargettype. Without both fixes the newupload_targetpath could never have worked, and both also affect the snapshot upload path, which deserializes the same type:UploadFieldValue::ContentCrc32Cderived the serde tagcontent_crc32_cunderrename_all = "snake_case", but the server's discriminator iscontent_crc32c. Every presigned POST target failed to parse.UploadTarget.headerswas a non-defaultedHashMap. The server marshals an unset header map asnull, which is exactly what an S3 POST target carries, so the whole target failed to parse.Verification
./script/format --check,cargo clippy -p warp --all-targets --tests -- -D warnings, andcargo clippy --workspace --exclude warp_completer --all-targets --tests -- -D warningsall pass.Tests for the touched modules (
server::server_api::*,terminal::input*): 272 passed. Three failures are pre-existing and environment-specific —ambient_agent_headers_for_task_overrides_existing_cloud_agent_header,test_histignorespace_support_in_zsh,test_decorations_with_multibyte_chars— confirmed failing identically on a clean checkout of the base branch in the same sandbox.New regression tests (all verified failing before the change, passing after):
prepare_attachment_uploads_response_parses_s3_form_upload_targetprepare_attachment_uploads_response_prefers_upload_target_over_upload_urlprepare_attachment_uploads_response_falls_back_to_upload_urls3_form_upload_target_is_uploaded_as_a_multipart_post— asserts the real multipart POST body over HTTPupload_url_fallback_is_uploaded_as_a_put_with_its_content_type— asserts the real PUT over HTTPupload_target_deserializes_null_headers_and_fields_as_empty,upload_field_value_deserializes_every_server_kindCross-repo wire conformance
Rather than hand-writing the response fixtures, I checked out warp-server at #13971's head (
b56508cc) and marshalled the handler's ownPrepareAttachmentUploadsResponsethroughattachmentUploadsFromTargets, for both a Warp-hosted PUT target and an S3 POST target. The client's fixtures are those bytes verbatim. Both bugs above were found this way — hand-written fixtures had hidden them. (That dump was a throwaway; no warp-server files were changed.)What was NOT verified
There is no true end-to-end run behind this PR. I could not attach a file to a real cloud-agent run against a server carrying #13971:
script/oz-localneeds it).upload_urlfallback.The strongest evidence here is the cross-repo wire conformance above plus HTTP-level upload assertions — the client is proven to parse the server's exact bytes and to emit the correct multipart POST / PUT request from them. A human should still confirm the full flow once #13971 deploys, ideally with a team mapped to self-hosted S3 storage, since that is the configuration this change exists for.
Dependency
warp-server PR #13971 is the server-side counterpart and must deploy before the
upload_targetpath goes live. Until then this client keeps using theupload_urlfallback, which is the behavior it has today.CHANGELOG-BUG-FIX: Fixed cloud agent attachment uploads for teams using self-hosted S3 storage.
Originating thread: https://warpdev.slack.com/archives/C0BDQDW8V5E/p1786023009816349
Conversation: https://staging.warp.dev/conversation/75b84096-9c7a-44ea-9710-c658392da231
Run: https://oz.staging.warp.dev/runs/019fd78d-6472-7e3a-97cc-25b0026d46bc
This PR was generated with Oz.