[PR #1919] [CLOSED] fix(process): share codec supervision and retain failed cleanup owners #4909

Closed
opened 2026-10-31 00:56:40 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1919
Author: @Hyped01
Created: 10/11/2026
Status: ❌ Closed

Base: main ← Head: fix/har-decoder-direct-child


📝 Commits (6)

  • 655590c fix(browser): decode HAR captures without native process-group inspection
  • 82a6af0 fix(process): consolidate internal codec ownership
  • 2940079 Merge remote-tracking branch 'origin/main' into codex/consolidate-codec-ownership
  • 78ee552 fix(browser): preserve retained capture cleanup provenance
  • 7d56e10 fix(process): retain Windows helper kill-on-close ownership
  • ba21112 fix(browser): preserve concurrent capture cleanup failures

📊 Changes

23 files changed (+1258 additions, -214 deletions)

View changed files

📝 docs/installation.md (+7 -7)
📝 docs/process-capture.md (+7 -3)
📝 docs/web-network-captures.md (+17 -6)
📝 docs/web-source-location.md (+15 -11)
📝 src/application/WebNetworkCapturePort.ts (+2 -0)
📝 src/application/WebNetworkCaptureService.ts (+5 -0)
📝 src/artifacts/ArtifactResourceScope.test.ts (+21 -3)
📝 src/artifacts/ArtifactResourceScope.ts (+45 -15)
📝 src/browser/history/HarCaptureAdapter.ts (+2 -0)
📝 src/browser/history/HistoricalCaptureDecoder.ts (+240 -30)
📝 src/browser/history/HistoricalCaptureFormatAdapter.ts (+7 -0)
📝 src/browser/history/MitmproxyCaptureAdapter.ts (+1 -0)
📝 src/cli/webNetworkCaptureCommands.ts (+26 -22)
📝 src/javascript/sourceMaps/SourceMapCommand.ts (+17 -47)
📝 src/process/OwnedCommand.ts (+80 -27)
📝 src/process/ProviderProcess.ts (+51 -0)
📝 src/server/createServer.ts (+4 -0)
📝 tests/acceptance/webSourceLocationCli.test.ts (+2 -4)
📝 tests/boundary/browser/historicalCaptureDecoder.test.ts (+407 -3)
📝 tests/boundary/browser/historicalWebCapture.test.ts (+26 -1)

...and 3 more files

📄 Description

Summary

HAR and source-map decoding should work without native process-group inspection when REA owns a helper that creates no descendants. The shared internal-helper launcher uses the child handle on Linux/macOS and the existing owned Job Object launcher on Windows, including kill-on-owner-close and any requested memory limit.

Historical capture cleanup also retains the supervisor and private directory together after an incomplete process stop. A later inspection or shutdown retries the same owners before removing private files or admitting new decoding.

This extends @Hyped01's original HAR fix; its commit remains in the branch. There is no separate issue for the additional cleanup ownership gap found during review.

Change and scope

  • Centralize helper launch policy in src/process/ProviderProcess.ts; HAR and source-map codecs reuse it. External mitmdump retains process-group supervision.
  • Reuse ArtifactResourceScope for capture admission, active-operation draining, retained cleanup and shutdown. Transfer an already-failed owner without immediately repeating its bounded stop attempt.
  • Preserve original stdout/stderr, exit status, source resource identifiers and typed failure diagnostics. Retry diagnostics keep resources as separate values.
  • Close the actual capture service used by CLI/MCP. Failed MCP shutdown remains retryable.
  • Remove the obsolete source-map ownership-preparation seam, its synthetic timer test, a policy-literal assertion and the enlarged cold-preparation test timeout. Bound source-map diagnostic retention while draining output.

Contract and boundary impact

  • Semantic owner: process launch/supervision and capture resource lifetime.
  • CLI/MCP inputs and tool catalog: unchanged. Successful Evidence remains the same; Linux/macOS internal decoding no longer requires native process-group inspection. Windows retains its native ownership prerequisite.
  • Format/provenance: unchanged; selected files, order, original diagnostics and explicit-sensitive projection remain preserved.
  • Authority: Linux/macOS child handles supervise only REA helpers without descendants. Windows helpers retain explicit Job Object kill-on-owner-close. Requested memory limits never fall back to an unenforced child.
  • Package and generated metadata: no changes. Documentation clarifies the Windows native ownership prerequisite.

Evidence and regression coverage

Executed on macOS with pinned Node 24.18.0:

  • Seven focused files: 51 passed, 2 Linux-only mitmdump cases skipped, in 6.64 s. Individual cases stayed below 2.3 s.
  • Public HAR CLI and source-map CLI/stdio MCP workflows succeed with DEVELOPER_DIR pointing to a missing directory. Source-map CLI/MCP Evidence matches.
  • Real child cancellation and timeout escalation pass. Injected cleanup failures verify owner retention, blocked admission, original diagnostics, separate resource values and retry on close.
  • Build, npm run check:fast (including the pre-push run), and npm run docs:check pass.

The inspector-unavailable workflows would invoke native preparation on the affected base. Failed cleanup previously removed the capture root instead of retaining it with the process owner.

Compatibility, safety, and release

No public breaking change or migration. Windows Job Object enforcement (Node/Bun) and Linux mitmdump behavior were reviewed in source, not executed on this Mac. The existing heavy HAR heap-exhaustion lane was not rerun. No CPU speedup is claimed. No real Hopper, Ghidra or IDA behavior is claimed by these checks.

Review follow-up: retained scope failures now carry their actual owner/cause pairs. A cleanup retry triggered by a different capture format reports the original provider and already-redacted timeout/output diagnostics, with current resource identities and cleanup reason. The focused scope, historical decoder and MCP lifecycle run passed (25 tests, 2 Linux-only permission cases skipped); runtime build and fast checks passed.

Final review follow-ups: all Windows internal helpers retain the existing native kill-on-owner-close Job Object launcher; direct handles remain Linux/macOS only. Concurrent cleanup retries preserve every owner’s current resources/reason and original typed/redacted diagnostics in a per-owner list. The default MCP factory regression confirms one service creation and retryable shutdown; no extra service was constructed because registration receives selectedOptions. Final five-file boundary run: 48 passed, 2 Linux-only cases skipped; the capture regression rerun passed 19 with the same 2 skips. Build, fast checks and docs checks pass. Real Windows execution remains unverified locally.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/1919 **Author:** [@Hyped01](https://github.com/Hyped01) **Created:** 10/11/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/har-decoder-direct-child` --- ### 📝 Commits (6) - [`655590c`](https://github.com/morluto/rea/commit/655590c81871030242030abc8f538d7bf2acf170) fix(browser): decode HAR captures without native process-group inspection - [`82a6af0`](https://github.com/morluto/rea/commit/82a6af007b0993469f5883311263a16d6c609d67) fix(process): consolidate internal codec ownership - [`2940079`](https://github.com/morluto/rea/commit/2940079af87af2c99e1099f1389b2624e041f03e) Merge remote-tracking branch 'origin/main' into codex/consolidate-codec-ownership - [`78ee552`](https://github.com/morluto/rea/commit/78ee5526b95c7a46db7d4bfe6d2d786fdf944594) fix(browser): preserve retained capture cleanup provenance - [`7d56e10`](https://github.com/morluto/rea/commit/7d56e104a5dbb627e22f199e8b60a01d87d42fc3) fix(process): retain Windows helper kill-on-close ownership - [`ba21112`](https://github.com/morluto/rea/commit/ba21112e67f6759caaeb50c5342ebbd7d06bef3f) fix(browser): preserve concurrent capture cleanup failures ### 📊 Changes **23 files changed** (+1258 additions, -214 deletions) <details> <summary>View changed files</summary> 📝 `docs/installation.md` (+7 -7) 📝 `docs/process-capture.md` (+7 -3) 📝 `docs/web-network-captures.md` (+17 -6) 📝 `docs/web-source-location.md` (+15 -11) 📝 `src/application/WebNetworkCapturePort.ts` (+2 -0) 📝 `src/application/WebNetworkCaptureService.ts` (+5 -0) 📝 `src/artifacts/ArtifactResourceScope.test.ts` (+21 -3) 📝 `src/artifacts/ArtifactResourceScope.ts` (+45 -15) 📝 `src/browser/history/HarCaptureAdapter.ts` (+2 -0) 📝 `src/browser/history/HistoricalCaptureDecoder.ts` (+240 -30) 📝 `src/browser/history/HistoricalCaptureFormatAdapter.ts` (+7 -0) 📝 `src/browser/history/MitmproxyCaptureAdapter.ts` (+1 -0) 📝 `src/cli/webNetworkCaptureCommands.ts` (+26 -22) 📝 `src/javascript/sourceMaps/SourceMapCommand.ts` (+17 -47) 📝 `src/process/OwnedCommand.ts` (+80 -27) 📝 `src/process/ProviderProcess.ts` (+51 -0) 📝 `src/server/createServer.ts` (+4 -0) 📝 `tests/acceptance/webSourceLocationCli.test.ts` (+2 -4) 📝 `tests/boundary/browser/historicalCaptureDecoder.test.ts` (+407 -3) 📝 `tests/boundary/browser/historicalWebCapture.test.ts` (+26 -1) _...and 3 more files_ </details> ### 📄 Description ## Summary HAR and source-map decoding should work without native process-group inspection when REA owns a helper that creates no descendants. The shared internal-helper launcher uses the child handle on Linux/macOS and the existing owned Job Object launcher on Windows, including kill-on-owner-close and any requested memory limit. Historical capture cleanup also retains the supervisor and private directory together after an incomplete process stop. A later inspection or shutdown retries the same owners before removing private files or admitting new decoding. This extends @Hyped01's original HAR fix; its commit remains in the branch. There is no separate issue for the additional cleanup ownership gap found during review. ## Change and scope - Centralize helper launch policy in `src/process/ProviderProcess.ts`; HAR and source-map codecs reuse it. External mitmdump retains process-group supervision. - Reuse `ArtifactResourceScope` for capture admission, active-operation draining, retained cleanup and shutdown. Transfer an already-failed owner without immediately repeating its bounded stop attempt. - Preserve original stdout/stderr, exit status, source resource identifiers and typed failure diagnostics. Retry diagnostics keep resources as separate values. - Close the actual capture service used by CLI/MCP. Failed MCP shutdown remains retryable. - Remove the obsolete source-map ownership-preparation seam, its synthetic timer test, a policy-literal assertion and the enlarged cold-preparation test timeout. Bound source-map diagnostic retention while draining output. ## Contract and boundary impact - Semantic owner: process launch/supervision and capture resource lifetime. - CLI/MCP inputs and tool catalog: unchanged. Successful Evidence remains the same; Linux/macOS internal decoding no longer requires native process-group inspection. Windows retains its native ownership prerequisite. - Format/provenance: unchanged; selected files, order, original diagnostics and explicit-sensitive projection remain preserved. - Authority: Linux/macOS child handles supervise only REA helpers without descendants. Windows helpers retain explicit Job Object kill-on-owner-close. Requested memory limits never fall back to an unenforced child. - Package and generated metadata: no changes. Documentation clarifies the Windows native ownership prerequisite. ## Evidence and regression coverage Executed on macOS with pinned Node 24.18.0: - Seven focused files: **51 passed, 2 Linux-only mitmdump cases skipped**, in 6.64 s. Individual cases stayed below 2.3 s. - Public HAR CLI and source-map CLI/stdio MCP workflows succeed with `DEVELOPER_DIR` pointing to a missing directory. Source-map CLI/MCP Evidence matches. - Real child cancellation and timeout escalation pass. Injected cleanup failures verify owner retention, blocked admission, original diagnostics, separate resource values and retry on close. - Build, `npm run check:fast` (including the pre-push run), and `npm run docs:check` pass. The inspector-unavailable workflows would invoke native preparation on the affected base. Failed cleanup previously removed the capture root instead of retaining it with the process owner. ## Compatibility, safety, and release No public breaking change or migration. Windows Job Object enforcement (Node/Bun) and Linux mitmdump behavior were reviewed in source, not executed on this Mac. The existing heavy HAR heap-exhaustion lane was not rerun. No CPU speedup is claimed. No real Hopper, Ghidra or IDA behavior is claimed by these checks. Review follow-up: retained scope failures now carry their actual owner/cause pairs. A cleanup retry triggered by a different capture format reports the original provider and already-redacted timeout/output diagnostics, with current resource identities and cleanup reason. The focused scope, historical decoder and MCP lifecycle run passed (25 tests, 2 Linux-only permission cases skipped); runtime build and fast checks passed. Final review follow-ups: all Windows internal helpers retain the existing native kill-on-owner-close Job Object launcher; direct handles remain Linux/macOS only. Concurrent cleanup retries preserve every owner’s current resources/reason and original typed/redacted diagnostics in a per-owner list. The default MCP factory regression confirms one service creation and retryable shutdown; no extra service was constructed because registration receives `selectedOptions`. Final five-file boundary run: 48 passed, 2 Linux-only cases skipped; the capture regression rerun passed 19 with the same 2 skips. Build, fast checks and docs checks pass. Real Windows execution remains unverified locally. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 00:56:40 +00:00
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#4909
No description provided.