[GH-ISSUE #5388] [Bug] Source-map cancellation loses observed codec failures and the caller abort reason #3262

Closed
opened 2026-10-31 00:38:32 +00:00 by bsakaguchi · 0 comments
Owner

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

Before submitting

  • Searched open and closed source-map cancellation reports and PRs, including #5332, #5292, #5385, #4227 and closed/unmerged PR #1919.
  • Only authored Node helpers and temporary runtime files were used; no private samples or credentials.

Area

Evidence, artifacts, or reconstruction.

Observed behavior

A controlled source-map command probe loses an observed process failure to later cancellation. ProviderProcessSupervisor.observedExit() had returned {code:7,signal:null} before the caller aborted while output draining was held. runSourceMapCommand returned AnalysisCancelledError instead of the exit failure. Without cancellation, the same helper returns ProviderAdapterError with diagnostic exit_code:7.

A separate pre-aborted request also returns AnalysisCancelledError with cause === undefined, instead of the exact opaque caller reason. Thus both failure priority and cancellation provenance are lost at this owner.

Reproduction

Executed through production runSourceMapCommand with its injected launcher/runtime seams and the real process supervisor:

  1. The launcher runs an authored Node helper that writes stderr physical exit 7, starts a short-lived owned Node descendant holding inherited output open, then exits7. This is a controlled transport-drain fixture, not the real source-map codec or target execution.
  2. Intercept waitForOutputClose on the actual supervisor. Only after this.observedExit() returns exit7, record it and abort with an object reason before allowing collection to continue.
  3. Assert a ProviderAdapterError retaining exit7. Current source instead produces cancellation. The private runtime directory is gone after the operation.
  4. Control: identical helper without abort yields ProviderAdapterError/exit7 and removes the runtime.
  5. Independent control: pass an already-aborted signal with an object reason and assert error.cause === reason; current cause is undefined.

Three source-only Vitest cases executed: two red assertions and the no-abort control green. No actual source-map codec, browser, CLI/MCP client or native analysis target ran. The descendant only makes the existing output-drain stage deterministic; no frequency claim is made for real codec runs.

Expected behavior

Preserve the failure observed before interruption, including status and diagnostics. Do not let delayed classification erase that event order. If cancellation occurs first, return typed cancellation with the exact caller reason as opaque data. Keep cleanup ownership independent.

Impact and scope

The caller receives cancellation instead of the observed helper error and loses provenance. Actual source-map workload frequency is NOT_ENOUGH_INFO. The fixture exercises the shared command boundary used by source-map tracing; public CLI/MCP delivery was source-mapped, not executed. Runtime removal was checked; no independent all-descendant final census was made.

REA version / runtime

Source799e8265b254e225dc1dabdd25e56f0ab7f86bd3, package6.7.0, with unrelated local changes. SourceMapCommand.ts is unchanged from that revision and byte-identical to remote main074768901f3cdc8205b61773fb1faf6f6c7b3ca8 (source comparison only). Node24.18.0, Darwin25.3.0 arm64.

Target / interface / earliest failure stage

Authored helper processes and temporary files; production source-map command boundary; capture or observation, then cancellation/finalization.

Relevant evidence and analysis

Reduced observations:

Before abort: supervisor.observedExit() = { code: 7, signal: null }
With late abort: AnalysisCancelledError; caller cause absent
Without abort: ProviderAdapterError; diagnostics.exit_code = 7
Already aborted: AnalysisCancelledError; caller cause absent

OwnedCodec.collect checks interruption before consuming/classifying the process snapshot. check and failure construct cause-less cancellation and prioritize current interruption. Decoder and WebSourceLocationService also contain cause-less cancellation checks; those additional sites were source-reviewed, not independently probed here.

#5292 and #5385 establish the same event-order requirement in other process owners; #5332 covers exact caller-reason loss in EVM. Closed/unmerged PR #1919 changes helper supervision and cleanup policy; it is not a production fix. No source-map fix is claimed in this report.

Originally created by @morluto on GitHub (Oct 20, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/5388 ## Before submitting - [x] Searched open and closed source-map cancellation reports and PRs, including #5332, #5292, #5385, #4227 and closed/unmerged PR #1919. - [x] Only authored Node helpers and temporary runtime files were used; no private samples or credentials. ## Area Evidence, artifacts, or reconstruction. ## Observed behavior A controlled source-map command probe loses an observed process failure to later cancellation. `ProviderProcessSupervisor.observedExit()` had returned `{code:7,signal:null}` before the caller aborted while output draining was held. `runSourceMapCommand` returned `AnalysisCancelledError` instead of the exit failure. Without cancellation, the same helper returns `ProviderAdapterError` with diagnostic `exit_code:7`. A separate pre-aborted request also returns `AnalysisCancelledError` with `cause === undefined`, instead of the exact opaque caller reason. Thus both failure priority and cancellation provenance are lost at this owner. ## Reproduction Executed through production `runSourceMapCommand` with its injected launcher/runtime seams and the real process supervisor: 1. The launcher runs an authored Node helper that writes stderr `physical exit 7`, starts a short-lived owned Node descendant holding inherited output open, then exits7. This is a controlled transport-drain fixture, not the real source-map codec or target execution. 2. Intercept `waitForOutputClose` on the actual supervisor. Only after `this.observedExit()` returns exit7, record it and abort with an object reason before allowing collection to continue. 3. Assert a `ProviderAdapterError` retaining exit7. Current source instead produces cancellation. The private runtime directory is gone after the operation. 4. Control: identical helper without abort yields `ProviderAdapterError`/exit7 and removes the runtime. 5. Independent control: pass an already-aborted signal with an object reason and assert `error.cause === reason`; current cause is undefined. Three source-only Vitest cases executed: two red assertions and the no-abort control green. No actual source-map codec, browser, CLI/MCP client or native analysis target ran. The descendant only makes the existing output-drain stage deterministic; no frequency claim is made for real codec runs. ## Expected behavior Preserve the failure observed before interruption, including status and diagnostics. Do not let delayed classification erase that event order. If cancellation occurs first, return typed cancellation with the exact caller reason as opaque data. Keep cleanup ownership independent. ## Impact and scope The caller receives cancellation instead of the observed helper error and loses provenance. Actual source-map workload frequency is NOT_ENOUGH_INFO. The fixture exercises the shared command boundary used by source-map tracing; public CLI/MCP delivery was source-mapped, not executed. Runtime removal was checked; no independent all-descendant final census was made. ## REA version / runtime Source799e8265b254e225dc1dabdd25e56f0ab7f86bd3, package6.7.0, with unrelated local changes. SourceMapCommand.ts is unchanged from that revision and byte-identical to remote main074768901f3cdc8205b61773fb1faf6f6c7b3ca8 (source comparison only). Node24.18.0, Darwin25.3.0 arm64. ## Target / interface / earliest failure stage Authored helper processes and temporary files; production source-map command boundary; capture or observation, then cancellation/finalization. ## Relevant evidence and analysis Reduced observations: ```text Before abort: supervisor.observedExit() = { code: 7, signal: null } With late abort: AnalysisCancelledError; caller cause absent Without abort: ProviderAdapterError; diagnostics.exit_code = 7 Already aborted: AnalysisCancelledError; caller cause absent ``` [`OwnedCodec.collect`](https://github.com/morluto/rea/blob/074768901f3cdc8205b61773fb1faf6f6c7b3ca8/src/javascript/sourceMaps/SourceMapCommand.ts#L193-L225) checks interruption before consuming/classifying the process snapshot. [`check` and `failure`](https://github.com/morluto/rea/blob/074768901f3cdc8205b61773fb1faf6f6c7b3ca8/src/javascript/sourceMaps/SourceMapCommand.ts#L229-L255) construct cause-less cancellation and prioritize current interruption. Decoder and WebSourceLocationService also contain cause-less cancellation checks; those additional sites were source-reviewed, not independently probed here. ## Related work #5292 and #5385 establish the same event-order requirement in other process owners; #5332 covers exact caller-reason loss in EVM. Closed/unmerged PR #1919 changes helper supervision and cleanup policy; it is not a production fix. No source-map fix is claimed in this report.
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#3262
No description provided.