[PR #2281] [MERGED] fix(native): name the retained pwntools process group in cleanup resources #5137

Closed
opened 2026-10-31 01:04:16 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2281
Author: @kaoru0822-kitauji
Created: 10/12/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/issue-2274


📝 Commits (1)

  • 8d1a4be fix(native): name the retained pwntools process group in cleanup resources

📊 Changes

2 files changed (+15 additions, -0 deletions)

View changed files

📝 src/native/pwntools/PwntoolsDecoder.ts (+7 -0)
📝 tests/process-global/pwntoolsStageRetirement.test.ts (+8 -0)

📄 Description

Summary

Sometimes a pwntools or pwndbg provider stage can't confirm that its owned process group stopped. PwntoolsDecoder.#retireProcess then builds the retained ProviderCleanupError with only the run ID and the private runtime directory. In that state a descendant of the retained group can still be live: the existing stage-retirement test asserts process.kill(descendant, 0) succeeds. Yet the projected cleanup_incomplete result did not identify the process group the caller must inspect.

While the supervisor is retained, the resources now also include pid:<leaderPid> and process-group:<processGroupId> from its launch ownership. That matches OwnedCommand's own non-transferred cleanup error ([runId, cwd, pid:…, process-group:…]). Nothing else changes.

Codex raised this on #1708 after it merged (PwntoolsDecoder.ts:521).

Fixes #2274

Before / after (does not read unresolved $stage files after command $outcome, all four cases)

before: details.resources = ["rea-artifact-decoder-<uuid>", "/…/owned-XXXX"]
after:  details.resources = ["rea-artifact-decoder-<uuid>", "/…/owned-XXXX", "pid:<n>", "process-group:<n>"]

Validation

  • tests/process-global/pwntoolsStageRetirement.test.ts: the four unresolved-cleanup cases now assert pid: and process-group: resources. They fail on main and pass with this change; all 8 tests in the file pass. The tests simulate the Linux x64 decoder gate and use real owned processes on this macOS host.
  • npm run lint passes.
  • npm test: 9566 passed, 15 failed in 8 files:
    • 7 are the environmental files that fail on clean origin/main on this host: Hopper not installed, Command Line Tools only (ibtool), hdiutil, and inspector target-location cases.
    • The 8th, tests/boundary/process/processSettlementDeadline.test.ts > still reports observed liveness as alive_at_deadline (added today in #2232), also fails when run alone on clean origin/main here. It is unrelated to this change: it spawns /bin/sleep and waits to observe the run token in that process's environment, which this macOS host does not expose for a platform binary.

Not addressed here: Codex's other post-merge note on #1708 (PwntoolsDecoder.ts:477, refresh captured diagnostics after a successful cleanup retry). It depends on output arriving between the first incomplete stop and the retry, which I could not reproduce deterministically.

🤖 Generated with Claude Code


🔄 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/2281 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/12/2026 **Status:** ✅ Merged **Merged:** 10/13/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/issue-2274` --- ### 📝 Commits (1) - [`8d1a4be`](https://github.com/morluto/rea/commit/8d1a4bea364fb95921116951c5a746e066d048e2) fix(native): name the retained pwntools process group in cleanup resources ### 📊 Changes **2 files changed** (+15 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/native/pwntools/PwntoolsDecoder.ts` (+7 -0) 📝 `tests/process-global/pwntoolsStageRetirement.test.ts` (+8 -0) </details> ### 📄 Description ## Summary Sometimes a pwntools or pwndbg provider stage can't confirm that its owned process group stopped. `PwntoolsDecoder.#retireProcess` then builds the retained `ProviderCleanupError` with only the run ID and the private runtime directory. In that state a descendant of the retained group can still be live: the existing stage-retirement test asserts `process.kill(descendant, 0)` succeeds. Yet the projected `cleanup_incomplete` result did not identify the process group the caller must inspect. While the supervisor is retained, the resources now also include `pid:<leaderPid>` and `process-group:<processGroupId>` from its launch ownership. That matches `OwnedCommand`'s own non-transferred cleanup error (`[runId, cwd, pid:…, process-group:…]`). Nothing else changes. Codex raised this on #1708 after it merged (`PwntoolsDecoder.ts:521`). Fixes #2274 ## Before / after (`does not read unresolved $stage files after command $outcome`, all four cases) ```text before: details.resources = ["rea-artifact-decoder-<uuid>", "/…/owned-XXXX"] after: details.resources = ["rea-artifact-decoder-<uuid>", "/…/owned-XXXX", "pid:<n>", "process-group:<n>"] ``` ## Validation - `tests/process-global/pwntoolsStageRetirement.test.ts`: the four unresolved-cleanup cases now assert `pid:` and `process-group:` resources. They fail on main and pass with this change; all 8 tests in the file pass. The tests simulate the Linux x64 decoder gate and use real owned processes on this macOS host. - `npm run lint` passes. - `npm test`: 9566 passed, 15 failed in 8 files: - 7 are the environmental files that fail on clean `origin/main` on this host: Hopper not installed, Command Line Tools only (`ibtool`), `hdiutil`, and inspector target-location cases. - The 8th, `tests/boundary/process/processSettlementDeadline.test.ts > still reports observed liveness as alive_at_deadline` (added today in #2232), also fails when run alone on clean `origin/main` here. It is unrelated to this change: it spawns `/bin/sleep` and waits to observe the run token in that process's environment, which this macOS host does not expose for a platform binary. Not addressed here: Codex's other post-merge note on #1708 (`PwntoolsDecoder.ts:477`, refresh captured diagnostics after a successful cleanup retry). It depends on output arriving between the first incomplete stop and the retry, which I could not reproduce deterministically. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:04:16 +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#5137
No description provided.