Repository navigation
fix: report completed subprocess cleanup after cancellation - #152107
Conversation
Keep cooperative process-group settlement when the child exits by signal. Unaccounted signal exits remain uncertain, and input-admission failures retain their original error.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 18, 2026, 4:47 PM ET / 20:47 UTC (Revision 2). ClawSweeper reviewWhat this changesCorrects subprocess cleanup reporting after cancellation or rejected input, and adds regression coverage for signal exits and denied signals followed by confirmed group exit. Merge readiness✅ Ready for maintainer review This fix remains necessary: current main and v2026.9.4 retain the cleanup misclassification. The reviewed patch has no blocking correctness findings and preserves uncertainty when process-group exit cannot be confirmed. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s command runner launches subprocesses and handles cancellation, timeouts, and input admission. Its cleanup result tells operation owners whether owned processes have stopped before recovery proceeds. flowchart TD
A[Command or input rejection] --> B[Command runner]
B --> C[Termination controller]
C --> D[Observe owned process group]
D --> E{Exit confirmed?}
E -->|Yes| F[Report completed cleanup]
E -->|No| G[Retain uncertain cleanup]
F --> H[Return original outcome to caller]
G --> H
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +1, Tests +54. Total +55 across 4 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep cleanup classification with the existing termination owner, preserve confirmed process-group extinction, and return the original cancellation or admission failure. Do we have a high-confidence way to reproduce the issue? Yes, from source: cancel an owned POSIX group whose child exits by signal, or observe group disappearance after a denied graceful signal. Current main retains uncertain cleanup in these cases; execution was not performed during this review. Is this the best way to solve the issue? Yes. The patch corrects classification at the existing owners while preserving original errors, group observation, and uncertainty safeguards. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d2a5196a2f95. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Keep failed signal delivery uncertain until the existing group observer confirms exit. Preserve live, unknown, reused and forced-timeout outcomes.
|
Merged via squash.
|
…49075-c1-control-repair * commit 'dc5b321b5f89f9cf0e704ee202ea3059fb1ce63d': (79 commits) fix: start background context maintenance after durable turns (#151936) fix(models): avoid ambient state reads during prepared selection (#152119) feat: recover abandoned Crabbox source staging (#152006) chore(ui): refresh control ui locales (#152098) fix(ui): keep cloud startup prompts and progress in chat (#152024) fix: report completed subprocess cleanup after cancellation (#152107) perf(reply): reuse normalized inbound text (#152110) fix(cron): paused future one-shots disappear after Run now (#152126) perf(sessions): reuse rows and skip discarded terminal labels (#152109) fix(ui): keep keyboard-focused automation controls clear of sticky actions (#152135) fix(ui): load remote images in compact activity previews (#152045) refactor(health): skip unused verbose account projection (#152108) fix: restore dashboard test limits and SQLite test compilation (#152089) test(qa-lab): stabilize timeout recovery delivery proof (#152100) fix: probe SQLite when Node denies worker threads (#152075) perf(gateway): keep GitHub co-author trailer scans linear (#152115) fix(media): report CLI models with missing command or args (#151969) refactor: remove retired runtime code and duplicate helpers (#151973) perf(plugins): combine runtime and tool call scopes (#152101) test(memory): seed restart fixtures with the Gateway stopped (#152038) ...
…n-20260918-v4 * origin/main: (81 commits) fix: retire failed setup plugins without replaying facade initialization (#152026) fix(test): select Node for built runtime recovery fixtures (#152162) refactor(auth): reuse privately assembled choice groups (#152166) fix: preserve chat media delivery and session boundaries (#152079) fix: keep stale Stop messages from canceling replacement sessions (#152116) improve(plugins): reduce mutable argument handling overhead (#152154) fix(scripts): prevent host tooling drift from blocking PR workflows (#152078) improve: reduce model capability preparation work (#152128) fix: stop marking delivered scheduled reports as failed (#152165) fix: start background context maintenance after durable turns (#151936) fix(models): avoid ambient state reads during prepared selection (#152119) feat: recover abandoned Crabbox source staging (#152006) chore(ui): refresh control ui locales (#152098) fix(ui): keep cloud startup prompts and progress in chat (#152024) fix: report completed subprocess cleanup after cancellation (#152107) perf(reply): reuse normalized inbound text (#152110) fix(cron): paused future one-shots disappear after Run now (#152126) perf(sessions): reuse rows and skip discarded terminal labels (#152109) fix(ui): keep keyboard-focused automation controls clear of sticky actions (#152135) fix(ui): load remote images in compact activity previews (#152045) ...
Integrate the exact CI base 87e2cfb and preserve its canonical progress-probe helper without duplicate bindings. Align the real cancellation regression with confirmed cooperative settlement from #152107, retaining uncertainty preservation controls. 115 rehearsal tests pass; the complete integrated PR delta is independently reviewed through P2.
…#152107) * fix(process): preserve confirmed cleanup after signals Keep cooperative process-group settlement when the child exits by signal. Unaccounted signal exits remain uncertain, and input-admission failures retain their original error. * fix(process): accept observed exit after signal denial Keep failed signal delivery uncertain until the existing group observer confirms exit. Preserve live, unknown, reused and forced-timeout outcomes.
Related: #150153
What Problem This Solves
Canceled subprocesses can report uncertain cleanup even after their owned process group has fully exited.
User Impact
Cancellation and rejected input admission retain their original error while accurately reporting confirmed cleanup to the operation owner.
Why This Change Was Made
The termination controller already waits for the process group to disappear. Preserve that observed result when the child exits by signal, and when a denied signal is followed by a confirmed group exit. Signal exits without a confirmed cleanup result, and groups that remain live or unknown, stay uncertain.
Evidence
Default SIGINT termination, rejected input admission, and denied-signal-then-exit regressions all fail before their respective fixes. The latter follows a recorded native cancellation race. All 127 process, termination, scope-settlement and Windows-contract tests pass, with one existing skip. These include real POSIX children and process-group observation on macOS; native Windows execution is not claimed. Fresh independent P0–P2 review is clean. All selected changed checks passed.
The combined fix adds one production line and 54 test lines. Exact-head CI run 35392579827 passed for
ed47786342f4.