[PR #647] [MERGED] fix(ghidra): preserve request and shutdown failure diagnostics #2138

Closed
opened 2026-10-16 21:14:46 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/647
Author: @N0zoM1z0
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/6/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/ghidra-failure-diagnostics


📝 Commits (1)

  • e4bf504 fix(ghidra): preserve request and shutdown failure diagnostics

📊 Changes

10 files changed (+567 additions, -13 deletions)

View changed files

📝 docs/installation.md (+8 -0)
📝 src/ghidra/GhidraClient.ts (+27 -4)
➕ src/ghidra/GhidraRequestQueue.test.ts (+92 -0)
📝 src/ghidra/GhidraRequestQueue.ts (+2 -1)
➕ src/ghidra/GhidraSessionError.test.ts (+81 -0)
📝 src/ghidra/GhidraSessionError.ts (+39 -4)
➕ tests/boundary/mcp/ghidraFailureDiagnostics.test.ts (+79 -0)
📝 tests/boundary/mcp/ghidraMcpHarness.ts (+6 -2)
📝 tests/boundary/providers/ghidra/ghidraClient.test.ts (+218 -0)
📝 tests/fixtures/fakeGhidra.mjs (+15 -2)

📄 Description

Changes

Fixes #639. Fixes #640.

  • Keep the existing Result<JsonValue, GhidraSessionError> contract, generic protocol request-settlement failure and process unexpected-shutdown failure. Preserve the original rejection as the internal cause.
  • Project Error name/message/available code into diagnostics.failure_cause, so the provider and CLI/MCP projection retain actionable context. Non-Error rejections retain a primitive value/message or an explicit type; opaque objects are not serialized.
  • Include failure kind/message/diagnostics in an unconfirmed-shutdown warning. Keep shutdown best effort and continue process/runtime cleanup, including invalid acknowledgements and remote shutdown errors.
  • Redact actual bridge authentication tokens from projected messages/codes, including errors settled after failed-startup cleanup and retry. Preserve local paths, URLs and other analysis context. No error stack or original cause object is sent to clients.

Example CLI error fields / MCP structuredContent.error (fixture):

{
  "code": "execution_failure",
  "category": "execution_failure",
  "message": "Analysis could not complete. Retry once; if it continues, run `rea doctor`.",
  "retryable": false,
  "remediation": {
    "action": "Analysis could not complete. Retry once; if it continues, run `rea doctor`."
  },
  "details": {
    "provider_id": "ghidra",
    "operation": "list_procedures",
    "diagnostics": {
      "target_path": "/tmp/public-fixture",
      "failure_cause": {
        "name": "TypeError",
        "message": "Decode failed [REDACTED]: /tmp/password-fixture http://localhost/secret?token=public-value",
        "code": "EDECODE"
      }
    }
  }
}

Verification

  • Original main queue: the three new Error/string/null rejection regressions fail because the cause is discarded. Original main client also fails the wire/shutdown cause and shutdown-warning metadata regressions. Invalid acknowledgement cleanup remains successful.
  • npm run test:focused -- src/ghidra/GhidraRequestQueue.test.ts src/ghidra/GhidraSessionError.test.ts src/ghidra/GhidraProvider.behavior.test.ts tests/boundary/providers/ghidra/ghidraClient.test.ts tests/boundary/providers/ghidra/ghidraLauncher.test.ts tests/boundary/mcp/ghidraFailureDiagnostics.test.ts tests/boundary/mcp/ghidraRoutingMcp.test.ts tests/boundary/mcp/ghidraEvidenceMcp.test.ts
  • Focused suite: 8 files / 59 tests passed (15.64 seconds).
  • npm run check:fast and npm run check: 2 / 5 static tasks passed.
  • npm run docs:check.
  • Real Linux x64 Ghidra 12.1.4 / JDK 21: npm run verify:ghidra passed for debug/stripped ELF, native DWARF type layout, actual CLI and stdio MCP, inline Evidence, native value tracing, direct function comparison and complete cleanup. Dense switch validation still has 40 mappings and no residual unknowns.

Fault regressions use injected production executor/logger seams and an owned socket/process fixture; the real provider lane separately verifies the shipped Ghidra workflow. No real Hopper/macOS/Windows verification performed or new platform support claimed. No binaries, private targets or captured artifacts included.


🔄 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/647 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/ghidra-failure-diagnostics` --- ### 📝 Commits (1) - [`e4bf504`](https://github.com/morluto/rea/commit/e4bf5048ca69df65b440a1996b231c951e9a87d8) fix(ghidra): preserve request and shutdown failure diagnostics ### 📊 Changes **10 files changed** (+567 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `docs/installation.md` (+8 -0) 📝 `src/ghidra/GhidraClient.ts` (+27 -4) ➕ `src/ghidra/GhidraRequestQueue.test.ts` (+92 -0) 📝 `src/ghidra/GhidraRequestQueue.ts` (+2 -1) ➕ `src/ghidra/GhidraSessionError.test.ts` (+81 -0) 📝 `src/ghidra/GhidraSessionError.ts` (+39 -4) ➕ `tests/boundary/mcp/ghidraFailureDiagnostics.test.ts` (+79 -0) 📝 `tests/boundary/mcp/ghidraMcpHarness.ts` (+6 -2) 📝 `tests/boundary/providers/ghidra/ghidraClient.test.ts` (+218 -0) 📝 `tests/fixtures/fakeGhidra.mjs` (+15 -2) </details> ### 📄 Description ## Changes Fixes #639. Fixes #640. - Keep the existing `Result<JsonValue, GhidraSessionError>` contract, generic `protocol` request-settlement failure and `process` unexpected-shutdown failure. Preserve the original rejection as the internal cause. - Project Error name/message/available code into `diagnostics.failure_cause`, so the provider and CLI/MCP projection retain actionable context. Non-Error rejections retain a primitive value/message or an explicit type; opaque objects are not serialized. - Include failure kind/message/diagnostics in an unconfirmed-shutdown warning. Keep shutdown best effort and continue process/runtime cleanup, including invalid acknowledgements and remote shutdown errors. - Redact actual bridge authentication tokens from projected messages/codes, including errors settled after failed-startup cleanup and retry. Preserve local paths, URLs and other analysis context. No error stack or original cause object is sent to clients. Example CLI error fields / MCP `structuredContent.error` (fixture): ```json { "code": "execution_failure", "category": "execution_failure", "message": "Analysis could not complete. Retry once; if it continues, run `rea doctor`.", "retryable": false, "remediation": { "action": "Analysis could not complete. Retry once; if it continues, run `rea doctor`." }, "details": { "provider_id": "ghidra", "operation": "list_procedures", "diagnostics": { "target_path": "/tmp/public-fixture", "failure_cause": { "name": "TypeError", "message": "Decode failed [REDACTED]: /tmp/password-fixture http://localhost/secret?token=public-value", "code": "EDECODE" } } } } ``` ## Verification - Original main queue: the three new Error/string/null rejection regressions fail because the cause is discarded. Original main client also fails the wire/shutdown cause and shutdown-warning metadata regressions. Invalid acknowledgement cleanup remains successful. - `npm run test:focused -- src/ghidra/GhidraRequestQueue.test.ts src/ghidra/GhidraSessionError.test.ts src/ghidra/GhidraProvider.behavior.test.ts tests/boundary/providers/ghidra/ghidraClient.test.ts tests/boundary/providers/ghidra/ghidraLauncher.test.ts tests/boundary/mcp/ghidraFailureDiagnostics.test.ts tests/boundary/mcp/ghidraRoutingMcp.test.ts tests/boundary/mcp/ghidraEvidenceMcp.test.ts` - Focused suite: **8 files / 59 tests passed** (15.64 seconds). - `npm run check:fast` and `npm run check`: 2 / 5 static tasks passed. - `npm run docs:check`. - **Real Linux x64 Ghidra 12.1.4 / JDK 21:** `npm run verify:ghidra` passed for debug/stripped ELF, native DWARF type layout, actual CLI and stdio MCP, inline Evidence, native value tracing, direct function comparison and complete cleanup. Dense switch validation still has 40 mappings and no residual unknowns. Fault regressions use injected production executor/logger seams and an owned socket/process fixture; the real provider lane separately verifies the shipped Ghidra workflow. No real Hopper/macOS/Windows verification performed or new platform support claimed. No binaries, private targets or captured artifacts included. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:14:46 +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#2138
No description provided.