Repository navigation
fix(process)!: retain observed cleanup intervention - #10481
Conversation
Process capture derived `settlement.cleanup_outcome` from the settlement state alone in three places, so a quiesced capture reported `not_required` even after final owned-process cleanup SIGKILLed a live token-owned descendant. `cleanupOwnedProcessGroup` already knew it had signaled, but the capture lifecycle discarded that fact. Carry the observed signal out of ownership cleanup (also on failure paths), accumulate it across cleanup retries as true/false/unknown, and derive settlement and the intervention residual unknown once in `processCaptureCleanupFacts` for full, partial and harness results. BREAKING CHANGE: a quiesced settlement may now report `cleanup_outcome: "cleaned"`. Saved captures stay valid; readers that accepted only `not_required` for quiesced settlements must accept `cleaned`. Fixes #8032 Squashed from #8043 and rebased onto main (adapted to the resource-scope release API and the inspection-failure cleanup path). Co-Authored-By: gensokyo-dev <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The PR appears safe to merge; the previous signal-loss issue is fixed and no new actionable issue was found. SummaryThis PR keeps observed cleanup signals in completed and partial process captures, including when later inspection fails.
Review was source-based; tests were not run during this review. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Owned-process cleanup] --> B{Signal sent?}
B -->|Yes| C[Retain observed signal]
B -->|No known signal| D[Keep false or unknown]
C --> E{Cleanup finishes?}
E -->|Yes| F[Return signal fact]
E -->|Throws| G[Mark and rethrow original error]
F --> H[Capture resource owner]
G --> H
D --> H
H --> I[Full or partial capture facts]
Reviews (2) · Last reviewed commit: "fix(process): keep a sent signal when cl..." · Reviewed by Greptile |
…ilure Final ownership verification can rethrow a typed inspection failure (for example cancellation) after SIGKILL succeeded. The capture owner then recorded the attempt as unknown and dropped the intervention fact. cleanupOwnedProcessGroup now marks a failure it throws after signaling, without changing the failure's identity, and the capture owner keeps the signal for such failures. Co-Authored-By: gensokyo-dev <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
gensokyo-dev
left a comment
There was a problem hiding this comment.
Reviewed the final diff, CI and automated review; approving.
Summary
Process capture reported
settlement.cleanup_outcome: "not_required"for a quiesced capture even when final owned-process cleanup had just SIGKILLed a live, token-owned descendant. Later filesystem and terminal observations can reflect that kill, so the Evidence said no intervention happened when one did.Fixes #8032
Problem and expected behavior
cleanupOwnedProcessGroupreturnssignaled, butreleaseCapturedProcessGroupdropped it, and three call sites (ProcessHarness.finishProcessRunand two branches ofresolveProcessResult) re-derivedcleanup_outcomefromsettlement.statealone. Expected: when cleanup signaled an owned process, the outcome says so and a process residual unknown explains that later observations may omit work ended by the intervention.Change and scope
This is #8043 by wunianze666-netizen, squashed and rebased onto current main with authorship kept. Rebase adaptations: main's
ProcessCaptureResourceScope.releaseAPI (replacing the removedreleaseProcessResources) and the inspection-failure cleanup path added since the PR's base.ProcessOwnership.cleanupOwnedProcessGroup: every exit path, including failures after a signal, carriessignaled: trueonce a signal was sent. Absence does not prove no signal.ProcessCaptureResourceOwner: accumulates the fact across cleanup retries as true / false / unknown. A thrown attempt records unknown, never false, unlesscleanupOwnedProcessGroupmarked the failure as thrown after a signal (cleanupFailureFollowedSignal, e.g. cancellation during final verification). Then it records true.processCaptureCleanupFacts: the one owner that derives settlement and the intervention residual unknown, used by the harness and bothresolveProcessResultbranches. The three duplicated derivations are removed.residual_unknowns.docs/guides/runtime/process-capture.mdstates the contract and migration.Contribution scope: ordinary fix within existing boundaries; maintainer scope decision not applicable. No change to which processes REA may signal.
Contract and boundary impact
processCaptureCleanupFactsinProcessCaptureLifecycle.ts, fed bycleanupOwnedProcessGroup.cleanup_outcome: "cleaned".processCaptureCleanupSchema.test.tschecks the advertised schema in both profiles.Evidence and regression coverage
ProcessCaptureCleanupOutcome.test.ts(new: failed-then-recovered cleanup, quiesced intervention, no duplicate facts, partial observations with and without a capture, historical reports),ProcessOwnership.test.ts(signal retained after later failure; inspection failure thrown after vs before a signal),ProcessHarness.test.ts,processCapture.validation.test.ts,tests/boundary/mcp/processCaptureCleanupSchema.test.ts,tests/boundary/process/processCaptureLifecycle.test.ts.ProcessCaptureCleanupOutcome.test.tsfail, all on the missing intervention fact. The non-signaling, historical and "do not infer" cases pass on both.unverifiedas before).Validation performed
npm run test:focused --on the six files above: 126 passed. After the Greptile fix: the four process files, 90 passed.npm run check:fast(pre-push): passed.Compatibility, safety, and release
!): a quiesced settlement may now reportcleanup_outcome: "cleaned". A strict reader that accepted onlynot_requiredfor quiesced settlements must acceptcleanedor refresh the advertised MCP schema. Keepingnot_requiredwould keep the false Evidence, so there is no compatible alternative.Author readiness
Human owner: N0zoM1z0 (PR author, exempt from the declaration per CONTRIBUTING.md).
Supersedes #8043 (wunianze666-netizen), whose commits are squashed here with authorship preserved. The verifier-side sibling #8559 is handled separately with the verifier cleanup group.