fix(proxy): keep upload resume headers and artifact download content-length

Merged
V3
8d ago
+86-3

Summary

@agent-device/proxy copied only content-type, content-disposition, x-request-id and the instance-mismatch header from daemon responses. A partial resumable upload answers 308 with range and x-upload-offset, which the CLI reads to resume; through the proxy both were dropped, so a resume could not continue. Artifact downloads also lost content-length, so clients got a chunked body with no size.

The proxy now forwards range and x-upload-offset on /upload/direct/* responses and content-length on /artifacts/* downloads. Nothing else changes: content-length stays off the upload preflight, whose body the proxy rewrites, and no auth headers are forwarded. 2 files touched (packages/proxy/src/daemon-proxy.ts and its test).

Validation

Tested commit ceae39831.

  • pnpm check:affected --run: all runnable checks passed (format, lint, typecheck, layering, fallow, build, vitest-related 44 files / 381 tests, daemon-wire-compat).
  • New tests in daemon-proxy.test.ts: the 308 resume headers and the download content-length tests fail without the fix and pass with it; a preflight test checks that the rewritten ticket carries no upstream content-length.
  • Built agent-device proxy + daemon, curl PUT bytes 0-1023/4096 through the proxy. Before: 308 with no resume headers. After: 308, range: bytes=0-1023, x-upload-offset: 1024. Resuming at 1024 then gives 200, and finalize returns ok.
  • Artifact download through the built proxy package. Before: content-length=null, transfer-encoding=chunked. After: content-length=12345, same as the daemon, with 12345 bytes received.
  • Existing proxy unit and provider-integration tests pass (7 files / 40 tests). Health and devices --platform web through the proxy still work.