mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 19:53:50 +00:00
refactor(ida): launch stdio registrations through the owned MCP transport (#10739)
* refactor(ida): launch stdio registrations through the owned MCP transport 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. * fix(ida): keep owned stdio cleanup observable and resolve Windows interpreter 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. * fix(process): end a stalled stdio launch when the owned MCP transport 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. * fix(ida): bound the Windows command lookup by the registration timeout 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. * test(ida): stub REA's PATH again now that process inspection runs ps from fixed locations * test(ida): pass the required registration protocol in owned-stdio fixtures * fix(ida): report an uninspectable Windows command candidate with its path and code * refactor(ida): take the host platform from composition, not an ambient read * fix(verify): pass the host platform to the real IDA upstream check * fix(process): keep a failed launch's preparation cleanup owned by the 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.
This commit is contained in:
1 parent
607a7872bb
commit
998faa4118
12 files changed
+777
-120
No files matched your search
@@ -114,3 +114,20 @@ it("stops a pending filesystem lookup when its owner aborts", async () => {
|
||||
complete({ isFile: () => true });
|
||||
expect(lookup.stat).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("resolves a path-qualified command at its own location with PATHEXT, never on PATH", async () => {
|
||||
lookup.stat.mockImplementation(async (path: string) => ({
|
||||
isFile: () => path === "C:\\project\\.venv\\Scripts\\python.EXE",
|
||||
}));
|
||||
expect(
|
||||
await findWindowsExecutable(
|
||||
".venv\\Scripts\\python",
|
||||
{ PATH: "C:\\tools", PATHEXT: ".COM;.EXE" },
|
||||
options(),
|
||||
),
|
||||
).toEqual({ ok: true, value: "C:\\project\\.venv\\Scripts\\python.EXE" });
|
||||
expect(lookup.stat.mock.calls.map(([path]) => path)).toEqual([
|
||||
"C:\\project\\.venv\\Scripts\\python.COM",
|
||||
"C:\\project\\.venv\\Scripts\\python.EXE",
|
||||
]);
|
||||
});
|
||||
Reference in new issue
Block a user