Repository navigation
fix(process): await process-tree cleanup before cancellation settles - #98539
Conversation
17d40cf to
473706b
Compare
|
Codex review: found issues before merge. Reviewed August 25, 2026, 7:49 PM ET / 23:49 UTC. ClawSweeper reviewWhat this changesThe PR routes extension-command and Bash cancellation through a shared process-tree termination controller and adds regression coverage. Merge readinessKeep open: the central Bash timeout path still selects force mode, whose shared settlement path returns immediately on POSIX, so a timed-out Bash command can reject before descendants have exited. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherExtension command execution and the built-in Bash tool spawn local subprocess trees. Their cancellation paths use the shared termination controller before reporting a timeout or abort back to the agent. flowchart LR
A[Agent command] --> B[Bash or extension runner]
B --> C[Termination controller]
C --> D[Process tree]
D --> E[Cleanup settlement]
E --> F[Timeout or abort result]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +21, Tests +253, Config 0. Total +274 across 10 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Make the shared controller await bounded process-group disappearance for Bash force mode, preserving immediate signaling, and prove it with a real Bash parent/child timeout regression. Do we have a high-confidence way to reproduce the issue? Yes—use a Bash parent that spawns a SIGTERM-resistant child, then time out the Bash call and verify the child is gone before rejection. This read-only review did not execute that scenario. Is this the best way to solve the issue? No—the shared controller is the right owner, but its force branch deliberately bypasses settlement; it needs an awaited group-exit condition rather than a mocked delay. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a84629751339. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
f272378 to
d9aaf4f
Compare
cb77e26 to
cebe9a9
Compare
cebe9a9 to
9a1961a
Compare
|
Land-ready verification on exact head 6fa02cb: cancellation now settles only after platform-owned process-tree termination completes. Fresh full-branch P1 review and all 201 hosted checks are clean; 65 focused tests pass. Six real Bash timeout runs spawned 96 SIGTERM-resistant descendants, and every descendant was already dead at the cancellation rejection boundary. ClawSweeper force-mode polling suggestion intentionally not applied: synchronous SIGKILL of the detached process group passed the 96-process real proof, while speculative polling would add PID-reuse and zombie risk. Upstream contracts personally verified in codex-rs/core/src/exec.rs and codex-rs/utils/pty/src/process_group.rs. |
|
Merged via squash.
|
…penclaw#98539) * fix(process): await process-tree cleanup before cancellation settles * fix(process): remove unused process-tree options re-export
Problem
Cancelled extension and Bash commands could report completion while descendant processes remained alive.
Repair
Route both execution owners through the canonical process-tree termination controller while preserving existing per-caller grace periods and Windows CI coverage.
Verification
A real spawned SIGTERM-resistant parent/child failed before the fix and passes afterward. Exact-head focused proof: 65 tests passed; two platform-specific tests skipped. Independent review and secret scanning passed. Broader local typechecking is blocked by unrelated pre-existing dependency mismatches.