Repository navigation
fix(ida): canonicalize the headless workspace root before opening - #1481
Merged
Merged
Conversation
On macOS the default workspace root is os.tmpdir() under /var/folders, and /var is a symlink to /private/var. idalib-mcp reports the canonical input path from idb_open/idb_list, while REA compared it against the uncanonicalized private copy with normalize(), so every headless IDA analysis failed its identity check (surfacing as unreadable_output) and the spawned idalib worker was never released. Resolve the workspace root with realpath() when allocating the private workspace so the input path REA sends already matches what upstream reports. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
darsrc
pushed a commit
to darsrc/rea
that referenced
this pull request
Oct 10, 2026
…rluto#1481) On macOS the default workspace root is os.tmpdir() under /var/folders, and /var is a symlink to /private/var. idalib-mcp reports the canonical input path from idb_open/idb_list, while REA compared it against the uncanonicalized private copy with normalize(), so every headless IDA analysis failed its identity check (surfacing as unreadable_output) and the spawned idalib worker was never released. Resolve the workspace root with realpath() when allocating the private workspace so the input path REA sends already matches what upstream reports. Co-authored-by: Xingchuan Ma <[email protected]>
Owner
|
Thanks @AS9929 for fixing headless IDA workspace canonicalization! Squash merged. Welcome to REA, and thank you for your first PR to the repo. |
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Headless IDA analysis fails on every macOS run that uses the default workspace root.
IdaWorkspace.allocateplaces the private input copy underos.tmpdir()(/var/folders/...), but/varis a symlink to/private/varandidalib-mcpreports the canonical path fromidb_open/idb_list.sameIdaHostPathcompares withnormalize()only, so the identity check rejects the session REA itself just opened. No issue is linked; the reproduction is below.Problem and expected behavior
Smallest trigger (macOS, any binary, default config without
workspaceRoot):REA sends
input_path: /var/folders/.../rea-ida-XXXX/bin; upstream answers/private/var/folders/.../rea-ida-XXXX/bin. The CLI/MCP result is:{ "error": "Analysis failed", "code": "unreadable_output", "category": "execution_failure" }Each attempt also left an orphaned
ida_pro_mcp.idalib_serverworker (ppid 1) running, because the release path matches the session by the same path comparison.Expected: the private input path REA sends equals the path upstream reports, so the open/list identity checks pass and the worker is released with
save: false.Change and scope
IdaWorkspace.allocatenow resolves the workspace root withrealpath()before creating the private runtime root. The input path is therefore canonical from the start, and the existing strict identity comparison stays unchanged (no loosening ofsameIdaHostPath).Not included: canonicalizing paths reported by upstream, or changes to attached (GUI) mode, which binds by SHA-256 rather than path.
Contract and boundary impact
src/ida/IdaWorkspace.ts, workspace allocation beforeidb_open.workspaceRoot); no change on Linux/Windows when the root is already canonical.Evidence and regression coverage
src/ida/IdaWorkspaceOwnership.test.ts— opens through a symlinkedworkspaceRootand assertsidb_open.input_pathis under the canonical root.origin/main(1 failed | 2 passed) and passes with the fix. Existing tests did not catch this becausecreateTestTempDirectoryalready canonicalizestmpdir().unreadable_outputabove; after — normalprocedure_pseudo_codeevidence withprovider.id: "ida".Validation performed
npx vitest run src/ida— 7 files, 35 tests passednpx vitest run src/ida/IdaWorkspaceOwnership.test.tswith only the source fix reverted — new test failsnpm run check— typecheck, lint, format:check, knip, metadata:check and architecture guards passednpm run check:fast— passednpm run verify:test-discovery— all 712 test files discovered oncec133c38headless supervisor. Before:unreadable_outputplus a leaked worker per attempt. After (equivalentworkspaceRootpointing at a canonical directory, and with this patch):rea decompileand MCPopen_binary+list_proceduressucceed on a thin arm64 test binary and on universal/usr/bin/true; no workers remain and the private workspace is removed.Compatibility, safety, and release
workspaceRootthat does not exist now fails atrealpath()withENOENTinstead of insidePrivateRuntimeRoot.create.Review checklist
type(scope): outcome.🤖 Generated with Claude Code