[GH-ISSUE #8589] [Bug] One-shot final-close cancellation drops linked source Evidence #6663

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

Originally created by @morluto on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/8589

Originally assigned to: @kaoru0822-kitauji on GitHub.

Before submitting

  • I searched open and closed issues for a related report.
  • I removed credentials and private target data.

Area

Evidence, investigation state, or recovery

Observed behavior

On draft #8585 head 2a0415cd5, an application-boundary control cancelled a one-shot trace_feature after real Ghidra completed the observation, at the start of final session close. The returned cancelled error included the completed trace as details.partial_observation, with one link to the historical-project health Evidence. The requested includeEvidenceSources result did not include that source. Final close returned success; the target SHA-256 remained unchanged and it was not executed.

A corresponding controlled test with a synthetic provider showed the same result for the new procedure_references CLI prototype in #8588. In a separate real-Ghidra control of that prototype, the procedure observation likewise retained its source link in the cancellation error but returned no source records. The controls wrap the production session's close method and trigger an AbortController at that boundary; they do not simulate an arbitrary external SIGINT, failed cleanup, or a natural timing frequency.

Reproduction

  1. Use the production runDirectAnalysis entry point with a real existing Ghidra project whose selected program has a recorded analysis-history report, includeEvidenceSources: true, and a caller-owned AbortSignal.
  2. Wrap the real session's close() for this control: abort the signal immediately before delegating to the original close, and await that close.
  3. Run trace_feature on the opened target. The result is cancelled and the partial trace contains an evidence_links ID, but result.sourceEvidence is undefined even though its closure was available before close.
  4. On #8585, source inspection shows runAnalysis only returns captured sourceEvidence on success, while publishCliAnalysisEvidence returns the projected error directly. Thus the public CLI cannot obtain these captured sources from that error path; this last conclusion is source-derived, not a separate public-process cancellation reproduction.

A further CLI-registration control used the real trace command and real Ghidra session in a separate Node process. A wrapper sent that process SIGINT at the start of final close and then delegated to the real close. The CLI emitted cancelled with the same partial trace and linked source ID, no source Evidence, and no requested bundle; the process exited 130, close completed, and the target digest was unchanged. This is a controlled signal at an injected boundary, not a naturally timed external cancellation or a stock unmodified CLI entrypoint.

Expected behavior

Preserve or explicitly describe the source-closure state of a completed partial observation after finalization cancellation or cleanup failure, without turning cancellation into successful delivery, silently writing after cancellation, overstating retention, or emitting unbounded error payloads. If full linked Evidence cannot be delivered, provide a truthful bounded handoff and recovery outcome.

Impact and scope

The partial result may cite a source the caller cannot reconstruct from the one-shot error. The source might be obtainable by reopening an unchanged project, but this is not guaranteed and would be a new observation. No autonomous-agent behavior was tested. This does not claim that cleanup failed or that source records are missing in an active MCP session.

REA version

#8585 2a0415cd5; related experimental procedure-reference CLI on #8588 0fabb2f7b.

Runtime and platform

macOS arm64, Node 24.22.1, Ghidra 12.1.4, JDK 21; one source-built Mach-O and test-owned existing project.

Target and artifact context

Static analysis of a source-built executable; no target execution or mutation. The Ghidra project contains an existing analysis-history report. Executable SHA-256: ce8582268988e3efe7441bdf87c69626be149ff5cb5ddf99b20f5d90d0f6b4d6.

Interface

Application boundary and actual registered CLI command in a controlled process; stock CLI entrypoint not independently exercised.

Earliest failure stage

One-shot finalization and error projection after source-closure capture.

Relevant output or evidence

Completed trace ID ev_44e6f4f1b47f0dbeea8b907fda9ffcb94b5b5da9a8429885f502f41d34622d06 linked source ev_bd8f42f000d2c1f6f9e24e412d5303b694a5dc2b286d3193b73e000e8ebb60a8. The returned typed result had sourceEvidence: undefined; the real session close completed successfully.

Typed outcome or recovery expected

Distinguish completed observation, linked source availability, cancellation, cleanup, and any output publication receipt. Bound allocation and transport expansion. Validate success, late cancellation, cleanup failure, missing source, source-too-large and retry/handoff behaviors at the relevant public and production boundaries.

Analysis or suspected cause

runAnalysis captures sources before cleanup but constructs the sourceEvidence field only in its successful return. Cleanup-failure and cancellation returns project errors without it. A correct fix also needs the CLI delivery/error contract to expose or explicitly report the lost closure; merely adding an internal property to an error result is insufficient.

Additional context

Related #8427 (importing standalone unretained Evidence), #8425/#8444 (source-publication failures), and #4276 (MCP cancellation recovery). This report concerns a completed one-shot observation with a source already available before successful final cleanup.

cc @gensokyo-dev @kaoru0822-kitauji @N0zoM1z0

Originally created by @morluto on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/8589 Originally assigned to: @kaoru0822-kitauji on GitHub. ### Before submitting - [x] I searched open and closed issues for a related report. - [x] I removed credentials and private target data. ### Area Evidence, investigation state, or recovery ### Observed behavior On draft #8585 head `2a0415cd5`, an application-boundary control cancelled a one-shot `trace_feature` after real Ghidra completed the observation, at the start of final session close. The returned `cancelled` error included the completed trace as `details.partial_observation`, with one link to the historical-project `health` Evidence. The requested `includeEvidenceSources` result did not include that source. Final close returned success; the target SHA-256 remained unchanged and it was not executed. A corresponding controlled test with a synthetic provider showed the same result for the new `procedure_references` CLI prototype in #8588. In a separate real-Ghidra control of that prototype, the procedure observation likewise retained its source link in the cancellation error but returned no source records. The controls wrap the production session's close method and trigger an AbortController at that boundary; they do not simulate an arbitrary external SIGINT, failed cleanup, or a natural timing frequency. ### Reproduction 1. Use the production `runDirectAnalysis` entry point with a real existing Ghidra project whose selected program has a recorded analysis-history report, `includeEvidenceSources: true`, and a caller-owned AbortSignal. 2. Wrap the real session's `close()` for this control: abort the signal immediately before delegating to the original close, and await that close. 3. Run `trace_feature` on the opened target. The result is `cancelled` and the partial trace contains an `evidence_links` ID, but `result.sourceEvidence` is undefined even though its closure was available before close. 4. On #8585, source inspection shows `runAnalysis` only returns captured `sourceEvidence` on success, while `publishCliAnalysisEvidence` returns the projected error directly. Thus the public CLI cannot obtain these captured sources from that error path; this last conclusion is source-derived, not a separate public-process cancellation reproduction. A further CLI-registration control used the real `trace` command and real Ghidra session in a separate Node process. A wrapper sent that process SIGINT at the start of final close and then delegated to the real close. The CLI emitted `cancelled` with the same partial trace and linked source ID, no source Evidence, and no requested bundle; the process exited 130, close completed, and the target digest was unchanged. This is a controlled signal at an injected boundary, not a naturally timed external cancellation or a stock unmodified CLI entrypoint. ### Expected behavior Preserve or explicitly describe the source-closure state of a completed partial observation after finalization cancellation or cleanup failure, without turning cancellation into successful delivery, silently writing after cancellation, overstating retention, or emitting unbounded error payloads. If full linked Evidence cannot be delivered, provide a truthful bounded handoff and recovery outcome. ### Impact and scope The partial result may cite a source the caller cannot reconstruct from the one-shot error. The source might be obtainable by reopening an unchanged project, but this is not guaranteed and would be a new observation. No autonomous-agent behavior was tested. This does not claim that cleanup failed or that source records are missing in an active MCP session. ### REA version #8585 `2a0415cd5`; related experimental procedure-reference CLI on #8588 `0fabb2f7b`. ### Runtime and platform macOS arm64, Node 24.22.1, Ghidra 12.1.4, JDK 21; one source-built Mach-O and test-owned existing project. ### Target and artifact context Static analysis of a source-built executable; no target execution or mutation. The Ghidra project contains an existing analysis-history report. Executable SHA-256: `ce8582268988e3efe7441bdf87c69626be149ff5cb5ddf99b20f5d90d0f6b4d6`. ### Interface Application boundary and actual registered CLI command in a controlled process; stock CLI entrypoint not independently exercised. ### Earliest failure stage One-shot finalization and error projection after source-closure capture. ### Relevant output or evidence Completed trace ID `ev_44e6f4f1b47f0dbeea8b907fda9ffcb94b5b5da9a8429885f502f41d34622d06` linked source `ev_bd8f42f000d2c1f6f9e24e412d5303b694a5dc2b286d3193b73e000e8ebb60a8`. The returned typed result had `sourceEvidence: undefined`; the real session close completed successfully. ### Typed outcome or recovery expected Distinguish completed observation, linked source availability, cancellation, cleanup, and any output publication receipt. Bound allocation and transport expansion. Validate success, late cancellation, cleanup failure, missing source, source-too-large and retry/handoff behaviors at the relevant public and production boundaries. ### Analysis or suspected cause `runAnalysis` captures sources before cleanup but constructs the `sourceEvidence` field only in its successful return. Cleanup-failure and cancellation returns project errors without it. A correct fix also needs the CLI delivery/error contract to expose or explicitly report the lost closure; merely adding an internal property to an error result is insufficient. ### Additional context Related #8427 (importing standalone unretained Evidence), #8425/#8444 (source-publication failures), and #4276 (MCP cancellation recovery). This report concerns a completed one-shot observation with a source already available before successful final cleanup. cc @gensokyo-dev @kaoru0822-kitauji @N0zoM1z0
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#6663
No description provided.