Repository navigation
refactor(ida): launch stdio registrations through the owned MCP transport - #10739
Conversation
Codex Review Summary: ❌ FailedThis 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. |
[Medium impact] The reviewed changes appear safe to merge; failed-launch cleanup now remains owned and retryable. SummaryMoves IDA stdio registrations to the shared owned transport. The latest change keeps cleanup from failed launches available until release succeeds.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["IDA stdio registration"] --> B["OwnedMcpStdioTransport.start()"]
B --> C{"Launch succeeds?"}
C -->|Yes| D["Exchange bounded JSON-RPC messages"]
C -->|No| E["Retain failed-launch cleanup"]
D --> F["close()"]
E --> F
F --> G["Stop owned processes and release preparation resources"]
G --> H{"Cleanup confirmed?"}
H -->|Yes| I["Mark cleanup released"]
H -->|No| J["Return ProviderCleanupError and retain owner"]
J -->|Retry| F
Reviews (11) · Last reviewed commit: "fix(process): keep a failed launch's pre..." · Reviewed by Greptile |
7c6da23 to
7bba0b9
Compare
7bba0b9 to
ed755ac
Compare
|
Greptile's 2/5 summary reviewed 7c6da23, before the follow-up commit (now rebased onto main as the second commit on this branch). Status of each finding at the current head:
Validation on the rebased head: |
|
@greptileai review — the 2/5 summary predates the follow-up commit; see the status comment above for each finding. |
|
Greptile's 4/5 findings on ed755ac, both fixed in 5cc117c:
Validation: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5cc117cc12
ℹ️ 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".
…port IDA stdio servers now run as an owned process group (POSIX) or job (Windows) through OwnedMcpStdioTransport instead of the SDK's unowned child. Windows bare commands resolve against the registration PATH/PATHEXT and .cmd/.bat launchers run through the shared WindowsBatchCommand cmd.exe invocation. The frame limit is classified from the transport's typed OwnedMcpOutputLimitError instead of parsing SDK error text, detach no longer reaches into the SDK's private _process, and the per-operation byte budget is optional.
…erpreter paths - StructuredContentMcpClient observes SDK-initiated closes like OwnedMcpClient, so a failed handshake with incomplete owned cleanup cannot reject unhandled. - OwnedMcpStdioTransport attaches an owner-redacted captured output to cleanup failures; IDA passes its retained stderr tail. - findWindowsExecutable resolves path-qualified commands at their own location with PATHEXT; IDA routes every Windows registration through it and refuses non-drive paths with an actionable remedy before the owned launcher.
… closes OwnedMcpStdioTransport passes the launcher a signal it aborts with OwnerCancellation.ownerClosed when it stops, so IDA's Windows PATH/PATHEXT lookup stalled on an unreachable directory no longer holds close() open; IDA reports the interrupted lookup by its abort reason. The IDA environment tests use createTestTempDirectory for owned temporary roots.
The PATH/PATHEXT search for a stdio registration now runs under a ProviderStartupDeadline of the registration's timeoutMs that also follows the transport's close signal. A lookup stalled on an unreachable PATH directory ends as an AnalysisTimeoutError (phase windows_path_lookup) instead of leaving connect() pending, matching Apktool's Windows lookup.
…from fixed locations
7659657 to
4fc2ce2
Compare
dbdfcd2 to
1e3400e
Compare
|
Greptile Issue 1 (uninspectable Windows command reported as missing): valid, fixed in ca2fe17.
|
Main moved Windows PATH/PATHEXT search into src/process/executableSearch. Path-qualified commands (resolved at their own location with PATHEXT, never on PATH) now live in that owner's windowsPathCandidates, and findWindowsExecutable probes its candidates.
# Conflicts: # src/ida/IdaMcpConnection.ts
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
… stdio transport's close OwnedMcpStdioTransport discarded the launch rejection before a supervisor existed, so an ownership-helper preparation that transferred a cleanup owner (or reported a cleanup failure without one) was dropped and close() reported success. The transport's close now closes each transferred owner from processInspectionCleanupFailures, and reports a ProviderCleanupError naming the preparation resource until it does; a later close retries it.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
IDA stdio registrations ran through the MCP SDK's
StdioClientTransport. REA did not own that child. It had no process-group or job ownership or cleanup verification, anddetach()reached into the SDK's private_process. The connection now launches stdio servers through the sharedOwnedMcpStdioTransport, as JADX andrea mcp doctoralready do.Workstream W4 (lifecycle), decision (2) of the queued plan; no linked issue.
Problem and expected behavior
ProviderCleanupError.detach()usedReflect.get(transport, "_process"), which depends on SDK internals.ReadBuffer exceeded maximum size of N bytesmessage text.Expected: one owned process family per stdio connection. The limit failure is classified from a typed value. Only the selected environment snapshot plus the registration's
envreaches the child.Change and scope
src/ida/IdaMcpConnection.ts:OwnedMcpStdioTransport. Its host environment is the selected snapshot; the overrides areIDA_MCP_MAX_WORKERS=1plus the registrationenv.expectedCommand: null, because registrations commonly launch interpreter-driven scripts.onStderr.findWindowsExecutable(allowBatch)..cmd/.batlaunchers run through the sharedwindowsBatchCommandcmd.exe invocation with verbatim arguments. Owned Windows processes require an absolute executable, and Node refuses batch files without a shell. On Windows this now depends on REA's native-control artifact; the maintainer decision accepts that.ProviderCleanupError(ida_mcp_close).detach()calls the transport's newdetach(), which unrefs the supervised process and streams.src/process/OwnedMcpStdioTransport.ts:maxOperationBytesis optional. IDA bounds frames only, as it did with the SDK.OwnedMcpOutputLimitError(scope,limitBytes). Messages are unchanged, so JADX and doctor classification is unaffected.detach().findWindowsExecutableresolves a path-qualified command (C:\Python313\python,.venv\Scripts\python) at its own location with PATHEXT, because the owned launcher'sCreateProcessWcall never appends an extension. IDA routes every Windows registration through it.StructuredContentMcpClientextendsOwnedMcpClient, so an SDK-initiated close after a failed handshake cannot reject unhandled.OwnedMcpStdioTransportattaches an owner-suppliedcapturedOutputto its cleanup failure; IDA passes its redacted stderr tail.Contribution scope: existing provider, no new authority; not applicable.
Contract and boundary impact
OwnedMcpStdioTransportowns the IDA stdio process and its frame limit.IdaMcpConnectionconsumes its typed failure. The superseded regex classification, the SDK env-default suppression and the_processreach-in are removed.AnalysisResourceConstraintError(transport,max_response_bytes).IdaSessionClientpath.Expected effects:
Evidence and regression coverage
src/ida/IdaMcpEnvironment.test.ts):null), not the SDK's empty-string defaults. It stubs REA's own PATH to an ambient value again: since fix(process): run ps from fixed system locations, not REA's PATH #10755, owned cleanup runspsfrom fixed system locations, so the earlier workaround that kept REA's PATH real is reverted. The child must see only the selected PATH.transportallowance withmax_response_bytes: 4096.C:\Tools\ida-mcp.cmdregistration onwin32launches throughcmd.exe /d /e:on /v:off /s /cwith verbatim arguments and protocol stdin.src/ida/IdaMcpEnvironment.test.tsfail.WindowsOwnedProcess.Validation performed
2026-11-15, after merging current
origin/main: main madeprotocolrequired on IDA registrations, so the owned-stdio fixtures now passprotocol: "legacy"(the local gate refused on this typecheck).npm run check:fast— passed;npm run test:local -- src/ida/IdaMcpEnvironment.test.ts src/ida/IdaMcpOwnedCleanup.test.ts src/ida/IdaMcpWindowsLaunch.test.ts src/ida/IdaMcpConnection.test.ts— 49 passed; architecture guards — passed.npm run test:focused -- src/ida/IdaMcpEnvironment.test.ts src/ida/IdaMcpConnection.test.ts src/ida/IdaSessionClient.test.ts tests/boundary/idaStartupDiagnostics.test.ts tests/boundary/mcp/idaTransport.test.ts tests/boundary/providers/ida/retainedConnectionRetry.test.ts tests/boundary/providers/mcpHttpUtf8.test.ts src/ida/IdaProvider.test.ts src/ida/IdaStartupFailures.test.ts src/ida/IdaDoctor.test.ts: 10 files, 311 passed.npm run test:focused -- src/mcpDoctor.cleanup.test.ts tests/boundary/android/jadxMcpTransport.test.ts tests/boundary/mcp/mcpStartupPolicy.test.ts(other owned-transport consumers): 23 passed.Same IDA environment test file against the unfixed source: 3 failed.
tsc --noEmit -p tsconfig.json: passed. The pre-pushcheck:fasthook passed.After the review follow-up:
npm run test:focused -- src/ida/IdaMcpConnection.test.ts tests/boundary/mcp/idaTransport.test.ts tests/boundary/android/jadxMcpTransport.test.ts src/desktop/AgentEnvComputer.test.ts src/providers/StructuredContentMcpClient.test.ts src/mcpDoctor.cleanup.test.ts src/ida/IdaMcpOwnedCleanup.test.ts src/ida/IdaMcpWindowsLaunch.test.ts src/ida/IdaMcpEnvironment.test.ts: 9 files, 202 passed.npm run test:local -- src/jeb/JebMcpConnection.test.ts src/process/WindowsExecutable.test.ts: passed. With the client and lookup fixes reverted, the new tests failed (4 failures plus an Unhandled Rejection).npm run check:fast: passed.After the second review follow-up (transport-owned launch abort, temp-directory helper):
npm run test:local -- src/ida/IdaMcpEnvironment.test.ts src/ida/IdaMcpOwnedCleanup.test.ts src/ida/IdaMcpWindowsLaunch.test.ts src/process/WindowsExecutable.test.ts: 17 passed; the stalled-lookup test timed out (30 s) with the abort removed.npm run test:focused -- tests/boundary/android/jadxMcpTransport.test.ts tests/boundary/process/artifactVerifierCleanupOwner.test.ts: 11 passed.npm run check:fast: passed.After the third review follow-up (lookup bounded by the registration timeout):
npm run test:focused -- src/ida/IdaMcpWindowsLaunch.test.ts src/ida/IdaMcpConnection.test.ts: 46 passed; the new timeout test timed out (30 s) on the previous commit. Architecture guards and the pre-pushcheck:fasthook passed.After rebasing onto main with fix(process): run ps from fixed system locations, not REA's PATH #10755 and reverting the PATH workaround:
npm run test:focused -- src/ida/IdaMcpEnvironment.test.ts: 2 passed.npm run check:fast: passed.After the fourth review follow-up (an uninspectable Windows candidate keeps its path and code):
npm run test:local -- src/ida/IdaMcpWindowsLaunch.test.ts: 6 passed. The new case failed on the previous commit. The pre-pushcheck:fasthook passed.2026-11-15, after merging main with the host-platform owner (refactor(platform): give the host platform one owner and ratchet ambient process.platform reads #10911): the local gate refused on the
ambient-host-platformguard (process.platformdefault inIdaMcpConnection). Composition now passesHOST_PLATFORM.platformto the IDA connection factory, and the ambient read is gone.node scripts/verify/architecture-guards.mjs: passed.npm run check:fast: passed.npm run test:local -- src/ida/IdaMcpWindowsLaunch.test.ts src/ida/IdaMcpConnection.test.ts src/ida/IdaMcpEnvironment.test.ts: 49 passed.node scripts/verify-module-boundaries.mjs: passed.macOS only.
After review (a failed launch's transferred ownership-preparation cleanup is owned by the transport's close and retried until released) and merging main (
snapshotEnvironmentnow takes the host platform):npm run test:local -- src/process/OwnedMcpStdioTransport.test.ts src/ida/IdaMcpOwnedCleanup.test.ts src/ida/IdaMcpWindowsLaunch.test.ts src/ida/IdaMcpConnection.test.ts— 51 passed (the two new preparation cases failed on the previous revision);npm run test:focused -- tests/boundary/android/jadxMcpTransport.test.ts— 9 passed;npm run check:fastand architecture guards — passed.Compatibility, safety, and release
quoteWindowsBatchTokeninstead of being escaped.Author readiness
Human owner:
Before merge
type(scope): outcome.