Skip to content

fix(process)!: retain observed cleanup intervention - #10481

Merged
N0zoM1z0 merged 2 commits into
mainfrom
fix/8032-cleanup-intervention
Nov 14, 2026
Merged

N0zoM1z0 merged 2 commits into
mainfrom
fix/8032-cleanup-intervention

Conversation

@N0zoM1z0

@N0zoM1z0 N0zoM1z0 commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

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

cleanupOwnedProcessGroup returns signaled, but releaseCapturedProcessGroup dropped it, and three call sites (ProcessHarness.finishProcessRun and two branches of resolveProcessResult) re-derived cleanup_outcome from settlement.state alone. 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.release API (replacing the removed releaseProcessResources) and the inspection-failure cleanup path added since the PR's base.

  • ProcessOwnership.cleanupOwnedProcessGroup: every exit path, including failures after a signal, carries signaled: true once 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, unless cleanupOwnedProcessGroup marked 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 both resolveProcessResult branches. The three duplicated derivations are removed.
  • Partial observations without a capture keep the intervention in an optional residual_unknowns.
  • Docs: docs/guides/runtime/process-capture.md states the contract and migration.

Contribution scope: ordinary fix within existing boundaries; maintainer scope decision not applicable. No change to which processes REA may signal.

  • Launch or attach to a process.

Contract and boundary impact

  • Semantic owner: processCaptureCleanupFacts in ProcessCaptureLifecycle.ts, fed by cleanupOwnedProcessGroup.
  • CLI and MCP contract: the quiesced settlement schema now admits cleanup_outcome: "cleaned". processCaptureCleanupSchema.test.ts checks the advertised schema in both profiles.
  • Evidence contract: saved captures stay valid; missing historical signal facts are not reconstructed.

Evidence and regression coverage

  • Tests: 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.
  • Base reproduction: with main's production files and the new test file, 8 of 13 cases in ProcessCaptureCleanupOutcome.test.ts fail, all on the missing intervention fact. The non-signaling, historical and "do not infer" cases pass on both.
  • Lifecycle regressions covered: cleanup retry (unknown attempt followed by a non-signaling retry stays unknown), mixed outcomes (renderer cleanup failure with a known signal), finalization-time cancellation (existing harness case).
  • Remaining gaps: injected ownership hosts exercise finalization; the real-process boundary test is unchanged and still passes. Not run on macOS or Windows (Windows reports unverified as 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

  • Breaking change (!): a quiesced settlement may now report cleanup_outcome: "cleaned". A strict reader that accepted only not_required for quiesced settlements must accept cleaned or refresh the advertised MCP schema. Keeping not_required would keep the false Evidence, so there is no compatible alternative.
  • Real OS coverage: Linux only.

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.

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]>
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-14T07:01:13.593329Z
We couldn’t complete this review. Comment @codex review to try again.
2541f6b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge; the previous signal-loss issue is fixed and no new actionable issue was found.

Summary

This PR keeps observed cleanup signals in completed and partial process captures, including when later inspection fails.

  • Owned-process cleanup keeps a signal it sent, even if later checks fail.
  • Process captures show when cleanup signals may have changed later observations.

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]
Loading

Reviews (2) · Last reviewed commit: "fix(process): keep a sent signal when cl..." · Reviewed by Greptile

Comment thread src/process/ProcessOwnership.ts Resolved
…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 gensokyo-dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the final diff, CI and automated review; approving.

@N0zoM1z0
N0zoM1z0 merged commit 672e214 into main Nov 14, 2026
52 checks passed
@N0zoM1z0
N0zoM1z0 deleted the fix/8032-cleanup-intervention branch November 14, 2026 07:48
@morluto morluto added area: runtime Process capture and runtime observation bug Something isn't working labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Process capture reports cleanup_outcome "not_required" after its cleanup killed a detached descendant

4 participants