[GH-ISSUE #6038] test(package): retain registry proxy failures and stop updater helpers #3683

Open
opened 2026-10-31 00:43:01 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @matbrgz on GitHub (Oct 21, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/6038

Observed failure

While validating PR #3029 on the current instruction-boundary revision (base ccc7da309, Node 24.18.0/npm 11.16.0, macOS arm64), npm run verify:package completed installation, entered package update, and exited with:

Error [ERR_HTTP_HEADERS_SENT]: Cannot write headers after they are sent to the client
    at ServerResponse.writeHead (node:_http_server:407:11)
    at scripts/verify-package-update.mjs:29:16

The original proxy error was not retained. The verifier process exited while its generated verify-update.mjs helper and npm install rea-agents@6.7.0 child remained orphaned. Their recorded parent/start identities were observed before and after the failure; they later exited, and the source-owned temporary workspace was removed after confirming those processes were gone. No target executable was run.

Source-derived cause and limits

The fixture calls response.writeHead(upstream.status, ...) before awaiting upstream.arrayBuffer(). Its async error callback unconditionally calls writeHead(500). A body/response failure after header commitment can therefore mask the original failure with a second header-write exception. The exact triggering upstream error was not captured; a pristine-main runtime rerun and a deterministic injected stream failure have not been performed. The fixture source is unchanged by #3029.

Suggested acceptance

  • Preserve the primary proxy/read failure; avoid a second header write after commitment.
  • Consume/validate the upstream body before committing the downstream response where appropriate, and close an already-started response on failure.
  • Route fixture failures through the awaited verifier owner so its helper/installer are stopped and joined before workspace cleanup.
  • Add a controlled failing-body/response regression independent of the public registry, asserting the original error and no surviving owned descendants.
  • Re-run package installation/update and positively verify cleanup.

This is a follow-up validation-fixture issue, separate from the SEH feature in #3029 and #2926. The failed full-package attempt must not be reported as a passed gate.

Originally created by @matbrgz on GitHub (Oct 21, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/6038 ## Observed failure While validating PR #3029 on the current instruction-boundary revision (base ccc7da309, Node 24.18.0/npm 11.16.0, macOS arm64), `npm run verify:package` completed installation, entered `package update`, and exited with: ```text Error [ERR_HTTP_HEADERS_SENT]: Cannot write headers after they are sent to the client at ServerResponse.writeHead (node:_http_server:407:11) at scripts/verify-package-update.mjs:29:16 ``` The original proxy error was not retained. The verifier process exited while its generated `verify-update.mjs` helper and `npm install rea-agents@6.7.0` child remained orphaned. Their recorded parent/start identities were observed before and after the failure; they later exited, and the source-owned temporary workspace was removed after confirming those processes were gone. No target executable was run. ## Source-derived cause and limits The [fixture](https://github.com/morluto/rea/blob/ccc7da309/scripts/verify-package-update.mjs) calls `response.writeHead(upstream.status, ...)` before awaiting `upstream.arrayBuffer()`. Its async error callback unconditionally calls `writeHead(500)`. A body/response failure after header commitment can therefore mask the original failure with a second header-write exception. The exact triggering upstream error was not captured; a pristine-main runtime rerun and a deterministic injected stream failure have not been performed. The fixture source is unchanged by #3029. ## Suggested acceptance - [ ] Preserve the primary proxy/read failure; avoid a second header write after commitment. - [ ] Consume/validate the upstream body before committing the downstream response where appropriate, and close an already-started response on failure. - [ ] Route fixture failures through the awaited verifier owner so its helper/installer are stopped and joined before workspace cleanup. - [ ] Add a controlled failing-body/response regression independent of the public registry, asserting the original error and no surviving owned descendants. - [ ] Re-run package installation/update and positively verify cleanup. This is a follow-up validation-fixture issue, separate from the SEH feature in #3029 and #2926. The failed full-package attempt must not be reported as a passed gate.
Author
Owner

@CassieFox23 commented on GitHub (Oct 22, 2026):

I'd like to take this one, with a small fix. The fixture will read the upstream body before it writes headers. If something fails after the headers go out, it will close the response. It won't write a second header, and it will keep the first error. A test will inject a body failure to show the old and new behavior on Linux.

Thanks, matbrgz, for the clear source trace.

🤖 Written with Claude Code (Opus 5.5), posted with my OK 🦊

<!-- gh-comment-id:6346364080 --> @CassieFox23 commented on GitHub (Oct 22, 2026): I'd like to take this one, with a small fix. The fixture will read the upstream body before it writes headers. If something fails after the headers go out, it will close the response. It won't write a second header, and it will keep the first error. A test will inject a body failure to show the old and new behavior on Linux. Thanks, matbrgz, for the clear source trace. 🤖 Written with Claude Code (Opus 5.5), posted with my OK 🦊
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#3683
No description provided.