[GH-ISSUE #5142] [Bug] Process capture cancellation drops the explicit caller reason #3162

Closed
opened 2026-10-31 00:37:21 +00:00 by bsakaguchi · 1 comment
Owner

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

Area

Process capture or runtime observation.

Observed behavior and reproduction

On main d3627b1038, new exported-production-boundary tests for #4512 supplied an explicit Error abort reason. Both a request aborted before capture admission and a request aborted after the real executable descriptor opens returned a typed cancelled ProcessCaptureError with cause === undefined, losing the caller's exact reason. The uncontrolled launch reachability case passed. Two later sampling schedules independently reached the PTY sentinel after abort (#4512).

Ran npx vitest run --project process-global tests/process-global/processPrelaunchCancellation.test.ts:4 failed/1 passed. The before/open cases failed specifically on exact cause identity; the final-stat/close cases failed on launch count first. Native executable open/stat/stream/close were real; native ownership preflight was controlled, PTY was a throwing sentinel and no target was started. This is not public CLI/MCP or real-provider cancellation qualification.

Expected behavior

Preserve the explicit caller abort reason as the cause of typed cancellation, including admission and finalization. Root AGENTS and docs/tool-design.md#own-the-lifecycle require that fact to survive rather than be reconstructed downstream.

Root cause

processCaptureCancelled() accepts no reason. assertNotCancelled, cancellation normalization and the capture's exit/finalization consumers all construct this reasonless error. Fix the common error constructor and pass the exact signal reason at every owning producer, preserving completed observations and existing primary/cleanup precedence.

Impact and scope

Confirmed at shared capture API admission and post-open schedules. Source review shows the same constructor at active-exit and final-cleanup boundaries; those runtime schedules need relevant regression coverage. Natural incidence/severity is NOT_ENOUGH_INFO. Related #4512 controls execution admission; #4628 concerns composed cleanup projection, not this constructor's missing source fact.

Version / runtime / target

REA source d3627b1038; Node24.18.0, macOS arm64; local Node executable metadata. Other/exported capture boundary, earliest stage admission/cancellation.

Before submitting

  • Searched related cancellation issues and inspected #4512/#4628 plus the common source constructor.
  • No credentials or private target data included.
Originally created by @morluto on GitHub (Oct 19, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/5142 ## Area Process capture or runtime observation. ## Observed behavior and reproduction On main d3627b10382b0f28b12cad1543634e165470b29a, new exported-production-boundary tests for #4512 supplied an explicit `Error` abort reason. Both a request aborted before capture admission and a request aborted after the real executable descriptor opens returned a typed cancelled ProcessCaptureError with `cause === undefined`, losing the caller's exact reason. The uncontrolled launch reachability case passed. Two later sampling schedules independently reached the PTY sentinel after abort (#4512). Ran `npx vitest run --project process-global tests/process-global/processPrelaunchCancellation.test.ts`:4 failed/1 passed. The before/open cases failed specifically on exact cause identity; the final-stat/close cases failed on launch count first. Native executable open/stat/stream/close were real; native ownership preflight was controlled, PTY was a throwing sentinel and no target was started. This is not public CLI/MCP or real-provider cancellation qualification. ## Expected behavior Preserve the explicit caller abort reason as the cause of typed cancellation, including admission and finalization. Root AGENTS and docs/tool-design.md#own-the-lifecycle require that fact to survive rather than be reconstructed downstream. ## Root cause `processCaptureCancelled()` accepts no reason. `assertNotCancelled`, cancellation normalization and the capture's exit/finalization consumers all construct this reasonless error. Fix the common error constructor and pass the exact signal reason at every owning producer, preserving completed observations and existing primary/cleanup precedence. ## Impact and scope Confirmed at shared capture API admission and post-open schedules. Source review shows the same constructor at active-exit and final-cleanup boundaries; those runtime schedules need relevant regression coverage. Natural incidence/severity is NOT_ENOUGH_INFO. Related #4512 controls execution admission; #4628 concerns composed cleanup projection, not this constructor's missing source fact. ## Version / runtime / target REA source d3627b10382b0f28b12cad1543634e165470b29a; Node24.18.0, macOS arm64; local Node executable metadata. Other/exported capture boundary, earliest stage admission/cancellation. ## Before submitting - [x] Searched related cancellation issues and inspected #4512/#4628 plus the common source constructor. - [x] No credentials or private target data included.
bsakaguchi 2026-10-31 00:37:21 +00:00
  • closed this issue
  • added the
    triage
    bug
    labels
Author
Owner

@morluto commented on GitHub (Oct 19, 2026):

Fixed in d6ca7b3f20. The common cancellation constructor now accepts the owning caller's exact reason; all signal-aware capture producers pass it at admission, normalization, exit and finalization. Existing primary failures retain precedence. Tests cover explicit Error identity before acquisition and after real open, plus an object reason during terminal cleanup reporting while retaining a completed real Node capture and cleanup facts.

The unchanged d3627 baseline fails the new cause assertions. Final114 focused tests, full source checks, docs5 and discovery1608 passed. Full scope, costs, contributor credit and remaining failed-close ownership work (#5140) are recorded in https://github.com/morluto/rea/issues/4512#issuecomment-6257570744 .

<!-- gh-comment-id:6257574440 --> @morluto commented on GitHub (Oct 19, 2026): Fixed in d6ca7b3f20a273823c50d6253f0b6f34f3876f53. The common cancellation constructor now accepts the owning caller's exact reason; all signal-aware capture producers pass it at admission, normalization, exit and finalization. Existing primary failures retain precedence. Tests cover explicit Error identity before acquisition and after real open, plus an object reason during terminal cleanup reporting while retaining a completed real Node capture and cleanup facts. The unchanged d3627 baseline fails the new cause assertions. Final114 focused tests, full source checks, docs5 and discovery1608 passed. Full scope, costs, contributor credit and remaining failed-close ownership work (#5140) are recorded in https://github.com/morluto/rea/issues/4512#issuecomment-6257570744 .
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#3162
No description provided.