Skip to content

Honor upload_target on cloud-agent attachment uploads - #14795

Merged
bnavetta merged 3 commits into
masterfrom
factory/remote-2548-attachment-upload-target
Aug 7, 2026
Merged

bnavetta merged 3 commits into
masterfrom
factory/remote-2548-attachment-upload-target

Conversation

@warp-agent-staging

Copy link
Copy Markdown
Contributor

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 standard upload_target alongside the deprecated upload_url.

upload_url can only ever describe a presigned PUT. Teams whose attachments are mapped to self-hosted S3 storage get a presigned POST form instead, so a client that only reads upload_url cannot 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:

  • AttachmentUploadInfo now parses upload_target, and resolve_upload_target() prefers it — falling back to a synthesized presigned PUT built from upload_url when 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 existing presigned_upload::upload_to_target helper instead of a hand-rolled PUT. That helper already handles plain-body PUTs and multipart POST forms, 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 UploadTarget type. Without both fixes the new upload_target path could never have worked, and both also affect the snapshot upload path, which deserializes the same type:

  1. UploadFieldValue::ContentCrc32C derived the serde tag content_crc32_c under rename_all = "snake_case", but the server's discriminator is content_crc32c. Every presigned POST target failed to parse.
  2. UploadTarget.headers was a non-defaulted HashMap. The server marshals an unset header map as null, 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, and cargo clippy --workspace --exclude warp_completer --all-targets --tests -- -D warnings all 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_target
  • prepare_attachment_uploads_response_prefers_upload_target_over_upload_url
  • prepare_attachment_uploads_response_falls_back_to_upload_url
  • s3_form_upload_target_is_uploaded_as_a_multipart_post — asserts the real multipart POST body over HTTP
  • upload_url_fallback_is_uploaded_as_a_put_with_its_content_type — asserts the real PUT over HTTP
  • upload_target_deserializes_null_headers_and_fields_as_empty, upload_field_value_deserializes_every_server_kind

Cross-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 own PrepareAttachmentUploadsResponse through attachmentUploadsFromTargets, 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:

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_target path goes live. Until then this client keeps using the upload_url fallback, 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.

oz-agent and others added 2 commits August 6, 2026 15:31
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]>
@cla-bot cla-bot Bot added the cla-signed label Aug 6, 2026
@warp-agent-staging warp-agent-staging Bot added the warpy-factory Label associated to the "Wob the Wuilder" factory on staging, also known as Warpy Factory. label Aug 6, 2026
@warp-agent-staging
warp-agent-staging Bot marked this pull request as ready for review August 6, 2026 15:56
@warp-agent-staging
warp-agent-staging Bot requested a review from bnavetta August 6, 2026 15:56

@warp-agent-staging warp-agent-staging Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Review run

https://oz.staging.warp.dev/runs/019fd7cc-4f62-78e4-9889-f3793249541d

@bnavetta
bnavetta enabled auto-merge (squash) August 7, 2026 13:11
@bnavetta
bnavetta merged commit 5688e06 into master Aug 7, 2026
52 of 58 checks passed
@bnavetta
bnavetta deleted the factory/remote-2548-attachment-upload-target branch August 7, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed warpy-factory Label associated to the "Wob the Wuilder" factory on staging, also known as Warpy Factory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants