[GH-ISSUE #1242] fix(native): preserve decoded return evidence in Ghidra instruction flow #440

Closed
opened 2026-10-15 18:25:05 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @N0zoM1z0 on GitHub (Oct 9, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/1242

Observed failure

inspect_native_instruction returns status:decoded, mnemonic:RET, but flow.kind:terminal. It also says: Terminal flow is not classified as a return without provider evidence. The public flow schema already supports return.

On the audited x86 PE, inspecting address 0x40b23d reproduces this with both uppercase/padded and canonical address input. The instruction is part of a shared epilogue. This does not establish which earlier function owns that tail or determine an earlier function's calling convention.

Reproduction and required behavior

Open a source-owned x86 fixture with an ordinary return and inspect that instruction through CLI/MCP. Preserve specific provider return evidence, rather than collapsing it into generic terminal flow. Include the evidence/provenance used for classification; do not classify every terminal instruction as a return or merge separate function extents.

Cover plain return, return with stack cleanup, jumps to shared tails, other terminal instructions and unsupported architectures. Unknown classification remains explicit when the provider actually cannot distinguish it.

Source

bridge/ghidra/ReaGhidraBridge.java:884 maps only call/jump/terminal/fallthrough; bridge/ghidra/ReaGhidraBridge.java:923 adds the blanket limitation. The installed 12.1.4 API exposes instruction p-code and PcodeOp.RETURN, verified with javap; the audit did not separately collect p-code for this instruction. Choose classification using representative producer data, not a universal mnemonic-only heuristic. This restores the return-fact outcome requested in closed #491.

Verification and scope

The contradictory decoded RET/terminal result was reproduced with real Ghidra through both published and main MCP servers. The proposed source-owned regression fixture is an acceptance requirement, not an already executed additional test.

Audit date: 2026-10-09. Latest npm dist-tag verified as rea-agents@6.1.0; current main tested at f4c99ab8a53806dd57dc24b3d5a600905bcb4686. Linux x64, Node 24.18.0, MCP client SDK 2.3.1. Native observations use unmodified Ghidra 12.1.4 and JDK 21, two CPUs and a 512 MiB Java heap. No target execution or executable mutation was used for the static native checks.

Originally created by @N0zoM1z0 on GitHub (Oct 9, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/1242 ### Observed failure `inspect_native_instruction` returns `status:decoded`, `mnemonic:RET`, but `flow.kind:terminal`. It also says: `Terminal flow is not classified as a return without provider evidence.` The public flow schema already supports `return`. On the audited x86 PE, inspecting address `0x40b23d` reproduces this with both uppercase/padded and canonical address input. The instruction is part of a shared epilogue. This does not establish which earlier function owns that tail or determine an earlier function's calling convention. ### Reproduction and required behavior Open a source-owned x86 fixture with an ordinary return and inspect that instruction through CLI/MCP. Preserve specific provider return evidence, rather than collapsing it into generic terminal flow. Include the evidence/provenance used for classification; do not classify every terminal instruction as a return or merge separate function extents. Cover plain return, return with stack cleanup, jumps to shared tails, other terminal instructions and unsupported architectures. Unknown classification remains explicit when the provider actually cannot distinguish it. ### Source [bridge/ghidra/ReaGhidraBridge.java:884](https://github.com/morluto/rea/blob/f4c99ab8a53806dd57dc24b3d5a600905bcb4686/bridge/ghidra/ReaGhidraBridge.java#L884) maps only call/jump/terminal/fallthrough; [bridge/ghidra/ReaGhidraBridge.java:923](https://github.com/morluto/rea/blob/f4c99ab8a53806dd57dc24b3d5a600905bcb4686/bridge/ghidra/ReaGhidraBridge.java#L923) adds the blanket limitation. The installed 12.1.4 API exposes instruction p-code and `PcodeOp.RETURN`, verified with `javap`; the audit did not separately collect p-code for this instruction. Choose classification using representative producer data, not a universal mnemonic-only heuristic. This restores the return-fact outcome requested in closed #491. ### Verification and scope The contradictory decoded RET/terminal result was reproduced with real Ghidra through both published and main MCP servers. The proposed source-owned regression fixture is an acceptance requirement, not an already executed additional test. Audit date: 2026-10-09. Latest npm dist-tag verified as `rea-agents@6.1.0`; current main tested at `f4c99ab8a53806dd57dc24b3d5a600905bcb4686`. Linux x64, Node 24.18.0, MCP client SDK 2.3.1. Native observations use unmodified Ghidra 12.1.4 and JDK 21, two CPUs and a 512 MiB Java heap. No target execution or executable mutation was used for the static native checks.
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#440
No description provided.