Skip to content

fix(ida): report missing tools when a compatibility profile mismatches - #2307

Merged
morluto merged 2 commits into
morluto:mainfrom
vt0x78:fix/ida-profile-mismatch-diagnostics
Oct 13, 2026
Merged

morluto merged 2 commits into
morluto:mainfrom
vt0x78:fix/ida-profile-mismatch-diagnostics

Conversation

@vt0x78

@vt0x78 vt0x78 commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Closes part of #2301.

Problem

When an upstream server serves a tool set that matches neither compatibility profile, #initialize() throws an AnalysisProtocolError naming every missing tool. That message never reaches the caller. AnalysisProtocolError maps to unreadable_output, so the CLI prints this and nothing else:

code: unreadable_output
category: execution_failure
message: "Analysis returned an unreadable result. Retry once; if it continues, run `rea doctor`."

Nothing points at a version or profile mismatch, and doctor still reports the registration as healthy because it validates the registration shape rather than probing the live tool list. I found the cause by logging the stdio traffic and noticing the exchange stops right after tools/list.

This is easy to hit today. Upstream's main is at 2.0.0, which renamed the GUI tools and no longer serves idb_close, so both profiles reject it. Installing from GitHub is upstream's documented method, so anyone following it lands there.

Change

Throw a ProviderAdapterError instead, carrying the mode, the expected profile and the missing tool names through the diagnostics channel that already surfaces in details. The same text stays as userMessage, so no information is lost, and the projected code moves from unreadable_output to execution_failure, which describes a startup refusal better than malformed output does.

The caller now gets:

details:
  provider_id: ida
  diagnostics:
    mode: headless
    expected_profile: database-supervisor
    missing_tools: [idb_close]

I also added a short section to docs/ida-provider.md saying which upstream versions each profile accepts. The existing text was accurate but never stated that current main is unsupported.

Scope

This is the diagnosability half of #2301. I deliberately left the compatibility question alone: #closeDatabase() verifies that the response reports owned, saved and backend, and upstream 2.0.0 has no close tool to map that contract onto, so what should replace it looks like a maintainer decision rather than something to guess at here. Happy to follow up once there is a direction.

Verification

  • npm run typecheck passes.
  • Two new tests in IdaSessionClient.test.ts cover the headless and attached paths, asserting the projected details names the absent tool and the expected profile. Both pass.
  • oxfmt --check and oxlint are clean on the changed files. The remaining max-lines and complexity warnings in src/ida/ are pre-existing.

One thing worth flagging: on an unmodified checkout, vitest run src/ida/IdaSessionClient.test.ts already fails 27 of 37 tests on Windows. The same 27 fail before and after this change, and my two additions pass, but I could not get a fully green suite locally to compare against. Happy to look into those separately if they are not already known.

A profile mismatch reached the caller as a bare AnalysisProtocolError,
which projects to `unreadable_output` with a generic message. The error
already named every missing tool, but none of that detail survived, so
the only way to identify the cause was to log the JSON-RPC traffic and
notice the exchange stopping after `tools/list`.

Throw a ProviderAdapterError instead, carrying the mode, the expected
profile and the missing tool names through the diagnostics channel that
already surfaces in `details`. Document which upstream versions each
profile accepts, since upstream `main` now serves neither.

Refs morluto#2301
@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.

@nikolay-dementiev

Copy link
Copy Markdown
Contributor

Checked this branch (head b49f127) on real IDA Professional 9.1 against the pinned headless supervisor (ida-pro-mcp c133c38, idalib-mcp --stdio). The supervisor was started with --profile listing every tool the headless profile requires except callees:

rea function <arm64 hello> _main --json main 91b8f58 this PR
code unreadable_output, no details execution_failure
details none diagnostics: {mode: "headless", expected_profile: "database-supervisor", missing_tools: ["callees"]}

The headless supervisor at upstream main c133c38 does serve idb_close (details in #2301), so this diagnostic covers servers that differ from the pinned build rather than current upstream main.

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

@greptileai review

@greptile-apps

greptile-apps Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

This PR is set for a Plus review. TREX isn't supported with Plus or Apex reviews yet, so Greptile reviews this PR at Base while TREX is on.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous test failure is addressed and no new blocking issue was found.

Summary

The PR reports incompatible IDA tool catalogs through ProviderAdapterError, preserving the missing tool names and expected profile in caller-visible diagnostics.

  • IDA startup reports which tools and profile do not match.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Read tools/list] --> B{Required tools present?}
  B -->|Yes| C[Continue initialization]
  B -->|No| D[ProviderAdapterError]
  D --> E[projectAnalysisError]
  E --> F[execution_failure with profile and missing_tools]
Loading

Reviews (2) · Last reviewed commit: "fix: reconcile main and review findings ..." · Reviewed by Greptile

Comment thread src/ida/IdaSessionClient.ts Resolved
@morluto
morluto merged commit beca34f into morluto:main Oct 13, 2026
1 check passed
@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
@morluto morluto added the provider: ida Analysis provider / engine: ida label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working provider: ida Analysis provider / engine: ida

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants