feat(cache): record transport fields on a failed transfer - #44048
marcelolynch wants to merge 3 commits into
Conversation
PR summary 3b776b8315Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
5a1a8dd to
2fedfef
Compare
A transfer that answers 200 and then stops mid-body fails the build job, and the failure line reports only the status and the curl exit code. Add curl's own per-transfer fields, so the line also says how many bytes arrived and which server answered. No transfer behavior changes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2fedfef to
fe3300b
Compare
| -/ | ||
| def curlGetWriteOut : String := | ||
| "{\"curl\":%{json}," ++ | ||
| "\"cf_ray\":\"%header{cf-ray}\"," ++ |
There was a problem hiding this comment.
Apparently %header{} was only added in curl 7.84.0 which is higher than all the other versions we require.
Claude also suggested a solution using %{header_json} here (which is in 7.83.0) that lets curl take care of escaping, but I guess that only matters if we might add other headers later on.
There was a problem hiding this comment.
ah, good catch. this is mainly for CI so I wouldn't sweat not supporting the diagnostics if they're not there, but it needs to be guarded
There was a problem hiding this comment.
Sorry if I'm misunderstanding: did you want to add a guard first, or do you think this is ready to go?
Get cachefailed 6 of 260 master and staging runs in the week to 2026-09-21. curl receives HTTP 200, then the connection stops mid-body. The log records only this:The line omits how far the body got and which edge served it. curl can report both, so append them:
bytesgives the truncation point against the sizecontent-lengthpromised, sobytes=0/1421777means nothing arrived.cf_raynames the colo in its suffix and finds the request in Cloudflare's own logs.cf_cache_statussays whether the edge cache served the body. Each value describes curl's final attempt, because--retryhides the earlier ones.curl's
%{json}report carries no response headers, so the get path nests that report inside an object that also records the headers.monitorCurlmerges the two only where it reports a failure, so the per-transfer path does the same work as before. A backend that sends nocf-*header contributes fewer pairs.The upload path shares
monitorCurland keeps writing curl's object on its own. Its failure lines gainbytes,http_versionandtime_total, and carry nocf-*pair.bytesfollows the direction, because curl reports the error response body insize_download: a read countssize_download, a write countssize_upload.Only the failure line changes. Transfer behavior stays the same.
Tested against local servers that answer 200 and then truncate, with and without
cf-*headers; the line above is one such result.lake build cacheis clean.The next failure in CI shows where the body stopped and which colo served it.
🤖 Generated with Claude Code