Skip to content

fix(ghidra): name the startup deadline setting when startup times out - #4590

Merged
morluto merged 1 commit into
morluto:mainfrom
RishTheFish21:fix/4241-startup-timeout
Oct 16, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
RishTheFish21:fix/4241-startup-timeout

Conversation

@RishTheFish21

Copy link
Copy Markdown
Contributor

Summary

When Ghidra doesn't finish importing and analyzing a target within its startup deadline, REA reports provider_timeout with the generic "Analysis took too long. Try a smaller request, then run rea doctor if it continues." For a large binary that's the wrong advice: the request isn't too big, the deadline is too short, and rea doctor reports Ghidra as healthy. The setting that controls it, REA_GHIDRA_STARTUP_TIMEOUT_MS, is only mentioned in docs/installation.md.

A Ghidra startup timeout now names the deadline that was applied and the settings that change it.

Fixes #4241. The memory half of the issue landed in d52a488 (from #4275). This PR covers its second request. The optional third idea, surfacing analyzer messages like "Untested Go version" as limitations, isn't included.

Problem and expected behavior

Smallest trigger: REA_GHIDRA_STARTUP_TIMEOUT_MS=5000 rea inspect "$(command -v node)" --provider ghidra --json.

Expected: the error says which deadline elapsed and how to change it, without sending the user to rea doctor. A timeout on an individual bridge request is a different deadline and should keep its current wording.

Hopper already does this: its startup timeout remediation names REA_HOPPER_STARTUP_TIMEOUT_MS. Ghidra's equivalent setting is never mentioned in its timeout error.

Change and scope

  • GhidraProviderClient.ts: a timeout failure carrying the startup-deadline message now gets a user message naming the applied deadline and REA_GHIDRA_STARTUP_TIMEOUT_MS, plus remediation to raise it or skip expensive analyzers with REA_GHIDRA_DISABLED_ANALYZERS. The remediation also notes that the MCP client's own tool-call timeout is separate.
  • GhidraSessionError.ts: the five places that raise the startup timeout (GhidraClient, GhidraClientStartup, and two in GhidraSocketConnection) share one GHIDRA_STARTUP_DEADLINE_ELAPSED constant, so the projection can't drift from them.
  • AnalysisTimeoutError accepts an optional provider-specific userMessage and remediationAction, and the error presentation uses them when present. Every other timeout keeps its current text.
  • docs/installation.md: notes the new guidance next to the REA_GHIDRA_STARTUP_TIMEOUT_MS description.

Bridge request deadlines and the per-file auto-analysis deadline (analysis_timeout) are unchanged.

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage: Ghidra session error projection (projectPrimarySessionError); provider-neutral AnalysisTimeoutError presentation.
  • Contribution scope fit and linked maintainer decision: Bug fix within existing boundaries. Maintainer decision not applicable.
  • CLI and MCP/tool-catalog contract: Same provider_timeout code and details.timeout_ms. Only the message and remediation.action text change, and only for Ghidra startup timeouts.
  • Provider, bridge, target-format, or platform compatibility: Ghidra only. No bridge change. Hopper timeouts are unaffected.
  • Evidence, artifact, provenance, or reconstruction contract: Error path only. No Evidence or profile change.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): Not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): 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/ghidra/GhidraProvider.behavior.test.ts, "Ghidra deadline guidance":
    • A startup-deadline timeout projects to provider_timeout with timeout_ms: 250, a message naming the 250 ms deadline and REA_GHIDRA_STARTUP_TIMEOUT_MS, and remediation naming both settings without rea doctor.
    • A bridge request timeout keeps the generic guidance.
  • Base reproduction or other evidence: Real Ghidra 12.1.4 on macOS arm64, REA_GHIDRA_STARTUP_TIMEOUT_MS=5000 rea inspect "$(command -v node)" --provider ghidra --json:
    • upstream/main: "code":"provider_timeout", message and action both Analysis took too long. Try a smaller request, then run \rea doctor` if it continues.`
    • this branch: "code":"provider_timeout", message Ghidra did not finish importing and analyzing the target within its 5000 ms startup deadline (REA_GHIDRA_STARTUP_TIMEOUT_MS)., action Large binaries can need longer: set REA_GHIDRA_STARTUP_TIMEOUT_MS above 5000 in the environment that starts REA, or skip expensive analyzers with REA_GHIDRA_DISABLED_ANALYZERS, then open the target again. An MCP client's own tool-call timeout is separate and may also need raising.
  • User-visible CLI/MCP output (if applicable): see above.
  • Remaining proof gaps: Not run on Linux or Windows. The startup timeout is recognized by its shared message constant rather than a dedicated failure kind; a dedicated kind would be cleaner but touches every timeout consumer.

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:focused -- src/ghidra/GhidraProvider.behavior.test.ts tests/boundary/providers/ghidra/ghidraJavaLaunch.test.ts: passed
  • npm run check:fast: passed
  • npm run lint: passed
  • npm run knip: passed
  • npm run docs:check: passed
  • Real Ghidra 12.1.4 before/after run on macOS arm64 (above)

