Skip to content

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

Closed
wunianze666-netizen wants to merge 5 commits into
morluto:mainfrom
wunianze666-netizen:codex/process-cleanup-intervention
Closed

wunianze666-netizen wants to merge 5 commits into
morluto:mainfrom
wunianze666-netizen:codex/process-cleanup-intervention

Conversation

@wunianze666-netizen

@wunianze666-netizen wunianze666-netizen commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #8032, reported by @jgt87. Process settlement and cleanup intervention are separate facts: a quiesced capture can still require termination of token-owned descendants.

The ownership producer retains observed signals across later failures, the resource owner accumulates intervention across retries, and the capture projection carries it through success, partial Evidence and pre-result failures. Cancellation retains its opaque caller reason independently. Failed cleanup resources remain owned for retry. Historical saved captures remain accepted.

Breaking output-contract correction: quiesced captures may report cleaned rather than not_required; strict pinned readers must accept this and optional incomplete-observation residual_unknowns. Process-signaling authority is unchanged.

Historical maintainer-reported validation on head 791b746: 129 focused ownership, cleanup, harness, schema and capture tests passed. This includes real descendant cleanup, deadlines, CLI signals, post-exit MCP cancellation and final-cleanup cancellation, plus controlled intervention/cancellation combinations. check:fast, docs:check and test discovery passed. Windows cases use controlled fixtures; real Windows behavior and the full repository gate were not verified in this follow-up. Draft status and human readiness declarations remain unchanged.

Current CI follow-up

The failed built-test job selected CommonJS while two route fixtures asserted unisolated-script behavior. This follow-up changes only tests/acceptance/javascriptRoutesCli.test.ts (12 additions / 2 deletions), reusing this contributor's repair from fe099ea23. It preserves the original unknown/partial assertions, selects JSX sources whose runtime remains unproven, and adds a package-CommonJS control using the same source text. Node's module wrapper keeps the original .js fixture's program variables local.

The parent remains maintainer head 791b746b5227c4d808ae273e6efedfa88402a641; its additional commits are preserved. The repair is made in a separate E-side worktree branch and pushed normally to this PR's existing head branch. The active C-side checkout is not changed. No Promise/FileHandle implementation from another unmerged branch is included.

Contract and boundary impact

  • Semantic owner and earliest changed stage: this follow-up corrects public test inputs to match parser-owned runtime context. Production process ownership, cleanup and route interpretation code is unchanged from the parent.
  • Contribution scope fit and linked maintainer decision: existing issue [Bug] Process capture reports cleanup_outcome "not_required" after its cleanup killed a detached descendant #8032 and its process-reporting correction; the CI fixture repair adds no authority or capability.
  • CLI and MCP/tool-catalog contract: existing operation names, options and schemas are retained by this follow-up.
  • Provider, bridge, target-format, or platform compatibility: current follow-up tests cover static JavaScript CLI/MCP routes on Windows Node 24.22.1. The broader real-Windows process behavior gap stated above remains.
  • Evidence, artifact, provenance, or reconstruction contract: route uncertainty assertions and all original cases remain; the process reporting contract correction is described in the original scope above.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): existing process-signaling authority is unchanged. Tests analyze owned source fixtures and retained Evidence.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): no package, lock, version, SDK or install-policy change in this follow-up.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Actual old CI: run 42602703034, attempt 1, head 791b746b5227c4d808ae273e6efedfa88402a641; shard 3 job 129159615705 has 2 failed / 2,008 passed / 32 skipped. Both failures are the route fixture cases; no timeout caused those failures.
  • Raw checkout dc46d9508b63e1cce5765a2c3ba02acb021f1c7a, parents f20f05536e3cebff3f31a67954664c40d8c4c3dd + the old PR head, tree 53cb2d6319453333d54def49b3fe6e877f20e6a2. That tree equals the preserved maintainer parent used for this fix.
  • Matching current runtime: the complete public file has 7 passed / 3 existing SDK timeouts, no skip or name filtering. Both formerly failing semantic cases and the new CommonJS control pass. Full/compact retained-route SDK cases reach their original 30-second deadline, and the large-source SDK case reaches its original 60-second deadline on this Windows run. Their bodies and deadlines are unchanged. This is not a complete green file or a rerun of the original 129 process tests; the timing gap is preserved.
  • The owned Node scope probe and actual parser suffix probe establish the fixture distinction; neither executes React/JSX or a real application target.
  • Remaining gaps: no new real Windows process/capture or full package qualification. The original process verification gap remains, so draft state is retained for that validation gap; the human declarations are not filled.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run build:cached: matching-parent build passed.
  • node scripts/run-exact-tests.mjs run tests/acceptance/javascriptRoutesCli.test.ts: 7 passed / 3 original-deadline SDK timeouts, no skip or name filtering; the three directly affected fixture/control cases pass.
  • npm run check:ci:fast, npm run docs:check and git diff --check: passed; README consistency 9 passed. Full optional chain and unrelated suites were not run for this fixture-only follow-up.
  • Normal precommit and prepush checks passed; tested file bytes remain unchanged by hooks, and remote/GitHub head match 6e44e7aedcb53593f111c9d9f997a89159d5e030.
  • New-head hosted CI is pending; no new remote passing-test or platform qualification is claimed and no manual rerun was triggered.

