[PR #974] [MERGED] feat(ghidra): make the startup deadline configurable #2543

Closed
opened 2026-10-17 21:07:22 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/974
Author: @LiquidSnake0
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/8/2026
Merged by: @morluto

Base: main ← Head: delai-ghidra-reglable


📝 Commits (4)

  • 08be9d6 feat(ghidra): make the startup deadline configurable
  • 40ca059 docs(ghidra): document REA_GHIDRA_STARTUP_TIMEOUT_MS
  • d8f05e9 fix(ghidra): parse startup deadlines through runtime configuration
  • 9f39277 chore: merge main into Ghidra startup timeout PR

📊 Changes

11 files changed (+145 additions, -17 deletions)

View changed files

📝 README.md (+2 -0)
📝 docs/installation.md (+6 -2)
📝 docs/mcp-contracts.md (+5 -5)
📝 src/config/environment.ts (+2 -0)
➕ src/config/ghidraStartupTimeout.ts (+20 -0)
📝 src/config/parseConfig.ts (+1 -0)
📝 src/config/types.ts (+1 -0)
📝 src/ghidra/GhidraClient.ts (+3 -2)
➖ src/ghidra/GhidraDefaults.ts (+0 -2)
📝 src/ghidra/GhidraProvider.behavior.test.ts (+74 -0)
📝 src/ghidra/GhidraProviderClient.ts (+31 -6)

📄 Description

Summary

Make the Ghidra provider startup deadline configurable with REA_GHIDRA_STARTUP_TIMEOUT_MS. The default stays 330,000 ms.

Problem and expected behavior

On large binaries, import plus default auto-analysis takes longer than the fixed 330 s deadline, so the first Ghidra-backed query always fails and the analysis is discarded. Reproduction: an 8 MB 32-bit PE game executable with about 20,000 functions; analyzeHeadless measured 377 s of analysis (about 384 s in total). With REA 4.0.1, every first query timed out at 330 s; retrying restarted the analysis from scratch.

Expected: a user with a large target can raise the deadline without patching REA.

Change and scope

  • src/ghidra/GhidraDefaults.ts: ghidraStartupTimeoutFromEnvironment() reads REA_GHIDRA_STARTUP_TIMEOUT_MS; a positive safe integer overrides the default, an absent, empty or invalid value keeps 330,000 ms. GHIDRA_STARTUP_TIMEOUT_MS is computed from it, so existing call sites are unchanged.
  • Docs: docs/installation.md and docs/mcp-contracts.md mention the variable next to the 330,000 ms deadline.
  • Not included: no new MCP tool parameter or CLI flag; no change to the client's own per-call deadline.

Contract and boundary impact

  • Semantic owner and earliest changed stage: Ghidra provider defaults.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: Ghidra only; default behavior unchanged.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Process execution, authorization, cleanup, or containment impact: none; only the deadline value changes.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • Tests added: src/ghidra/GhidraDefaults.test.ts (default when absent or empty, valid override, invalid values 0, -5, abc, 1.5 fall back to the default).
  • Base reproduction: the 8 MB PE above, first query failing at 330 s on 4.0.1.
  • Executed with the override set to 900000: the same target completed analysis and served search_strings and procedure_assembly.
  • Remaining proof gaps: not tested on Windows or macOS hosts.

Validation performed

  • npx vitest run src/ghidra/GhidraDefaults.test.ts — 3 passed
  • npm run check:fast — typecheck and lint passed
  • npx oxfmt --check docs/installation.md docs/mcp-contracts.md — correct format
  • Real Ghidra 12.1.4 with JDK 21 on Linux, MCP server over stdio — analysis completed with the override

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: Ghidra 12.1.4 on Linux.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: reads one environment variable; invalid values are ignored.

🔄 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/974 **Author:** [@LiquidSnake0](https://github.com/LiquidSnake0) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/8/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `delai-ghidra-reglable` --- ### 📝 Commits (4) - [`08be9d6`](https://github.com/morluto/rea/commit/08be9d6a60ba9389fb348ffe7094562c321f75f0) feat(ghidra): make the startup deadline configurable - [`40ca059`](https://github.com/morluto/rea/commit/40ca05935286fa47ee68605f4f39e32504c7b350) docs(ghidra): document REA_GHIDRA_STARTUP_TIMEOUT_MS - [`d8f05e9`](https://github.com/morluto/rea/commit/d8f05e9fffeaf8e7b6e9cfd56e71d6d3d6629010) fix(ghidra): parse startup deadlines through runtime configuration - [`9f39277`](https://github.com/morluto/rea/commit/9f39277f34f182f89f4bc2d12edd590b7e0ccbe6) chore: merge main into Ghidra startup timeout PR ### 📊 Changes **11 files changed** (+145 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+2 -0) 📝 `docs/installation.md` (+6 -2) 📝 `docs/mcp-contracts.md` (+5 -5) 📝 `src/config/environment.ts` (+2 -0) ➕ `src/config/ghidraStartupTimeout.ts` (+20 -0) 📝 `src/config/parseConfig.ts` (+1 -0) 📝 `src/config/types.ts` (+1 -0) 📝 `src/ghidra/GhidraClient.ts` (+3 -2) ➖ `src/ghidra/GhidraDefaults.ts` (+0 -2) 📝 `src/ghidra/GhidraProvider.behavior.test.ts` (+74 -0) 📝 `src/ghidra/GhidraProviderClient.ts` (+31 -6) </details> ### 📄 Description ## Summary Make the Ghidra provider startup deadline configurable with `REA_GHIDRA_STARTUP_TIMEOUT_MS`. The default stays 330,000 ms. ## Problem and expected behavior On large binaries, import plus default auto-analysis takes longer than the fixed 330 s deadline, so the first Ghidra-backed query always fails and the analysis is discarded. Reproduction: an 8 MB 32-bit PE game executable with about 20,000 functions; `analyzeHeadless` measured 377 s of analysis (about 384 s in total). With REA 4.0.1, every first query timed out at 330 s; retrying restarted the analysis from scratch. Expected: a user with a large target can raise the deadline without patching REA. ## Change and scope - `src/ghidra/GhidraDefaults.ts`: `ghidraStartupTimeoutFromEnvironment()` reads `REA_GHIDRA_STARTUP_TIMEOUT_MS`; a positive safe integer overrides the default, an absent, empty or invalid value keeps 330,000 ms. `GHIDRA_STARTUP_TIMEOUT_MS` is computed from it, so existing call sites are unchanged. - Docs: `docs/installation.md` and `docs/mcp-contracts.md` mention the variable next to the 330,000 ms deadline. - Not included: no new MCP tool parameter or CLI flag; no change to the client's own per-call deadline. ## Contract and boundary impact - Semantic owner and earliest changed stage: Ghidra provider defaults. - CLI and MCP/tool-catalog contract: none. - Provider, bridge, target-format, or platform compatibility: Ghidra only; default behavior unchanged. - Evidence, artifact, provenance, or reconstruction contract: none. - Process execution, authorization, cleanup, or containment impact: none; only the deadline value changes. - Generated metadata, package, or installation impact: none. ## Evidence and regression coverage - Tests added: `src/ghidra/GhidraDefaults.test.ts` (default when absent or empty, valid override, invalid values `0`, `-5`, `abc`, `1.5` fall back to the default). - Base reproduction: the 8 MB PE above, first query failing at 330 s on 4.0.1. - Executed with the override set to 900000: the same target completed analysis and served `search_strings` and `procedure_assembly`. - Remaining proof gaps: not tested on Windows or macOS hosts. ## Validation performed - `npx vitest run src/ghidra/GhidraDefaults.test.ts` — 3 passed - `npm run check:fast` — typecheck and lint passed - `npx oxfmt --check docs/installation.md docs/mcp-contracts.md` — correct format - Real Ghidra 12.1.4 with JDK 21 on Linux, MCP server over stdio — analysis completed with the override ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: Ghidra 12.1.4 on Linux. - Package or release metadata impact: none. - Security, privacy, process, or containment review: reads one environment variable; invalid values are ignored. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:07:22 +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#2543
No description provided.