SIGN IN SIGN UP

fix(daemon): stop a mid-stream error from crashing the whole daemon

renderDaemonError tried to writeHead a fresh JSON error onto a
connection that had already started an SSE/native-passthrough
response, throwing ERR_HTTP_HEADERS_SENT uncaught and killing the
shared daemon process for every active session. Guard on
res.headersSent and make the outer catch resilient to a second
failure.

Also fixes the likely trigger: forwardNativeCodexRequest's
passthrough loop had no catch around reader.read(), so a client
disconnect mid-stream (after headers were already sent) threw
straight past it.
R
Riccardo Giorato committed
4b317549d5bbc575b955eaeb69ee3519fdb02dd8
Parent: c487483