Compatibility, safety, and release

The original process-reporting contract correction and its limitations remain as stated above. This follow-up changes test fixtures only; it adds no target execution, injection, process-signaling, installation or protection-recovery authority. No timeout, skip, schema check, assertion or resource allowance is removed or raised.

Author readiness

Human owner: @wunianze666-netizen

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

Preserve the ownership cleanup signal fact through successful and partial
capture finalization, without changing signal policy or resource ownership.

BREAKING CHANGE: A quiesced process capture may report cleanup_outcome cleaned when owned cleanup sent termination signals. Refresh MCP tool schemas or update pinned readers to accept that combination; prior valid captures remain readable without rewriting.
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[Medium impact] The PR appears safe to merge; no new actionable issue was found.

Summary

Retains observed cleanup signals when a later signal or ownership check fails.

  • Owned-process cleanup keeps earlier signals visible when later checks fail.
  • Process captures now show when cleanup signaled owned processes.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Observe settlement] --> B[Clean up owned processes]
  B --> C[Retain observed signals]
  B --> D[Retain cleanup result]
  C --> E[Project capture facts]
  D --> E
  E --> F[Complete capture]
  E --> G[Partial observations and original failure]
Loading

Reviews (3) · Last reviewed commit: "fix(process): retain signals when owned ..." · Reviewed by Greptile

@Rinkia

Rinkia commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

I tested this PR at 182125b8e against main at 4b961e371. Setup: a Linux x64 container (--network none), Node 24.22.1. I used the same orphan.c probe as in #8032.

Target main This PR
orphan (a setsid child that outlives the root and is killed by cleanup) cleanup_outcome: "not_required", no residual unknown cleanup_outcome: "cleaned". residual_unknowns adds "Owned-process cleanup sent termination signals. Later terminal and filesystem observations may omit work ended by this intervention."
/bin/echo hi (no descendants) not_required not_required, no intervention entry

In both cases the child's log shows only its start line, so the descendant was still ended. The Evidence now says so, which is what #8032 asked for. Settlement stays quiesced, and cleanup.owned_process_group is verified.

One related observation, outside this PR's scope. #8032 left the case of a child in the root's own process group untested, so I tested it. I used a probe that blocks signals across fork, so that the child logs any catchable signal. Run directly, the child keeps ticking. Under capture, the child receives SIGHUP a few milliseconds after the root exits. The result is not_required on both main and this PR, with no intervention entry. The SIGHUP looks like the PTY hangup: the root is the session leader of the capture PTY, so its exit hangs up the foreground group. It does not come from REA's cleanup, so this PR is right not to report it. Callers might still benefit from a limitation noting that same-group background children are hung up when the root exits.

N0zoM1z0 added a commit that referenced this pull request Nov 14, 2026
* fix(process)!: retain observed cleanup intervention

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

* fix(process): keep a sent signal when cleanup throws an inspection failure

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

---------

Co-authored-by: wunianze666-netizen <[email protected]>
Co-authored-by: gensokyo-dev <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Thanks, wunianze666-netizen. This landed in #10481 (672e214). Your four process commits were squashed with your authorship kept and rebased onto current main, with one follow-up so a signal sent before a thrown inspection failure is also retained. Closing in favor of that merge.

@N0zoM1z0 N0zoM1z0 closed this Nov 14, 2026
@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