diff --git a/docs/plans/v2.1/01-cancel-record.md b/docs/plans/v2.1/01-cancel-record.md index 5b0cc6d..b4f23be 100644 --- a/docs/plans/v2.1/01-cancel-record.md +++ b/docs/plans/v2.1/01-cancel-record.md @@ -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 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 - Copy: `internal/proxy/served_test.go` diff --git a/docs/plans/v2.1/README.md b/docs/plans/v2.1/README.md index 28e8647..f4d674b 100644 --- a/docs/plans/v2.1/README.md +++ b/docs/plans/v2.1/README.md @@ -31,4 +31,8 @@ was discarded. ## 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.