Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

fix(evm): retain cancellation through final cleanup

morlutod43d3568f2cb
diff --git a/src/evm/EvmoleInterfaceProvider.ts b/src/evm/EvmoleInterfaceProvider.ts
index ca44e732c..f6244c74c 100644
--- a/src/evm/EvmoleInterfaceProvider.ts
+++ b/src/evm/EvmoleInterfaceProvider.ts
@@ -657,16 +657,19 @@ export class EvmoleInterfaceProvider implements EvmInterfacePort {
bindArtifactFileCleanup(artifactFailure, failure);
result = err(failure);
}
- if (result.ok && options?.signal?.aborted)
- result = err(
- new AnalysisCancelledError(OPERATION, {
- cause: options.signal.reason,
- partialObservation: evmInterfaceEvidence(input, result.value),
- ...(retainedOutput === undefined
- ? {}
- : { capturedOutput: retainedOutput }),
- }),
- );
+ const retainCancellation = (outcome: EvmOutcome): EvmOutcome =>
+ outcome.ok && options?.signal?.aborted
+ ? err(
+ new AnalysisCancelledError(OPERATION, {
+ cause: options.signal.reason,
+ partialObservation: evmInterfaceEvidence(input, outcome.value),
+ ...(retainedOutput === undefined
+ ? {}
+ : { capturedOutput: retainedOutput }),
+ }),
+ )
+ : outcome;
+ result = retainCancellation(result);
if (processOwner !== undefined) {
const lease = processLeaseFor(processOwner);
const rootOwnerLease =
@@ -737,18 +740,7 @@ export class EvmoleInterfaceProvider implements EvmInterfacePort {
} catch (cause: unknown) {
const retainedRoot = root;
const lease = rootLeaseFor(retainedRoot);
- const cleanupResult =
- result.ok && options?.signal?.aborted
- ? err(
- new AnalysisCancelledError(OPERATION, {
- cause: options.signal.reason,
- partialObservation: evmInterfaceEvidence(input, result.value),
- ...(retainedOutput === undefined
- ? {}
- : { capturedOutput: retainedOutput }),
- }),
- )
- : result;
+ const cleanupResult = retainCancellation(result);
this.#pendingCleanup = {
input,
result: cleanupResult,
@@ -773,7 +765,7 @@ export class EvmoleInterfaceProvider implements EvmInterfacePort {
return err(failure);
}
}
- return result;
+ return retainCancellation(result);
}
async close(): Promise<void> {
diff --git a/tests/boundary/evm/evmoleInterfaceProvider.test.ts b/tests/boundary/evm/evmoleInterfaceProvider.test.ts
index 137f447b8..15aa1ae5c 100644
--- a/tests/boundary/evm/evmoleInterfaceProvider.test.ts
+++ b/tests/boundary/evm/evmoleInterfaceProvider.test.ts
@@ -783,6 +783,7 @@ it
else expect(result.error.cleanupIncomplete).toBe(true);
if (scenario === "cancelled-cleanup-failure") {
expect(result.error.cleanupPrimary?.cause).toBe(reason);
+ denyClose = false;
await provider.close();
expect(result.error.cleanupIncomplete).toBe(false);
expect(projectAnalysisError(result.error).category).toBe("cancelled");