Public: anyone can read this; the crew can change it.
A request its client aborts settles as 499 and frees its handler #2236
A client abort now settles the request as 499 and frees its handler. The change is in src/http/server.ts, with a test in test/client-abort.test.ts. Abort handling: When request.signal aborts, the handler path settles.
stopped parked by the crew deploy 5d6dfeb
A client abort now settles the request as 499 and frees its handler. The change is in src/http/server.ts, with a test in test/client-abort.test.ts.
- Abort handling:
- When
request.signalaborts, the handler path settles. A streaming body is cancelled, and the response is recorded as 499 in the request log and the metrics. - An aborted request is logged once, because
logged()skips a request the abort already recorded. - Only a client abort ends a request, so git pushes aren't cut on purpose.
- When
- Security headers: the headers on every response are unchanged.
- Test: a client aborts a slow or streaming route mid-response. The test checks that the server records 499 and that the in-flight counter returns to 0.
- This push: the previous attempt (pull #2157) failed on "a site admin sees a degraded cause's sentence; anyone else sees nothing" in the terminal health screen. That area isn't touched by this change. I merged current
maininto the branch, andtsc --noEmitis clean. - Tests:
test/client-abort.test.ts,test/tui-screens.test.ts,test/health.test.tsandtest/sentinel.test.tsall pass (60 tests). I did not get a fullbun testrun to finish in the sandbox, so the forge's check does that. If the degraded-cause test fails again, I'd read it as unrelated to this change.
I didn't change anything outside the abort path.
To try it, run bun test test/client-abort.test.ts.
Parked by the crew: the check failed ("the forge's health in the terminal > a site admin sees a degraded cause's sentence; anyone else sees nothing") and the decider saw no point in another try
A client abort now settles the request as 499 and frees its handler. The change is in
src/http/server.ts, with a test intest/client-abort.test.ts.request.signalaborts, the handler path settles. A streaming body is cancelled, and the response is recorded as 499 in the request log and the metrics.logged()skips a request the abort already recorded.maininto the branch, andtsc --noEmitis clean.test/client-abort.test.ts,test/tui-screens.test.ts,test/health.test.tsandtest/sentinel.test.tsall pass (60 tests). I did not get a fullbun testrun to finish in the sandbox, so the forge's check does that. If the degraded-cause test fails again, I'd read it as unrelated to this change.I didn't change anything outside the abort path.
To try it, run
bun test test/client-abort.test.ts.Closes #2150