Repository navigation
fix(process): retain owned command cleanup diagnostics - #1907
Merged
Merged
Conversation
Preserve per-member verification failures and sweep uncertainty across supervisor stop and owned-command failures. Report the observed token mismatch with its PID coordinates instead of implying PID reuse. Keep unresolved ownership unsignaled and retain the supervisor for a later verified stop. Exercise cancellation, timeout and cleanup revalidation with source-owned process fixtures and cooperative settlement. Closes #1856 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Codex Review SummaryThis 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. |
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
An interrupted owned command can retain cleanup ownership while losing the diagnostics explaining which member could not be verified. Preserve that verification ledger through the supervisor and command failure, and identify the observed token mismatch in its summary. Fixes #1856.
Problem and expected behavior
A source-owned parent starts a child with a different ownership token in the same process group. On cancellation or timeout, cleanup correctly refuses to signal the mixed-ownership group. Its lower result identifies the child's PID and
run-token-mismatch, but the supervisor previously discarded those fields and the command returned onlyprocess tree contains an unowned or PID-reused process.Callers should receive the actual verification failures and retained owner, without treating an ordinary token mismatch as proof of PID reuse or acquiring additional authority.
Change and scope
cleanupResulton incomplete supervisor results and owned-command failures, including cleanup revalidation after launcher grace. Member failures, diagnostic reasons and sweep uncertainty remain intact.Contract and boundary impact
Evidence and regression coverage
Tests added or updated: actual parent/child cancellation and timeout cases; a controlled adapter case for a failed cleanup recheck retaining both member failures and sweep uncertainty. Existing ownership assertions now expect the factual token-mismatch summary.
Base reproduction: both new real process cases fail on the base because
OwnedCommandFailure.cleanupResultis absent, while the lower cleanup result contains the exact child failure. Their cooperative cleanup still completes, so the tests leave no fixture processes behind.User-visible output: the summary identifies the failed PID coordinates; process callers can inspect
cleanupResult.failuresforrun-token-mismatch,environment-unreadableorprocess-identity-unavailable, andcleanupResult.unverifiedfor sweep uncertainty.Remaining proof gaps: no provider-specific leak, PID reuse or successful full client-family cleanup is inferred from this fixture. The recheck's unavailable-identity observation is deliberately injected; the parent/child token mismatch is observed through the real operating-system boundary.
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 test:focused -- tests/boundary/process/ownedCommand.test.ts tests/boundary/process/providerProcess.test.ts src/process/ProcessOwnership.test.ts src/process/ProcessOwnership.part2.test.ts src/process/ProcessOwnership.part3.test.ts src/process/ProcessOwnership.validation.test.ts src/process/ProcessOwnership.identity.test.ts src/process/ProcessOwnership.observation.test.ts— 107 tests passed, one platform-conditional test skipped, eight files passed.npm run check— passed.npm run verify:test-discoveryandgit diff --check— passed.Compatibility, safety, and release
cleanupResultis additive and absent when no structured failure was produced. Consumers should use typed verification reasons instead of parsing historical summary text.Review checklist
type(scope): outcome.