carlos / platform Public

edge: keep reading Request.Cancel when classifying a tunnel failure

http.Request.Cancel is deprecated, but x/net's ClientConn still honours
it, so a caller's Cancel can end an attempt while the context stays
live. reachNotWritten has to stay off in that case: the request may be
retried on another copy only when it provably was not sent.

Comment only. The lint:ignore names why the read stays.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev ecf8fa5c372bb15141b0ec3dd6eeff36936035fe parent 51914ba
1 file changed, +1 −0
  • internal/edge/tunnel.go +1 −0
diff --git a/internal/edge/tunnel.go b/internal/edge/tunnel.go
index d43d18d5d..f5df7668c 100644
--- a/internal/edge/tunnel.go
+++ b/internal/edge/tunnel.go
@@ -945,6 +945,7 @@ func (h *TunnelHub) replicaRoundTrip(channel string, req *http.Request) (*http.R
switch {
case err == nil || resp != nil:
return resp, reachMaybe, err
+ //lint:ignore SA1019 x/net's ClientConn still honours Request.Cancel, so a caller's Cancel can end the attempt with the context live
case !wrote.Load() && req.Context().Err() == nil && req.Cancel == nil:
return nil, reachNotWritten, err
case refusedByBox(err):