[PR #5369] [CLOSED] fix(evm): preserve the exact artifact cancellation reason #6902

Closed
opened 2026-11-01 21:43:56 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5369
Author: @sachinkr7368
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: fix/5332-evm-cancellation-cause


📝 Commits (1)

  • 7741421 fix(evm): preserve the exact artifact cancellation reason

📊 Changes

2 files changed (+57 additions, -1 deletions)

View changed files

📝 src/evm/EvmoleFailures.test.ts (+55 -0)
📝 src/evm/EvmoleFailures.ts (+2 -1)

📄 Description

Summary

Preserve the caller's exact abort reason when inspect_evm_interface is cancelled during the carrier read. evmInterfaceFailure now projects the reason recorded by the artifact owner through artifactFileCancellationCause instead of exposing the internal ArtifactReaderFailure / ArtifactFileCancelled wrapper as the typed error's cause. Fixes #5332.

Problem and expected behavior

The provider's carrier read can observe the caller's signal at its entry checkpoint (for example, while the inherited-limits preflight is completing) or after the carrier descriptor closes. In both timings the reader raises an ArtifactReaderFailure whose reason is "cancelled", and evmInterfaceFailure returned:

  • _tag: AnalysisCancelledError (correct), but
  • cause: <the internal reader wrapper> (wrong).

Sibling artifact owners (sigrok, tshark, wabt and pwntools) already use artifactFileCancellationCause, so the same signal produced different causes depending on the provider.

Expected: AnalysisCancelledError.cause is the caller's abort reason by identity, including undefined, null, string, plain-object and Error reasons. Cleanup evidence stays attached, and a signal that is already aborted before entry keeps its existing behavior.

Change and scope

  • src/evm/EvmoleFailures.ts: in the ArtifactReaderFailure + reason === "cancelled" branch, use artifactFileCancellationCause(cause).
  • src/evm/EvmoleFailures.test.ts: regression coverage for the reader entry checkpoint, an owner-recorded cancellation and the post-close ArtifactFileCancelled, across five opaque reason shapes, plus a cleanup-preservation case.

Not included: no change to other EVM failure classifications, the OwnedCommandFailure branch, the CLI/MCP projection or the worker lifecycle. This is an ordinary fix inside the existing provider boundary; no new capability or maintainer scope decision is required.

Contract and boundary impact

  • Semantic owner and earliest changed stage: EVM failure translation in src/evm/EvmoleFailures.ts; no runtime stage changes.
  • Contribution scope fit and linked maintainer decision: existing artifact/provider boundary; not applicable (no new capability).
  • CLI and MCP/tool-catalog contract: unchanged. projectAnalysisError builds cancellation details from the operation and cleanup state, not cause, so user-visible CLI/MCP output is unchanged.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none; artifact identity and cleanup evidence are retained.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata, package, or installation impact: none.

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

  • Tests added or updated: src/evm/EvmoleFailures.test.ts — five opaque reason shapes (undefined, null, string, object, Error) for the entry-checkpoint ArtifactReaderFailure, an owner-recorded cancellation and the post-close ArtifactFileCancelled; one cleanup-evidence case.
  • Base reproduction: I ran the reproduction test from #5332 (emulated Linux x64, mocked /proc/self/limits, real carrier descriptor). Without the fix: 2 failed | 1 passed — admission and close reported causeIsReason:false, causeName:"ArtifactReaderFailure"; with the fix: 3 passed, all modes causeIsReason:true. The temporary repro file was removed after verification.
  • User-visible CLI/MCP output (if applicable): not applicable; neither projection exposes cause, so the observable JSON is unchanged. The defect is in the typed error seen by in-process callers.
  • Remaining proof gaps: the boundary suite is Linux-only and skipped its provider cases on this macOS host (2 passed, 30 skipped). No real Linux x64 prlimit/EVMole worker run; the reproduction emulated the platform, /proc/self/limits and the prlimit executable check.

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 test:local -- src/evm/EvmoleFailures.test.ts src/evm/EvmoleInterfaceAdapter.test.ts src/evm/EvmBytecodeCarrier.test.ts src/evm/EvmWorkerLimits.test.ts — 4 files, 41 tests passed.
  • npm run test:boundary -- tests/boundary/evm/evmoleInterfaceProvider.test.ts — 2 passed, 30 skipped (Linux x64 provider cases; host is macOS arm64).
  • Reproduction test from #5332 (temporary, removed after the run) — base: 2 failed | 1 passed; fixed: 3 passed.
  • npm run typecheck — exit 0.
  • npx oxfmt --check src/evm/EvmoleFailures.ts src/evm/EvmoleFailures.test.ts — pass.
  • npx oxlint src/evm/EvmoleFailures.ts src/evm/EvmoleFailures.test.ts — no errors (pre-existing complexity/size warnings on evmInterfaceFailure remain).
  • npm run verify:module-boundaries — 2,252 source files checked, pass.
  • npm run lint — pass.
  • git diff --check — clean.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. cause is opaque diagnostic data; cancellation typing, cleanup flags and projections are unchanged.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable. No real EVMole worker was run; see the proof gaps above.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none. Cancellation reasons remain opaque and are not serialized.

Author readiness

Human owner: @sachinkr7368

  • 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.

AI-assisted: the diff and evidence were prepared by an AI coding agent. The human owner directed that this PR be marked ready for initial review and dictated the readiness declarations above.

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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/5369 **Author:** [@sachinkr7368](https://github.com/sachinkr7368) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/5332-evm-cancellation-cause` --- ### 📝 Commits (1) - [`7741421`](https://github.com/morluto/rea/commit/77414215bf5d8311d423365c9ccf4a208057be51) fix(evm): preserve the exact artifact cancellation reason ### 📊 Changes **2 files changed** (+57 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/evm/EvmoleFailures.test.ts` (+55 -0) 📝 `src/evm/EvmoleFailures.ts` (+2 -1) </details> ### 📄 Description ## Summary Preserve the caller's exact abort reason when `inspect_evm_interface` is cancelled during the carrier read. `evmInterfaceFailure` now projects the reason recorded by the artifact owner through `artifactFileCancellationCause` instead of exposing the internal `ArtifactReaderFailure` / `ArtifactFileCancelled` wrapper as the typed error's `cause`. Fixes #5332. ## Problem and expected behavior The provider's carrier read can observe the caller's signal at its entry checkpoint (for example, while the inherited-limits preflight is completing) or after the carrier descriptor closes. In both timings the reader raises an `ArtifactReaderFailure` whose reason is `"cancelled"`, and `evmInterfaceFailure` returned: - `_tag: AnalysisCancelledError` (correct), but - `cause: <the internal reader wrapper>` (wrong). Sibling artifact owners (`sigrok`, `tshark`, wabt and pwntools) already use `artifactFileCancellationCause`, so the same signal produced different causes depending on the provider. Expected: `AnalysisCancelledError.cause` is the caller's abort reason by identity, including `undefined`, `null`, string, plain-object and `Error` reasons. Cleanup evidence stays attached, and a signal that is already aborted before entry keeps its existing behavior. ## Change and scope - `src/evm/EvmoleFailures.ts`: in the `ArtifactReaderFailure` + `reason === "cancelled"` branch, use `artifactFileCancellationCause(cause)`. - `src/evm/EvmoleFailures.test.ts`: regression coverage for the reader entry checkpoint, an owner-recorded cancellation and the post-close `ArtifactFileCancelled`, across five opaque reason shapes, plus a cleanup-preservation case. Not included: no change to other EVM failure classifications, the `OwnedCommandFailure` branch, the CLI/MCP projection or the worker lifecycle. This is an ordinary fix inside the existing provider boundary; no new capability or maintainer scope decision is required. ## Contract and boundary impact - Semantic owner and earliest changed stage: EVM failure translation in `src/evm/EvmoleFailures.ts`; no runtime stage changes. - Contribution scope fit and linked maintainer decision: existing artifact/provider boundary; not applicable (no new capability). - CLI and MCP/tool-catalog contract: unchanged. `projectAnalysisError` builds cancellation details from the operation and cleanup state, not `cause`, so user-visible CLI/MCP output is unchanged. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: none; artifact identity and cleanup evidence are retained. - Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable. - Generated metadata, package, or installation impact: none. Expected effects (check known effects; use documentation-only on its own). Unchecked items do not establish absence; leave uncertainties visible. - [x] 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 - Tests added or updated: `src/evm/EvmoleFailures.test.ts` — five opaque reason shapes (`undefined`, `null`, string, object, `Error`) for the entry-checkpoint `ArtifactReaderFailure`, an owner-recorded cancellation and the post-close `ArtifactFileCancelled`; one cleanup-evidence case. - Base reproduction: I ran the reproduction test from #5332 (emulated Linux x64, mocked `/proc/self/limits`, real carrier descriptor). Without the fix: `2 failed | 1 passed` — `admission` and `close` reported `causeIsReason:false`, `causeName:"ArtifactReaderFailure"`; with the fix: `3 passed`, all modes `causeIsReason:true`. The temporary repro file was removed after verification. - User-visible CLI/MCP output (if applicable): not applicable; neither projection exposes `cause`, so the observable JSON is unchanged. The defect is in the typed error seen by in-process callers. - Remaining proof gaps: the boundary suite is Linux-only and skipped its provider cases on this macOS host (2 passed, 30 skipped). No real Linux x64 prlimit/EVMole worker run; the reproduction emulated the platform, `/proc/self/limits` and the prlimit executable check. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run test:local -- src/evm/EvmoleFailures.test.ts src/evm/EvmoleInterfaceAdapter.test.ts src/evm/EvmBytecodeCarrier.test.ts src/evm/EvmWorkerLimits.test.ts` — 4 files, 41 tests passed. - `npm run test:boundary -- tests/boundary/evm/evmoleInterfaceProvider.test.ts` — 2 passed, 30 skipped (Linux x64 provider cases; host is macOS arm64). - Reproduction test from #5332 (temporary, removed after the run) — base: 2 failed | 1 passed; fixed: 3 passed. - `npm run typecheck` — exit 0. - `npx oxfmt --check src/evm/EvmoleFailures.ts src/evm/EvmoleFailures.test.ts` — pass. - `npx oxlint src/evm/EvmoleFailures.ts src/evm/EvmoleFailures.test.ts` — no errors (pre-existing complexity/size warnings on `evmInterfaceFailure` remain). - `npm run verify:module-boundaries` — 2,252 source files checked, pass. - `npm run lint` — pass. - `git diff --check` — clean. ## Compatibility, safety, and release - Breaking changes or migration steps: none. `cause` is opaque diagnostic data; cancellation typing, cleanup flags and projections are unchanged. - Real Hopper/Ghidra, browser, or OS coverage: not applicable. No real EVMole worker was run; see the proof gaps above. - Package or release metadata impact: none. - Security, privacy, process, or containment review: none. Cancellation reasons remain opaque and are not serialized. ## Author readiness Human owner: @sachinkr7368 - [x] 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. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. _AI-assisted: the diff and evidence were prepared by an AI coding agent. The human owner directed that this PR be marked ready for initial review and dictated the readiness declarations above._ ## 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:43:56 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6902
No description provided.