fix(evm): preserve transferred cleanup ownership and bounded output

Retain a worker owner transferred through the callback when a failure has no replacement owner. Give captured streams one canonical owner while preserving unrelated diagnostics and partial Evidence. Linux retained-cleanup coverage requires CI.
This commit is contained in:
morluto committed 2026-10-14 14:47:26 +08:00
1 parent 713163e644
commit 07540cbcde
3 files changed
+31 -25

No files matched your search

+3 -7
View File
@@ -183,6 +183,9 @@ export const evmInterfaceFailure = (
{
cause,
...cleanupOptions,
...(cause instanceof OwnedCommandFailure && cause.snapshot !== null
? { capturedOutput: capturedEvmOutput(cause.snapshot) }
: {}),
diagnostics: {
phase,
path,
@@ -198,13 +201,6 @@ export const evmInterfaceFailure = (
failure_kind: cause.reason,
exit_code: cause.snapshot?.exitCode ?? null,
signal: cause.snapshot?.signal ?? null,
stdout: cause.snapshot?.stdout.text ?? null,
stderr: cause.snapshot?.stderr.text ?? null,
...(cause.snapshot === null
? {}
: {
captured_output: { ...capturedEvmOutput(cause.snapshot) },
}),
}
: {}),
},
+15 -2
View File
@@ -85,6 +85,16 @@ const replySchema = z.discriminatedUnion("ok", [
type Launcher = NonNullable<Parameters<typeof runOwnedCommand>[2]>["launcher"];
type EvmOutcome = Result<EvmInterfaceExecution, AnalysisError>;
const compactErrorProjection = (error: AnalysisError) => {
const projection = projectAnalysisError(error);
if (error.capturedOutput === undefined) return projection;
// The cleanup result owns this exact captured stream. Other diagnostics and
// partial Evidence retain their original fields, including stdout/stderr.
const details = { ...projection.details };
delete details.captured_output;
return { ...projection, details };
};
const evmExecutionEvidence = (
input: InspectEvmInterfaceInput,
execution: EvmInterfaceExecution,
@@ -118,7 +128,7 @@ const evmCleanupFailure = (
resources,
{
reason,
previous_error: result.ok ? null : projectAnalysisError(result.error),
previous_error: result.ok ? null : compactErrorProjection(result.error),
...(capturedOutput === undefined
? {}
: { captured_output: { ...capturedOutput } }),
@@ -444,7 +454,10 @@ export class EvmoleInterfaceProvider implements EvmInterfacePort {
}),
);
} catch (cause: unknown) {
if (cause instanceof OwnedCommandFailure)
if (
cause instanceof OwnedCommandFailure &&
cause.cleanupOwner !== undefined
)
processOwner = cause.cleanupOwner;
let fileFailure: EvmFileSizeFailureEvidence | undefined;
let markerCleanupFailure: ArtifactReaderFailure | undefined;