Compatibility, safety, and release

  • Breaking changes or migration steps: None. Same error code and details; only the message and remediation text for Ghidra startup timeouts change.
  • Real Hopper/Ghidra, browser, or OS coverage: Real Ghidra 12.1.4 on macOS arm64.
  • Package or release metadata impact: None.
  • Security, privacy, process, or containment review: Text-only change to an existing error path.

Author readiness

Human owner: @RishTheFish21

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

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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-16T20:50:01.693534Z 1a573f0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Ghidra startup timeout errors now name the applied deadline and the settings users can change.

  • Ghidra startup timeouts name the deadline that expired.

Reviews (1) · Last reviewed commit: "fix(ghidra): name the startup deadline s..." · Reviewed by Greptile

@jgt87

jgt87 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Additional Windows evidence supporting this startup-deadline guidance.

Environment: Windows 11 x64, REA npm 6.5.0, Ghidra 12.1.4, JDK 21.0.12.1, Node 24.14.1. The input was a locally installed 13,933,176-byte PE32 x86 executable (SHA-256 1e39a3e8a90242ee978c0e2779ac7ff0aa70c3399fbbc70e595de6a147826f6a). Static analysis only; the executable was not run.

Using fresh standalone SDK MCP sessions, the sequence was open_binary with provider_id: "ghidra", followed by analyze_function({procedure: "0x949fd8"}).

  • Default provider deadline: the first analysis failed after 331,123 ms. The structured primary error was provider_timeout, with timeout_ms: 330000 and Ghidra startup deadline elapsed. The generic smaller-request/doctor guidance was returned. There was also a transient cleanup lock failure; that is separate from this PR.
  • With REA_GHIDRA_STARTUP_TIMEOUT_MS=900000 in the REA server environment and an explicit SDK tool-call timeout of 1,020,000 ms, the same first analysis succeeded after 427,070 ms. It returned the requested procedure, 144 assembly lines and nonempty pseudocode.
  • Reopening the same target in that live session succeeded in 46 ms. A different, previously unrequested procedure_assembly({procedure: "0x928f60"}) succeeded in 28 ms.
  • close_binary succeeded in 1,959 ms; a subsequent binary_session reported open: false.

A separate attempt through the existing Codex connection had hit its client-side 300-second deadline before REA's default startup deadline. This reinforces the need to explain both settings.

For this input, the observed timeout was insufficient cold-start allowance rather than a persistent hang. A smaller function query would still trigger the same full import/auto-analysis startup. The proposed guidance to name the startup setting and distinguish the MCP client's deadline addresses the actual recovery path.

Coverage limitation: this verifies the existing timeout override and successful Windows Ghidra lifecycle on the released package. I have not run this PR branch's changed message rendering on Windows. These are individual reproduction timings, not a controlled performance benchmark.

@morluto
morluto merged commit 1b56237 into morluto:main Oct 16, 2026
36 checks passed
@morluto

morluto commented Oct 20, 2026

Copy link
Copy Markdown
Owner

Thanks @RishTheFish21 for making Ghidra startup timeouts explain which deadline actually elapsed. Naming REA_GHIDRA_STARTUP_TIMEOUT_MS and the separate analyzer option gives users a relevant next step when a large import simply needs more time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working provider: ghidra Analysis provider / engine: ghidra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Ghidra "Java heap space" during import is reported as execution_failure ("run rea doctor"), not a memory resource constraint

3 participants