fix(proxy): keep upload resume headers and artifact download content-length
Merged
V3
8d ago+86+86+01234567890123456789-3-3-0123456789
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 downloadcontent-lengthtests fail without the fix and pass with it; a preflight test checks that the rewritten ticket carries no upstreamcontent-length. - Built
agent-device proxy+ daemon, curlPUT bytes 0-1023/4096through the proxy. Before:308with no resume headers. After:308,range: bytes=0-1023,x-upload-offset: 1024. Resuming at 1024 then gives200, and finalize returnsok. - 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 webthrough the proxy still work.