v2.1 task 01: state the ReverseProxy facts (ErrorHandler before headers, ErrAbortHandler mid-body); note the refusal-ending

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 11:26:01 -07:00
co-authored by Claude Fable 5.1
parent d596ec8abf
commit 317293cfb3
2 changed files with 22 additions and 1 deletions
+17
View File
@@ -23,6 +23,23 @@ responses under the given test's load; `TestQueueFullIs503` flaked on it. The re
`ErrorHandler` already sees `context.Canceled` for the "client gone before the response" case `ErrorHandler` already sees `context.Canceled` for the "client gone before the response" case
and currently returns without leaving a trace, which is why the post-hoc check was there. and currently returns without leaving a trace, which is why the post-hoc check was there.
## Facts about `httputil.ReverseProxy` (Go 1.26) — you cannot read its source from here
The standard library lives outside the repository and the sandbox refuses reads there; do not
try. What you need:
- `ServeHTTP` calls `ErrorHandler(w, req, err)` when the outgoing request fails **before any
response byte was written** — for a client that left, `err` satisfies
`errors.Is(err, context.Canceled)`. After the response headers were written, `ErrorHandler`
is never called.
- If copying the response body to the client fails (the client left mid-body), `ServeHTTP`
**panics with `http.ErrAbortHandler`**; v1.1's deferred `recover` in `forward.go` already
turns that into the 499 row and re-panics.
- `ServeHTTP` returning normally therefore means the response was delivered in full (or
`ErrorHandler` answered). The request's context may nonetheless already be cancelled at that
moment — the server cancels it when the client's connection closes — which is exactly the
signal the current code misreads.
## Files ## Files
- Copy: `internal/proxy/served_test.go` - Copy: `internal/proxy/served_test.go`
+5 -1
View File
@@ -31,4 +31,8 @@ was discarded.
## Changes during the run ## Changes during the run
(none yet) - 2026-09-25, task 01, first session: 8 minutes of reading, then it tried to read Go's
`httputil/reverseproxy.go` from the nix store, the sandbox refused, and it ended the turn
without a commit — the eighth refusal-ending of the day. Model fault, but the want was
legitimate: the task now states the `ReverseProxy` facts it was after and says the standard
library cannot be read from the sandbox. Restarted.