[GH-ISSUE #4932] [Bug] Module tracing loses completed resolution and cleanup recovery facts #3059

Closed
opened 2026-10-31 00:35:41 +00:00 by bsakaguchi · 1 comment
Owner

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

Before submitting

  • Searched cancellation/completion and module reports. #4261 repaired other observation services; #4227 is the parent lifecycle audit.
  • Controlled public fixtures only; no credentials or private targets.

Area

Evidence, artifacts, or reconstruction

Observed behavior

At 52b73ee85, WebModuleTraceService discards successful module-resolution results when cancellation is observed after the resolver returns. It also starts resolver work after artifact loading aborts the request. NativeModuleResolver drops completed batches when cancellation arrives during final browser.close and keeps original cleanup errors unresolved after retry success.

Reproduction

Added controlled service-port tests and production adapter tests using its typed launcher seam; no actual browser launched. Baseline service: 3 failed /13 passed (two opaque late reasons lost, and engine launched after admission cancellation). Baseline adapter: 3 failed /6 passed (original cleanup marker remains true after successful retry; completed batch/reason discarded on final close). Temporary baseline source was restored after the command joined; final source is under repair.

Expected behavior

Use one parsed completed-batch contract across success, cancelled finalization and failed cleanup. Bind it to every result-affecting request input, including import-map value/base URL. Build validated derived Evidence from available completed facts before classifying completion. Keep earlier primary failure/cleanup precedence and exact opaque abort reasons. Bind original cleanup errors to the exact owned browser lease and clear them only after confirmed release. Do not acquire the engine after artifact admission cancellation.

Impact and scope

Observed at shared service and native adapter seams on macOS; CLI/MCP both consume the service. NOT_ENOUGH_INFO for naturally occurring native faults or Chromium runtime frequency. Existing SDK MCP and engine-free CLI workflows will be checked separately; no live browser/target execution is claimed by the seam tests.

REA version

6.5.0; 52b73ee857.

Runtime and platform

Node24.18.0, macOS arm64.

Target and artifact context

Authored captured-source fixture and typed browser launcher seam. Selected application code is not executed.

Interface

Other: shared CLI/MCP application and native resolver adapter boundaries.

Earliest failure stage

Cleanup, cancellation, or lifecycle.

Relevant output or evidence

Service baseline 3failed/13passed; adapter baseline3failed/6passed. Sources: src/application/WebModuleTraceService.ts trace pre-Evidence abort, src/browser/modules/NativeModuleResolver.ts final result cancellation and retry cleanup. Existing close retry never resolves the original ProviderCleanupError. docs/tool-design.md Own the lifecycle requires exact caller reason and retained observations through final cleanup.

Typed outcome or recovery expected

Cancelled error with completed derived module Evidence; cleanup-incomplete keeps primary cancellation/failure and exact owned browser until release. Retry clears all original markers without reacquiring a browser. Unrelated/mismatched partial reports must not be adopted.

Originally created by @morluto on GitHub (Oct 18, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/4932 ### Before submitting - [x] Searched cancellation/completion and module reports. #4261 repaired other observation services; #4227 is the parent lifecycle audit. - [x] Controlled public fixtures only; no credentials or private targets. ### Area Evidence, artifacts, or reconstruction ### Observed behavior At 52b73ee85, WebModuleTraceService discards successful module-resolution results when cancellation is observed after the resolver returns. It also starts resolver work after artifact loading aborts the request. NativeModuleResolver drops completed batches when cancellation arrives during final browser.close and keeps original cleanup errors unresolved after retry success. ### Reproduction Added controlled service-port tests and production adapter tests using its typed launcher seam; no actual browser launched. Baseline service: 3 failed /13 passed (two opaque late reasons lost, and engine launched after admission cancellation). Baseline adapter: 3 failed /6 passed (original cleanup marker remains true after successful retry; completed batch/reason discarded on final close). Temporary baseline source was restored after the command joined; final source is under repair. ### Expected behavior Use one parsed completed-batch contract across success, cancelled finalization and failed cleanup. Bind it to every result-affecting request input, including import-map value/base URL. Build validated derived Evidence from available completed facts before classifying completion. Keep earlier primary failure/cleanup precedence and exact opaque abort reasons. Bind original cleanup errors to the exact owned browser lease and clear them only after confirmed release. Do not acquire the engine after artifact admission cancellation. ### Impact and scope Observed at shared service and native adapter seams on macOS; CLI/MCP both consume the service. NOT_ENOUGH_INFO for naturally occurring native faults or Chromium runtime frequency. Existing SDK MCP and engine-free CLI workflows will be checked separately; no live browser/target execution is claimed by the seam tests. ### REA version 6.5.0; 52b73ee857029a3ab8f5c6eeef233b295951a46c. ### Runtime and platform Node24.18.0, macOS arm64. ### Target and artifact context Authored captured-source fixture and typed browser launcher seam. Selected application code is not executed. ### Interface Other: shared CLI/MCP application and native resolver adapter boundaries. ### Earliest failure stage Cleanup, cancellation, or lifecycle. ### Relevant output or evidence Service baseline 3failed/13passed; adapter baseline3failed/6passed. Sources: src/application/WebModuleTraceService.ts trace pre-Evidence abort, src/browser/modules/NativeModuleResolver.ts final result cancellation and retry cleanup. Existing close retry never resolves the original ProviderCleanupError. docs/tool-design.md Own the lifecycle requires exact caller reason and retained observations through final cleanup. ### Typed outcome or recovery expected Cancelled error with completed derived module Evidence; cleanup-incomplete keeps primary cancellation/failure and exact owned browser until release. Retry clears all original markers without reacquiring a browser. Unrelated/mismatched partial reports must not be adopted.
bsakaguchi 2026-10-31 00:35:41 +00:00
  • closed this issue
  • added the
    triage
    bug
    labels
Author
Owner

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

Published 94bc7ed322 on main.

Repaired the producing boundary and shared consumer together.

  • Domain owns one native batch/request/partial-observation contract. Interrupted reports bind importer URL, import-map base/value and ordered specifiers; mismatched or incomplete reports are not adopted.
  • NativeModuleResolver retains completed batches through cancelled or failed final browser cleanup. Exact AnalysisCleanupLease authority replaces raw browser-only retention; initial, retry and composed cleanup errors resolve only after that lease releases.
  • SDK promise settlement is observed at the producer. An owned stop tags only a still-pending SDK operation; already-rejected launch/context calls retain their physical primary. Explicit checkpoints preserve exact opaque reasons without treating caller error tags as authority. Caller and virtual-deadline active-stop controls pass.
  • WebModuleTraceService validates the report and builds derived Evidence before completion classification, reuses completeProviderEvidence, refuses engine admission after abort and converts only a request-bound completed failure report into Evidence while retaining the original error/cleanup bindings. Engine-free completion is retained too.
  • SDK MCP tests use the production service and native adapter with a controlled launcher. They prove retained Evidence registration and original cleanup marker recovery after failed then successful server close. Errors use the SDK's text transport; no structured-error wire field is assumed.

Validation executed: 83 tests passed across nine selected files, check:fast, docs:check (including five conformance tests), test discovery1569, and normal hooks. Initial service baseline3fail13pass; native baseline3fail6pass. Two read-only reviews completed after fixing the additional independent-rejection/active-stop attribution gap. No live Chromium, naturally occurring SDK fault, native Linux/Windows qualification or actual transport cancellation delivery is claimed. Public CLI controls are engine-free; source-map CLI also runs its actual owned codec.

Bounded cost check: six completed public engine-free CLI traces on an authored computed-import script, alternating pinned baseline52b73ee85 and fixed build. Complete normalized result and independently authored source hash agree. Warm medians: elapsed 0.3719 -> 0.3714s; CPU 0.5374 -> 0.5364s; sampled PPID-family peak RSS 317.26 -> 319.29MiB; reply-only cl100k estimate1268 unchanged. First process plus warm repeats, no OS cache flush. wait4 CPU includes reaped children;10ms RSS sampling can miss transient/reparented children. Actual/full-agent tokens, schemas, MCP/native resolution, error recovery and large import-map costs remain unmeasured. No speedup claim. Heavy stress/profiling remain stopped; temporary baseline worktree removed.

This closes the named module lifecycle finding. Other cancellation constructors and the full issue/codebase audit remain active; no whole-area or whole-repository completion claim.

<!-- gh-comment-id:6244062436 --> @morluto commented on GitHub (Oct 18, 2026): Published 94bc7ed3222ab6ca33fe68f58326eefb91689904 on main. Repaired the producing boundary and shared consumer together. - Domain owns one native batch/request/partial-observation contract. Interrupted reports bind importer URL, import-map base/value and ordered specifiers; mismatched or incomplete reports are not adopted. - NativeModuleResolver retains completed batches through cancelled or failed final browser cleanup. Exact AnalysisCleanupLease authority replaces raw browser-only retention; initial, retry and composed cleanup errors resolve only after that lease releases. - SDK promise settlement is observed at the producer. An owned stop tags only a still-pending SDK operation; already-rejected launch/context calls retain their physical primary. Explicit checkpoints preserve exact opaque reasons without treating caller error tags as authority. Caller and virtual-deadline active-stop controls pass. - WebModuleTraceService validates the report and builds derived Evidence before completion classification, reuses completeProviderEvidence, refuses engine admission after abort and converts only a request-bound completed failure report into Evidence while retaining the original error/cleanup bindings. Engine-free completion is retained too. - SDK MCP tests use the production service and native adapter with a controlled launcher. They prove retained Evidence registration and original cleanup marker recovery after failed then successful server close. Errors use the SDK's text transport; no structured-error wire field is assumed. Validation executed: 83 tests passed across nine selected files, check:fast, docs:check (including five conformance tests), test discovery1569, and normal hooks. Initial service baseline3fail13pass; native baseline3fail6pass. Two read-only reviews completed after fixing the additional independent-rejection/active-stop attribution gap. No live Chromium, naturally occurring SDK fault, native Linux/Windows qualification or actual transport cancellation delivery is claimed. Public CLI controls are engine-free; source-map CLI also runs its actual owned codec. Bounded cost check: six completed public engine-free CLI traces on an authored computed-import script, alternating pinned baseline52b73ee85 and fixed build. Complete normalized result and independently authored source hash agree. Warm medians: elapsed 0.3719 -> 0.3714s; CPU 0.5374 -> 0.5364s; sampled PPID-family peak RSS 317.26 -> 319.29MiB; reply-only cl100k estimate1268 unchanged. First process plus warm repeats, no OS cache flush. wait4 CPU includes reaped children;10ms RSS sampling can miss transient/reparented children. Actual/full-agent tokens, schemas, MCP/native resolution, error recovery and large import-map costs remain unmeasured. No speedup claim. Heavy stress/profiling remain stopped; temporary baseline worktree removed. This closes the named module lifecycle finding. Other cancellation constructors and the full issue/codebase audit remain active; no whole-area or whole-repository completion claim.
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#3059
No description provided.