Repository navigation
fix(ida): stop legacy string paging against fake-paginated upstream - #2880
sugeladi2450 wants to merge 4 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
ef5fe5b to
c5ae1de
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c5ae1de525
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (name === "list_strings") { | ||
| const offset = Number(args.offset ?? 0); | ||
| const count = Number(args.count ?? 100); | ||
| const data = count === 0 ? all : all.slice(offset, offset + count); |
There was a problem hiding this comment.
Exercise count-zero against the supported legacy provider
For the large-string legacy-IDA case this patch claims to fix, the fixture makes the expected producer behavior true by construction: count === 0 returns all and forces a null cursor. The validation recorded in this commit contains only this simulated boundary/harness, not the documented verify:ida CLI/MCP lane against ida-pro-mcp 1.4.0, so it cannot establish that the real bridge accepts and serializes the full reply or that the GUI hang is gone. Run that lane, or explicitly mark the provider behavior unverified.
AGENTS.md reference: AGENTS.md:L77-L77
Useful? React with 👍 / 👎.
| const s = legacyStringSchema.parse(item); | ||
| return { address: s.address, value: s.string }; | ||
| }), | ||
| await this.call("list_strings", { offset, count: 0 }), |
There was a problem hiding this comment.
Measure the unbounded page before claiming the hang is fixed
For large inventories, this changes a series of bounded 100-item MCP responses into one unbounded response, changing transport/serialization peak memory and runtime. The commit compares only call counts and checks that 200,000 in-memory items avoid RangeError, but reports none of elapsed time, CPU time, peak process-family memory, cold/warm runs, token usage, or unmeasured costs; without equivalent before/after measurements, the performance claim could merely shift pressure from IDA enumeration to the bridge or Node process. Record the required metrics on representative completed tasks.
AGENTS.md reference: AGENTS.md:L52-L56
Useful? React with 👍 / 👎.
Bobtoshi
left a comment
There was a problem hiding this comment.
Checked ida-pro-mcp 1.4.0's actual paginate/list_strings source: count zero returns the complete remainder and terminates the cursor, so the single-read correction matches the pinned protocol.
I ran the session-client and native-protocol suites, and added a permanent 200,000-string companion regression in sugeladi2450#1. It verifies one upstream call plus the exact first/last records; it passes with the loop append and fails with a spread append (RangeError). The supplement keeps this work on the existing fix rather than introducing a competing upstream PR.
This validates recorded protocol behavior. Real Windows IDA 9.3 GUI execution was unavailable, so I am not claiming an independent real-GUI hang reproduction or verification.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e7707a4d39
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (bufferLimit !== null) | ||
| throw new AnalysisResourceConstraintError( | ||
| "ida_mcp_response", | ||
| "memory", |
There was a problem hiding this comment.
Classify receive-buffer overflow as a transport constraint
When a stdio reply exceeds the new 64 MiB maxBufferSize, this tags the measured receive-buffer cap as resource: "memory". projectAnalysisError therefore serializes a memory constraint, and analysisErrorPresentation.ts tells CLI/MCP callers to inspect worker/host memory, even though additional RAM cannot alter this hard-coded framing limit. Classify it as transport (with boundary-specific recovery if necessary) so the reported limit and remediation remain accurate.
AGENTS.md reference: AGENTS.md:L29-L29
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c24e345822
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| : null; | ||
| if (bufferLimit !== null) | ||
| throw new AnalysisResourceConstraintError( | ||
| "ida_mcp_response", |
There was a problem hiding this comment.
Report the requested operation on buffer overflow
In the attached legacy list_strings/search_strings path, when a reply crosses the 64 MiB cap, IdaSessionClient.#failure preserves this object unchanged through its cause instanceof AnalysisError branch, and projectAnalysisError publishes this constructor argument as details.operation. The caller therefore receives operation: "ida_mcp_response" instead of the analysis operation it invoked; translate the boundary failure to the current requested operation so CLI/MCP error attribution remains meaningful.
AGENTS.md reference: AGENTS.md:L29-L29
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 40cfb1c11e
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (bufferLimit !== null) | ||
| throw new AnalysisResourceConstraintError( |
There was a problem hiding this comment.
Preserve stderr on oversized replies
When the stdio provider has emitted stderr before a reply exceeds 64 MiB, this early throw bypasses the bounded, redacted stderr-capture path immediately below it. The resulting AnalysisResourceConstraintError therefore has no capturedOutput, so diagnostics preserved for every other transport failure are lost specifically on this new capacity failure; attach the same bounded/redacted tail to the typed error before throwing.
AGENTS.md reference: AGENTS.md:L13-L13
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 53f2d10705
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| await client | ||
| .callTool({ name, arguments: args }, { timeout: config.timeoutMs }) | ||
| .catch(transportFailure), | ||
| .catch((cause: unknown) => transportFailure(cause, name)), |
There was a problem hiding this comment.
Preserve the public operation on oversized replies
When an oversized reply occurs for a public operation whose upstream tool has a different name—e.g. search_strings calls list_strings in IdaOperationRunner.run—the fresh evidence in this revision is that this catch now passes only the upstream tool name. IdaSessionClient.#failure preserves this AnalysisResourceConstraintError, so CLI/MCP details.operation and the message say list_strings instead of the requested search_strings; translate the constraint at the session boundary to the current AnalysisOperation while retaining its capture and limits.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
| if (bufferLimit !== null) | ||
| throw new AnalysisResourceConstraintError( | ||
| operation, | ||
| "transport", |
There was a problem hiding this comment.
Override remediation for upstream receive limits
When a legacy reply exceeds 64 MiB, using transport without a custom remediation makes analysisErrorRemediationAction select the generic outbound-delivery advice: discover retained records/export Evidence and assume the connection remains usable. This failure explicitly retained no partial Evidence and occurred while receiving the inventory from IDA, so those steps cannot recover the missing result; provide a boundary-specific remediationAction for this constructor instead.
AGENTS.md reference: AGENTS.md:L29-L29
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dbb06706d7
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| throw new AnalysisResourceConstraintError( | ||
| operation, | ||
| "transport", | ||
| `Upstream IDA MCP reply exceeded the ${bufferLimit[1]}-byte transport limit; no partial Evidence was returned.`, |
There was a problem hiding this comment.
Avoid denying partial Evidence from earlier IDA calls
In the legacy attached path, when procedure_pseudo_code or analyze_function has completed lookup or assembly calls and a later decompilation reply exceeds 64 MiB, those completed calls are already in runner.raw; IdaSessionClient.#failure then exposes them through retainPartialObservation. This unconditional reason therefore tells CLI/MCP callers that no partial Evidence was returned while the same projected error contains partial Evidence; limit the statement to the failed reply or derive it after session-level retention.
AGENTS.md reference: AGENTS.md:L29-L29
Useful? React with 👍 / 👎.
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7133822929
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const bufferLimit = | ||
| cause instanceof Error | ||
| ? /ReadBuffer exceeded maximum size of (\d+) bytes/u.exec(cause.message) | ||
| : null; |
There was a problem hiding this comment.
Handle buffer overflow on the transport error channel
When a legacy reply actually exceeds 64 MiB, the pinned SDK reports ReadBuffer exceeded... from the stdio stdout/transport error path rather than using that Error as the rejection reason for callTool; the pending request then sees only a timeout or generic connection closure. Consequently this regex is never matched and callers do not receive the intended AnalysisResourceConstraintError or reported byte limit. The new 11 MiB test only verifies that the limit was raised, not the over-limit path, so retain the transport error and exercise a reply above the configured cap.
AGENTS.md reference: AGENTS.md:L29-L29
Useful? React with 👍 / 👎.
Share tagged readiness observations, retain partial provider facts, authenticate bridge identity, bound diagnostics, and preserve cancellation and lost-session reasons. Fail closed for unparsed MIPS ABI attributes and macOS saved Hopper databases without a script-capable bridge route. Reviewed fixes: #2010, #2108, #2513, #2695, #2731, #2771, #2828, #2867, #2868, #2870, #2880, #2919, #2945, #2961, #2981, #2998, #3000, #3002. Validation: 285 focused source/boundary tests passed. Real Ghidra, IDA, Linux Hopper, and Windows provider runs were not repeated. BREAKING CHANGE: MIPS targets with unresolved GNU ABI attributes and saved Hopper databases on macOS are refused rather than advertised as supported.
|
Heads up: main already has this change in d4bd65c. The code is in 🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
|
Superseded by the delivered IDA compatibility changes in d4bd65c53. Main bounds upstream transport replies and fetches legacy string inventories/searches in a single upstream request instead of following fake pagination, with production-boundary regressions. Closing this earlier proposal; #2786 is already resolved. |
|
@sugeladi2450, thanks for investigating legacy IDA string handling and transport limits. Main includes the bounded single-call handling for that path. |
Summary
Fixes IDA GUI hangs in legacy attached mode when running
rea search <binary> <pattern> --jsonor
rea list stringsagainst the ida-pro-mcp 1.4.0 server. Fixes #2786.Problem and expected behavior
Smallest trigger:
rea search test.exe hello --jsonagainst ida-pro-mcp 1.4.0 with a binarycontaining a large number of strings. REA's legacy
strings()loops overlist_stringswithcount: 100untilnext_offsetis null. Upstream 1.4.0'slist_stringsis only apparentlypaginated: every call re-enumerates the whole database (
for item in idautils.Strings()) andthen slices, so the paging loop forces O(N²/100) upstream enumeration work and IDA's GUI hangs
inside the "Generating strings" loop.
Expected behavior: listing and searching strings complete in one upstream round trip with the
same result set as before.
Change and scope
The upstream
paginatehelper documentscount == 0as "0 means remainder": it returns thefull remainder in one page and sets
next_offsetto null. Passingcount: 0in the legacybranch of
strings()turns the paging loop into a single call (O(N)) with the same page shapeand no server-side contract change. The existing "pagination did not advance" guard is kept.
Two additional adjustments are included in the same change:
for...ofloop instead of a spread(
result.push(...page.data.map(...))). With a single full-size page, a spread would exceedthe JavaScript call argument limit (~65535) and throw
RangeErroron large binaries.hello-0/0x3000,hello-249/0x30f9,and the literal-search head/tail) in addition to result lengths, so wrong upstream data
cannot pass the test.
Contribution scope fit: ordinary fix within existing boundaries — "not applicable" for a
maintainer scope decision (no new provider, no target execution/injection/mutation).
Contract and boundary impact
count: 0is documented upstream semantics;no tool added, removed, or renamed.
modes; legacy mode result set unchanged.
Expected effects:
Evidence and regression coverage
src/ida/IdaSessionClient.test.ts— new"attached IDA legacy string inventory" case (fake-paginated upstream, 250 strings), asserting
call counts,
count: 0, and concrete address/value pairs at the head and tail of results.upstream, run against the upstream base revision and against this change:
list_stringscalls 25 (allcount: 100) → 1 (count: 0); literalsearch_stringstotalcalls 50 → 2. Result length identical (1111) both ways. A second harness with 200,000 strings
confirmed no
RangeErrorfrom the append path.For evidence-bearing changes:
Validation performed
npx vitest run src/ida/IdaSessionClient.test.ts -t "single upstream calls"— 1 passed.RangeError, full result returned.npx tsc --noEmit— passes (0 errors) at the verification baseline.npx oxlint src/ida/IdaOperationRunner.ts src/ida/IdaSessionClient.test.ts— 0 errors.npx oxfmt --checkon the changed files — passes.Compatibility, safety, and release
count: 0was already valid upstream input.Before merge
covers the final diff (declared not applicable).
type(scope): outcome.(none needed; no contract text changed).
(no output shape change).