mirror of
https://github.com/morluto/rea.git
synced 2026-11-14 10:43:30 +00:00
fix(process): retain owned command cleanup diagnostics (#1907)
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>
This commit is contained in:
8 files changed
+209
-29
No files matched your search
@@ -6,6 +6,7 @@ import { WindowsOwnedProcess } from "../windows/WindowsOwnedProcess.js";
|
||||
|
||||
import type {
|
||||
OwnedProcessGroup,
|
||||
ProcessCleanupFailure,
|
||||
ProcessCleanupResult,
|
||||
} from "./ProcessOwnership.js";
|
||||
import { prepareProcessOwnershipInspection } from "./ProcessOwnershipObservation.js";
|
||||
@@ -143,7 +144,11 @@ export type ProviderProcessStopResult =
|
||||
| "terminated"
|
||||
| "killed";
|
||||
}
|
||||
| { readonly status: "incomplete"; readonly reason: string };
|
||||
| {
|
||||
readonly status: "incomplete";
|
||||
readonly reason: string;
|
||||
readonly cleanupResult?: ProcessCleanupFailure;
|
||||
};
|
||||
|
||||
/**
|
||||
* Spawn a provider in an owned Windows job or dedicated POSIX process group.
|
||||
@@ -373,13 +378,21 @@ export class ProviderProcessSupervisor {
|
||||
if (this.launch.cleanup !== undefined) {
|
||||
const cleanup = await this.#ownedCleanup(options.cleanupResult);
|
||||
if (!cleanup.cleaned)
|
||||
return { status: "incomplete", reason: cleanup.reason };
|
||||
return {
|
||||
status: "incomplete",
|
||||
reason: cleanup.reason,
|
||||
cleanupResult: cleanup,
|
||||
};
|
||||
const graceMs = options.killGraceMs ?? DEFAULT_KILL_GRACE_MS;
|
||||
if (await this.waitForExit(graceMs))
|
||||
return { status: "verified-cleanup" };
|
||||
const retried = await this.launch.cleanup();
|
||||
if (!retried.cleaned)
|
||||
return { status: "incomplete", reason: retried.reason };
|
||||
return {
|
||||
status: "incomplete",
|
||||
reason: retried.reason,
|
||||
cleanupResult: retried,
|
||||
};
|
||||
if (await this.waitForExit(graceMs))
|
||||
return { status: "verified-cleanup" };
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user