Files
hermes-agent/scripts
BearHuddleston 594add2fc0 fix(releases): hold trickled R2 responses to the time budget
A socket timeout bounds one wait, not one read. `res.read(n)`, the
whole-body `read()` in `signed_request` and the status/header
`readline()` loop recv until they have their bytes, so a peer that sends
a byte every few milliseconds kept a single call going past the
`time_budget` deadline: the budget was only checked between 1 MiB
chunks, and `signed_request` and `read_public_receipt` never checked it
while reading.

Under an active budget, `_connection` now gives the connection a
response class whose socket reader sets each wait's timeout to what the
budget has left (`_effective_timeout`) and raises once it is spent. That
covers the status line, headers and every body read in all four
readers, so the per-loop `_clamp_socket_timeout` / `_check_budget` calls
go away and the chunk loops read as they did before. Connections opened
outside a budget keep the stock response class.

Sends are unchanged: each `sendall` is bounded by the timeout the
connection opened with, which the budget already clamps, and the
reconcilers only PUT small JSON bodies.

Tests: a loopback server that sends headers or a body one byte every
20 ms holds each of `signed_request`, `read_public_receipt`,
`download_public_object` and `verify_remote_artifact` for the whole
10 s trickle on the previous head (8 failed); all raise `TimeoutError`
at the 0.5 s budget now. A trickle that stops at 2.5 s under a 3 s
budget pins the per-wait clamp: without it the last wait runs the
connection's full 3 s.
2026-11-29 13:06:26 -06:00
..
…