Skip to content

fix: report completed subprocess cleanup after cancellation - #152107

Merged
steipete merged 2 commits into
mainfrom
codex/process-cleanup-classification
Sep 18, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/process-cleanup-classification

Conversation

@steipete

@steipete steipete commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

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.

Keep cooperative process-group settlement when the child exits by signal. Unaccounted signal exits remain uncertain, and input-admission failures retain their original error.
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Sep 18, 2026
@steipete
steipete marked this pull request as ready for review September 18, 2026 19:44
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 18, 2026, 4:47 PM ET / 20:47 UTC (Revision 2).

ClawSweeper review

What this changes

Corrects 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
Reviewed head: ed47786342f4f8eeea71907eaa02d2eb1a347a62

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level correction with meaningful regressions and no blocking findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied MEMBER classification exempts this PR from the external-contributor proof gate. Its body reports macOS production-runner cancellation coverage; tests remain supplemental, native Windows execution is not claimed, and this review ran no target code.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied MEMBER classification exempts this PR from the external-contributor proof gate. Its body reports macOS production-runner cancellation coverage; tests remain supplemental, native Windows execution is not claimed, and this review ran no target code.
Evidence reviewed 7 items Introduced changes and review continuity: The merge-base-to-head diff matches the supplied introduction evidence. Compared with the previously reviewed head, the added production behavior is accepting observed group disappearance after signal denial; the earlier review contained no findings.
Current main still needs the fix: Fetched main still downgrades cooperative cleanup whenever a signal is present. Its termination observer also leaves a failed graceful signal classified uncertain after observing group disappearance.
Latest-release behavior: The v2026.9.4 source also changes every non-forced signal exit to uncertain, establishing that the central correction is not present in the supplied latest release.
Findings None None.
Security None None.

How this fits together

OpenClaw’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
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +1, Tests +54. Total +55 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 3 2 +1
Tests 2 58 4 +54
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 61 6 +55

Review metrics

None.

Technical review

Best 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.

Labels

Label justifications:

  • P2: This is a bounded subprocess-result correction that prevents unnecessary uncertainty after confirmed cleanup.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied MEMBER classification exempts this PR from the external-contributor proof gate. Its body reports macOS production-runner cancellation coverage; tests remain supplemental, native Windows execution is not claimed, and this review ran no target code.

Evidence

What I checked:

  • Introduced changes and review continuity: The merge-base-to-head diff matches the supplied introduction evidence. Compared with the previously reviewed head, the added production behavior is accepting observed group disappearance after signal denial; the earlier review contained no findings. (src/process/exec-termination.ts:162, ed47786342f4)
  • Current main still needs the fix: Fetched main still downgrades cooperative cleanup whenever a signal is present. Its termination observer also leaves a failed graceful signal classified uncertain after observing group disappearance. (src/process/exec-runner.ts:536, d2a5196a2f95)
  • Latest-release behavior: The v2026.9.4 source also changes every non-forced signal exit to uncertain, establishing that the central correction is not present in the supplied latest release. (src/process/exec-runner.ts:445, 3a9d69db306c)
  • Exit observation remains conservative: The group probe treats only ESRCH as absence; permission and other probe failures remain live or unknown. The termination controller retains force escalation, identity checks, and uncertain outcomes when observation cannot establish extinction. (src/process/child-process-tree.ts:10, ed47786342f4)
  • Regression coverage and validation limits: Inspected coverage exercises explicit caller abort with default SIGINT handling, original input-admission error identity and child disappearance, denied-signal-then-exit recovery, and continued uncertainty for unobserved signal exits. The supplied body reports 127 passing cases with one existing skip and macOS subprocess coverage; this read-only review did not execute tests. The introduced diff passes git diff --check. (src/process/exec.test.ts:37, ed47786342f4)
  • Merged area history: Current-main history includes repeated process-settlement work by Peter Steinberger. GitHub maps the cited commit’s author to steipete, and its patch adds the retained cleanup operation used by the reviewed runner. Some older local blobs were unavailable, so historical inspection was supplemented with the GitHub commit API. (src/process/exec-runner.ts:267, ce2985bd8f2c)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-18T19:50:07.480Z sha 652a198 :: needs maintainer review before merge. :: none

Keep failed signal delivery uncertain until the existing group observer confirms exit. Preserve live, unknown, reused and forced-timeout outcomes.
@steipete
steipete merged commit 372ed8b into main Sep 18, 2026
223 checks passed
@steipete
steipete deleted the codex/process-cleanup-classification branch September 18, 2026 21:00
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 18, 2026
…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)
  ...
vincentkoc added a commit that referenced this pull request Sep 18, 2026
…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)
  ...
fuller-stack-dev added a commit that referenced this pull request Sep 18, 2026
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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
…#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant