Skip to content

feat(rizin)!: record which tool and version answered execute_rizin_command - #7487

Merged
morluto merged 109 commits into
morluto:mainfrom
Entrpi:feat-rizin-tool-identity
Nov 24, 2026
Merged

morluto merged 109 commits into
morluto:mainfrom
Entrpi:feat-rizin-tool-identity

Conversation

@Entrpi

@Entrpi Entrpi commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

No issue is linked: this was found while reviewing the Rizin route for embedded targets.

execute_rizin_command recorded version: null and labelled whatever REA_RIZIN_COMMAND selected as Rizin. radare2 accepts REA's argument list (-N -q -e scr.color=0 -c <cmd> <path>), so radare2 output could be recorded as Rizin Evidence without saying so. The docs allow any executable there, so refusing other tools would break a supported configuration.

Problem and expected behavior

Evidence should say which tool and version produced the output. A tool that is not Rizin should still run, with a limitation, and a tool that cannot be identified should leave the version unknown rather than fail.

Change and scope

  • Identification. Before each command, REA resolves the selected executable through PATH, hashes it and runs it with -v, within the call's command_timeout_ms and cancellation. The command then runs the same path. The first -v line identifies the tool in the form Rizin and radare2 print, for example rizin 0.9.1 @ darwin-arm-64, package: 0.9.1_2 (Homebrew) and radare2 6.1.8 +0 abi:110 @ darwin-arm_64; any other line identifies nothing. Evidence keeps provider id rizin, takes the name and version from the banner, and adds provider_executable_path, provider_executable_sha256, provider_version_banner, provider_version_banner_truncated and provider_identity. The banner is kept to 2,048 UTF-8 bytes, cut between code points, and a cut banner identifies nothing.
  • Other and unknown tools. radare2 runs with the limitation "REA_RIZIN_COMMAND selected radare2 6.1.8, not Rizin. …". A probe that fails, times out, or prints invalid UTF-8 or an unrecognized banner leaves the version unknown, and the command still runs. Evidence then keeps the name Rizin with provider_identity: "assumed", a limitation, and the probe's bounded exit status and output in provider_version_probe.
  • Per call. Each call probes in its own environment and budget, and nothing is reused: a version-manager shim keeps its path and SHA-256 while the tool it runs changes. Evidence that records the SHA-256 adds a limitation that the digest and banner were read before the command launched, so they do not prove what ran.
  • Lookup. The PATH lookup that process capture owned moves to src/process/ExecutableLookup.ts. REA reports a version only for a file it runs, so the lookup moves past only what every native search moves past: a missing file, a non-directory, a denied directory and a file without execute permission, and, on Linux and macOS, an entry of at least PATH_MAX bytes. At any other error, such as ELOOP, ESTALE or EIO, at least one native search stops (musl's stops at each), so the lookup stops too, and the command runs by name, unidentified, for the host to decide. A found file that does not start with ENOENT or EACCES, as when a script's interpreter is missing or not executable, is one a native search moves past, and at ESTALE or ENODEV glibc's search moves past it while musl's stops, so the command also runs as selected, unidentified, with a limitation naming that file. An explicitly selected path has no later candidate, so it runs as resolved and keeps its path and SHA-256. The working directory is read only when a relative command or entry needs it. Since main's refactor(process): give POSIX PATH search order one owner #10891, the candidates come from main's one PATH search owner, posixPathCandidates in src/process/executableSearch.ts. This PR extends it without changing what other callers get: each POSIX candidate records the PATH entry it came from, the working directory can be read only when a relative entry is reached, and an unreadableWorkingDirectory: "as-written" mode returns a relative entry unresolved, as execvp checks it. On Windows, the command port resolves a bare name through windowsPathCandidates (fix(reverse): refuse a Windows objdump or Rizin command that PATH does not find #10953), so the lookup only checks, hashes and probes the path it gets.
  • Stalls and failures. A lookup or hash that reaches the deadline, or is cancelled, ends the call without running the command, and its error keeps the path it was checking. A hash completes when its file closes, and ends at its deadline or on cancellation even while the open, a read or the close is pending. A stalled stat, access, open, read or close cannot be cancelled. The call stops waiting for it and gives back its place among the eight concurrent operations, and the step keeps running, untracked, until the mount answers, as main's pre-run stat already did. A later call on that path starts its own steps. close() does not wait for this work, and the process cannot exit until it returns: a CLI command prints its result and then stays alive. Who owns that work is left to #8860; the shared FileWork pool that this PR carried until f22a45b96 is kept on the fork branch rizin-filework-pool. A probe whose cleanup is incomplete is retained until retryCleanup stops its owner. Every error from the lookup through the launch keeps the selected provider_executable, the call's artifact_path and artifact_sha256, and what was observed of the executable. A lookup that the host refuses to inspect runs the resolved path and keeps it; an explicit selection that the lookup does not accept runs as the caller spelled it and keeps the resolved path.
  • Shared failure projection. A typed failure's captured_output gains stdout_invalid_utf8 and stderr_invalid_utf8, and reports a null exit_code when output was not fully collected, for every tool that uses execFileFailureCapturedOutput.
  • Process capture uses the shared lookup. Capture launches and verifies the path it resolves, so it cannot defer to the host's search: where the lookup stops, it rejects the scenario with the candidates it checked (see the breaking change below).
  • Tests and docs. The service takes one processes option, { lookup, runOwned }, so a fake runner goes through main's owned supervisor and its output capture and never resolves the provider through the host PATH. The tool description and docs/reverse-engineering-tools.md describe the probe, its diagnostics and its limits, and docs/process-capture.md states capture's rule. objdump is unchanged.

Contribution scope: one additional -v launch of the caller-selected executable per call; no new tools or inputs.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/rizin/RizinCommand.ts reads the banner; ReverseEngineeringService runs each call's probe; src/process/ExecutableLookup.ts owns PATH lookup and its interruption.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: provider.name and provider.version carry observed values; five parameters are added, and provider_version_probe when no usable banner was read. captured_output gains two optional markers, and its exit_code is null instead of the runner's number when output was not fully collected. Evidence and launch failures can also carry executable_lookup_candidate, executable_lookup_candidate_sha256, executable_lookup_code and executable_lookup_outcome. The tool description changes; no input changes. Process capture rejects some scenarios it accepted before.
  • Provider, bridge, target-format, or platform compatibility: any executable that accepted REA's arguments still runs.
  • Evidence, artifact, provenance, or reconstruction contract: Evidence records the identified tool, version, path, digest and banner, or the probe's bounded diagnostics, with the timing limitation.
  • Target selection, authority, upstream behavior, and cleanup details: one extra owned child process per call, under the call's supervision, deadline and cancellation, with the command's cleanup retention.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Public MCP (tests/boundary/mcp/reverseEngineeringProviderEnvironmentMcp.test.ts): a fake rizin on PATH answers -v; the test checks the provider name and version, the new parameters and the radare2 limitation. Launch failures after a real probe, a real E2BIG and an ENOENT, keep the provider, the selected executable, the target's path and digest, and the executable's observations.

  • The service with the real lookup and digest (tests/boundary/filesystem/reverseEngineeringToolIdentity.test.ts): banner forms (the real Rizin 0.9.1 and radare2 6.1.8 banners, cut, padded, unrecognized and invalid UTF-8); a probe per call, including a launcher whose tool changes; failed, timed-out, cancelled and cleanup-incomplete probes; the lookup's stop rule (symbolic link loop, I/O error, ESTALE, long entries and components); stalled lookups and hashes ended by the deadline and by cancellation, and a stalled check shared by later calls; a found file that does not start, with real scripts whose interpreter is missing (ENOENT) or not executable (EACCES), and with ESTALE and ENODEV; an explicit selection that does not start; a relative selection that the host refuses to inspect, that lacks execute permission, or whose absolute spelling is too long.

  • A removed working directory (tests/process-global/reverseEngineeringToolIdentityWorkingDirectory.test.ts, in isolated forks).

  • Composition: digestFile with a stream that never opens ends at its deadline and on cancellation; a hash ends at its deadline on a stalled open, read or close, and a later hash of the path starts its own read; a call gives back its place at its deadline while a stat it gave up on has not returned; real-process cancellation during the probe and during the command; invalid-UTF-8 markers on failed and cancelled commands; ExecFileOutput's null exit_code.

  • Each regression test failed on the code before its fix.

  • Applicable lifecycle regressions: cancellation in each stage (lookup, hash, probe, command), a stalled lookup and hash past the deadline, mixed outcomes (the probe fails, the command runs), and cleanup failure retained and retried.

  • Real CLI output at 3badf82 (Rizin 0.9.1 from Homebrew, macOS arm64, REA_RIZIN_COMMAND unset, rea execute-rizin-command <copy of /bin/ls> 'i~^arch' --json). The digest matches shasum -a 256 of the file that /opt/homebrew/bin/rizin links to, and no tool-identity limitation is added:

    "provider": { "id": "rizin", "name": "Rizin", "version": "0.9.1" },
    "provider_executable": "rizin",
    "provider_executable_path": "/opt/homebrew/bin/rizin",
    "provider_executable_sha256": "f1200b20c22be5e5b8d1f73ed0b7dd1507d50ba350f48a1c1e6b0cbb898c43ef",
    "provider_version_banner": "rizin 0.9.1 @ darwin-arm-64, package: 0.9.1_2 (Homebrew)",
    "provider_version_banner_truncated": false,
    "provider_identity": "banner",
    "raw_result": { "stdout": "arch     arm\n", "completion_status": "complete" }
  • Real CLI output at 3badf82 (radare2 6.1.8, macOS arm64, REA_RIZIN_COMMAND=r2):

    "provider": { "id": "rizin", "name": "radare2", "version": "6.1.8" },
    "provider_executable": "r2",
    "provider_executable_path": "/opt/homebrew/bin/r2",
    "provider_version_banner": "radare2 6.1.8 +0 abi:110 @ darwin-arm_64",
    "provider_identity": "banner",
    "limitations": [
      "The executable version comes from its -v banner; supported formats remain unknown.",
      "REA_RIZIN_COMMAND selected radare2 6.1.8, not Rizin. REA ran it with Rizin's arguments; the output follows radare2's command semantics, which REA has not verified.", "..."
    ]
  • Remaining proof gaps: real Rizin ran as Homebrew's 0.9.1 on macOS arm64 and, for the focused tests on 5e1c957fc, as the static 0.7.4 build on Linux x64; other versions and Windows were not run. A file replaced between REA's check and the launch is not detected; the docs state this, as they do for artifact digests. A stalled stat, access, open, read or close cannot be cancelled and holds a libuv worker until the mount answers. REA does not track or bound that work, so repeated calls on a stuck path can fill libuv's pool, which also serves REA's other file, DNS and compression calls; [Design] Who should own file-system work that a stuck mount holds? #8860 covers this. No stall test uses a real stuck thread or mount. A process with stuck work cannot exit, even through process.exit(), because Node joins its pool threads at exit; this was reproduced on Node 24.22.1 on macOS. An earlier commit claimed otherwise, and fafe14288 reverts it. A relative target path still needs the working directory, as before this PR.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

Run locally on macOS (Darwin 25.5.0, arm64) with Node 24.22.1.

  • On the head 8e6ce755e. c0cd6e653 merges main 39ccb1d3b (15 conflicts), and 8e6ce755e merges main dff9b479e cleanly. The merge moves this PR onto main's owners: fakes run only through the owned supervisor (runOwned), main's AnalysisCleanupRelease and launch-failure classifier replace the older code, cancellations use cancelledBy, timeout guidance comes from nativeDeadlineRecovery with this PR's executable-identification phase added, and utf8HeadExcerpt replaces the deleted boundedUtf8Text. A launch failure's diagnostics.command now names the absolute path REA started, as main's classifier records it; provider_executable still records the selection. Follow-ups: 2b407438c parses an ownership-preparation failure once before mapping it, as main's classifier lint requires; 412ceae05 updates the tests for PATH entries on candidates and the launched path; 5e1c957fc takes the host platform of a lookup from its caller, as main's ambient-platform guard requires; 87632b0bf registers the renamed Rizin cancellation test with main's lifecycle coverage registry (CI's one source-test failure on 5e1c957fc); e2fe42a2e checks the facts a post-run digest deadline names (command_timeout_ms, 1500, ETIMEDOUT) instead of its wording.
    • Linux x64 container (Node 24.22.1, run as root, Rizin 0.7.4 static build). On 5e1c957fc: npm run check:fast, build:cached and docs:check passed; npm run test:focused over 45 files passed 706 tests, 15 skipped, 1 failed: the real-Rizin axffj case of tests/acceptance/rizinCommandRejection.test.ts, which this PR does not change and which reports complete instead of rejected on Rizin 0.7.4. On e2fe42a2e: the same three checks passed, and the two changed test files passed (77 tests). On 8e6ce755e: the same checks and verify-advertised-schemas passed; npm run test:focused over 225 files passed 4,990 tests, 75 skipped, 5 failed, all Kuna cleanup-retry cases that fail only as root because root ignores the chmod they rely on.
    • The fork's integration branch at c11d6db57 contains e2fe42a2e; its full npm run check:pr passed as a non-root user on Linux x64, including all 55,198 tests, the Kuna cases among them.
    • CI on e2fe42a2e: 31 checks passed, including every test shard. Only "Reverse tools quality" failed, with the summary check that reports it: its Stryker TypeScript checker rejects src/server/EvidenceMcpServerCore.ts (TS7022 and TS7024 on adapter and catalog), which main's fd40fd9ab changed and this PR does not touch; main fixed it in 7a2e8da49. CI passed on 8e6ce755e: 33 checks passed, 21 skipped, none failed, including "Reverse tools quality".
  • On the head f22a45b96, which removes the shared FileWork pool at a maintainer's request: npm run check:fast, format:check, docs:check and npx knip passed, and the 12 test files this PR changes passed (277 tests). Two new tests replace the pool's: a call gives back its place at its deadline while a stat it gave up on has not returned, and a hash ends at its deadline on a stalled open, read or close while a later hash of the path starts its own read.
  • On 5231c117b, which merges main 55ee36809. feat(rizin): select the decoder and map address for one-shot commands #8991 landed first, so the merge keeps both PRs' changes to the RizinCommand.js import and the execute_rizin_command description, and the Rizin command port carries both limitations and versionProbe. npm run check:fast, format:check, docs:check and npx knip passed, and 16 test files, this PR's and feat(rizin): select the decoder and map address for one-shot commands #8991's, passed (310 tests). RizinDecoderInputs.test.ts ran against real Rizin 0.9.1. CI passed on this head.
  • On dac4d25a3, which merges main abdbaa544: fix(rizin): report the output cap instead of a provider signal #9033 added REVERSE_COMMAND_OUTPUT_LIMITATION to the imports of two test files that this PR also changed, and the merge keeps both sides. The same four checks and 14 test files passed (296 passed, 8 skipped).
  • On 630610d30, after 6a4b3a66c merged main 92f332652: npm run check:fast, format:check, docs:check and npx knip passed, and the 13 test files this PR changes passed (293 tests). A Darwin ownership inspection failure is now reported as a process failure that keeps captured output. The three new tests in reverseEngineeringToolIdentity.test.ts inject that failure and fail without the fix; no real macOS failure was observed. CI passed on this head.
  • On 34aacb819, which moved stalled file work to the FileWork pool that f22a45b96 removes: npm run check:fast and the three reverse-engineering composition test files passed (127 tests). On aa208d3a2, one test-only commit earlier, docs:check and the 21 test files that reach the service, the lookup, capture's executable resolution or FileWork passed (691 tests). Those composition and capture files also passed with UV_THREADPOOL_SIZE at 1, 2 and 8 on 43e5552e3. Removing the budget's reservation fails three tests. A script that interrupts 100,000 waiters on one stalled path retained 206.7 MiB of heap before the removable waiters and 2.5 MiB after.
  • On d68c106b9: df9b323de merges upstream main c3647ade1, whose one conflict was fix(objdump)!: preserve unknown executable identity #8824's new wording for an executable REA does not identify; this branch's per-call template now uses it, so objdump's text matches main. Nine later commits address review rounds, and each new test fails on its parent. npm run check:fast (with verify:module-boundaries), oxfmt --check on the touched files, docs:check and npx knip (no findings) passed. npm run test:focused over the 68 test files that reach the service, the lookup or process capture passed (1,155 passed, 1 skipped) except two tests this PR does not touch: processCaptureProgress.test.ts "reports startup cleanup coverage when temporary storage is unavailable", which fails the same way on main c3647ade1 on this Mac, and ghidraJavaDoctor.test.ts "doctor returns its own deadline result for a SIGTERM-resistant selected Java command", which timed out in the parallel run and passed alone. Real Rizin 0.9.1 through the built CLI: rea execute-rizin-command <copy of /bin/ls> 'i~^arch' --json identified it from its banner, with the path /opt/homebrew/bin/rizin and its SHA-256.
  • On b79558736, which changes only the cleanup of two stalled-open tests on 9fe7ec5ac: npm run check:fast and format:check passed, and tests/composition/reverseEngineering.test.ts passed (33 tests); a deliberately failed assertion in the open-gate test is reported as itself, without a hang.
  • On 9fe7ec5ac: npm run check:fast (with verify:module-boundaries), format:check, docs:check, verify:test-discovery (2,943 files) and lint:typed passed. npm run test:focused passed over 59 files: the 32 that reach the service, the lookup, the Rizin or objdump command or process capture, and 27 upstream tests that touch Rizin, objdump, provider identities, the capability catalog or import boundaries (1,373 passed; 82 skipped in tool-gated upstream tests, one file skipped whole). The 3 tests added in this round failed on 0194b09e8, as the 5 added in the round before failed on c4abdf2b2. npx knip reports only DarwinHelperCache, as on main. CI: run 41292282424.
  • CI passed on 0194b09e8 (run 41290606778).
  • On c4abdf2b2: the 14 test files of the shared projection's other callers passed (386 passed, 1 skipped); the projection has not changed since. Real Rizin 0.9.1 (Homebrew 0.9.1_2) through the built CLI: rea execute-rizin-command /bin/ls iI identified it from its banner, with its path, SHA-256 and the timing limitation.
  • Earlier heads: CI passed on 8cc09b63e and a6cb0974f (merges of upstream main 6e9ee97 and 317bf3f, and a fix on one). Through one MCP server at 8cc09b63e, real Rizin 0.9.1 ran i~^arch, and a 2 MiB command then failed to start with a real E2BIG; the error kept the provider, path, SHA-256 and banner.
  • Not run on this branch alone: npm run check:pr (it passed on the fork's integration branch, which contains e2fe42a2e); verify:test-temp-hygiene.

Compatibility, safety, and release

  • Breaking change. Process capture now resolves its executable with the shared lookup. A scenario whose PATH search meets, before the match, an error other than a missing file, a non-directory or a denied directory, such as ESTALE, ELOOP or EIO, is rejected with the candidates checked, because a native search can stop there; main's capture moved past every error. Migration: select the executable by path, or remove the failing entry from the scenario's PATH.
  • Real Hopper/Ghidra, browser, or OS coverage: real Rizin 0.9.1 and radare2 6.1.8 on macOS arm64; real Rizin 0.7.4 on Linux x64 for the focused tests.
  • Performance: each call launches the selected executable twice, the -v probe and then the command, because a launcher's digest cannot vouch for the tool it runs. On this Mac (Homebrew Rizin 0.9.1, medians of 10 warm runs) the probe costs about 180 ms through the owned-process runner (183.2 ms; the cheapest command, i~^arch, takes 170.9 ms), of which rizin -v itself takes about 15 ms. From the runner's code, not instrumented, the rest is process supervision: output-close polling and ownership-checked cleanup. Running the probe beside the command could hide most of it, but adds two-process lifecycle cases, so it is left for later.
  • Package or release metadata impact: release notes for the new Evidence fields and the capture change.
  • Security, privacy, process, or containment review: the probe runs the executable the caller already selected, with the same environment, owned supervision and cleanup as the command.

Squash commit message. GitHub's default squash body would join this branch's commit messages, which describe intermediate steps. Please squash with this message instead:

feat(rizin)!: record which tool and version answered execute_rizin_command

Before each command, REA resolves the selected executable, hashes it
and reads its -v banner. Evidence names the tool and version that
answered, with the executable's path, SHA-256 and banner, or keeps the
name Rizin as an assumed identity when no banner identifies the tool.
Another tool, such as radare2, still runs, with a limitation.

BREAKING CHANGE: process capture now resolves its executable with the
shared PATH lookup. A scenario whose search meets, before the match, an
error other than a missing file, a non-directory or a denied directory,
such as ESTALE, ELOOP or EIO, is rejected; select the executable by
path, or remove the failing entry from the scenario's PATH.

Author readiness

Human owner: @Entrpi

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

Process capture owned the only spawn-equivalent PATH lookup, wrapped in
scenario-specific errors. Move the lookup into src/process as a result
type, so a provider command can resolve an executable once, hash it and
then run that same file. Process capture maps the result to its existing
errors unchanged.
…mand

execute_rizin_command recorded version null and labelled any executable
selected by REA_RIZIN_COMMAND as Rizin, although radare2 also accepts
REA's argument list. Before the first command for each executable
digest, resolve the selected executable through PATH, hash it, run it
with -v and read its banner; the command then runs the same file. The
Evidence provider records the tool name and version, and the parameters
record the resolved executable path, its SHA-256 and the banner line.

A tool other than Rizin still runs, with a limitation; a failed, timed
out or unrecognized probe leaves the version unknown. Each digest's
reading, including a failure, is reused for the life of the process, and
concurrent first calls share one probe within the caller's
command_timeout_ms budget. A caller that stops waiting cancels the
probe only when no other caller needs it. A probe whose process cleanup
is incomplete stays retained for retry.
@greptile-apps

greptile-apps Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[High impact] No new blocking failure was established in the reviewed changes.

Summary

Adds per-call tool identification to execute_rizin_command, including the observed version, executable path, SHA-256 and bounded banner or probe diagnostics.

  • Each Rizin command records which tool and version answered.
  • Executable searches follow host rules, and process capture reports when it cannot resolve a path.
  • Typed command failures show when captured text is invalid or incomplete.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Caller selects executable] --> B[Resolve executable]
  B --> C{Usable path found?}
  C -->|Yes| D[Hash executable]
  D --> E[Run owned version probe]
  E --> F{Banner identifies tool?}
  F -->|Yes| G[Record observed name and version]
  F -->|No| H[Record assumed identity and diagnostics]
  C -->|No| H
  G --> I[Run requested command]
  H --> I
  I --> J[Return Evidence or retained failure facts]
  B -->|Cancelled or deadline| K[Return error without command]
  D -->|Cancelled or deadline| K
  E -->|Cancelled or cleanup incomplete| K
Loading

Reviews (65) · Last reviewed commit: "test(rizin): align tool identity asserti..." · Reviewed by Greptile

Sharing an in-flight version probe between callers let a joining call
outlive its own command_timeout_ms and inherit another caller's
cancellation, and the cache was keyed by digest alone, so byte-identical
launchers in different directories shared one reading. Remove the
sharing: each call runs its own probe under its own deadline and
cancellation. Reuse only completed probes (a banner, a non-zero exit or
a timeout), keyed by the resolved launch path and its SHA-256.

The executable lookup now honours the call's deadline and cancellation,
so a stalled PATH entry cannot hang a call or close(). A failed probe
records its exit status and bounded stdout and stderr in
provider_version_probe, and a cancelled probe keeps its captured output
on the error.
Concurrent first calls can each probe the same launch path and digest.
When one probe printed a banner and another later timed out or exited
non-zero, the failure overwrote the cached reading, so every later call
reported an unknown version for the life of the server. Route the cache
write through one rule: a failure never replaces a successful reading,
and a success replaces an earlier failure. Each call still reports its
own probe's outcome.
The guide said the command "runs the same file" as the version probe.
REA runs the same resolved path; the recorded SHA-256, tool and version
describe the file there when REA checked it. Say so, with the limit the
guide already states for artifact digests: they cannot prove the exact
bytes executed if the file changes before the launch.
Homebrew's Rizin 0.9.1 prints `rizin 0.9.1 @ darwin-arm-64, package:
0.9.1_2 (Homebrew)`, with a package suffix after the platform. The
identity test now uses that banner, so a parser that expects the line to
end at the platform fails; the other tests keep the plain form.

The test name and the probe comment now say REA runs the path it hashed
and reuses a completed probe per launch path and digest, as the guide
says since c73a0be.
Entrpi added a commit to Entrpi/rea that referenced this pull request Oct 28, 2026
Tests that injected a fake runner still resolved `rizin` through the host
PATH. With Rizin installed, the version probe took the fake runner's
first canned result, and three tests in reverseEngineering.test.ts
failed. CI has no Rizin, so they passed there.

The service now takes one `processes` option: the executable lookup with
either a runner or the owned-process primitive. It replaces `run` and
`runOwned`, so a fake runner cannot be paired with the host lookup.
Omitting it keeps the host lookup and owned execution. The lookup no
longer reads the service's `stat` seam.

The test service pairs a fake runner with a lookup that finds nothing
unless the test passes one; the identity tests pass the real lookup
explicitly. A new test puts an executable `rizin` first on PATH with a
fake runner and checks that each command gets its canned result, and
that the options type rejects a runner without its lookup.
Entrpi added a commit to Entrpi/rea that referenced this pull request Oct 28, 2026
@Entrpi
Entrpi marked this pull request as ready for review October 28, 2026 14:41
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-24T13:53:38.378042Z
We couldn’t complete this review. Comment @codex review to try again.
b4696e6 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 41d291bfc4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

…line

When hashing the resolved executable reached command_timeout_ms,
digestFile rejected with ETIMEDOUT and the service recorded an unknown
identity, then launched the caller's command with a fresh deadline. A
caller-selected, possibly side-effecting command ran after its
preflight deadline had passed.

The hash deadline now returns AnalysisTimeoutError with phase
executable_digest, as the lookup's deadline already did, and the timeout
guidance names executable identification among the phases. A test
stalls the executable's stat past a 50 ms deadline and checks that
nothing runs.
The probe cache kept one entry per launch path and digest and never
evicted one, and a kept banner could be as long as the 16 MiB capture.
It now keeps the latest completed probe per launch path with the digest
it read; a new digest replaces it, and a later failure still never
replaces a successful reading of the same digest. The service reads the
banner (the first stdout line, trimmed), keeps at most 2,048 characters
of it and records provider_version_banner_truncated; the provider's
parser now reads that bounded banner, so everything a probe keeps is
bounded.

A -v output that was not valid UTF-8 was parsed anyway, so replacement
characters could become provider.version. It now leaves the version
unknown, with a limitation saying the output is not valid UTF-8.

An owned probe whose output was not fully collected was labelled failed
when it carried a numeric exit status, and cached. A collection failure
is now checked first: the probe is unfinished, is not kept, and its
diagnostics report no exit status.

Tests cover a digest change replacing the kept probe, a capped banner,
undecodable output and a collection failure that is probed again.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dcb9d61611

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Entrpi added a commit to Entrpi/rea that referenced this pull request Oct 28, 2026
A timed-out version probe was kept for its launch path and digest, so a
later call with a longer command_timeout_ms reused it without probing:
its Evidence said the probe reached the command deadline, and the
version stayed unknown until the executable changed. A timeout is a fact
about one call's deadline, not about the file.

Each probe outcome now carries its scope in its type: a reading, a
failed exit and undecodable output describe the executable and are
kept; a timeout and unfinished output describe the call and are not.
The cache accepts only executable-scoped outcomes, so the call site no
longer filters. Both runners report a deadline as ETIMEDOUT, which the
probe checks before any signal, so a stopped probe is always timed-out.

A test times out a probe through the owned runner's deadline failure,
then checks that a call with a longer deadline probes again and reads
the version.
When -v exited nonzero or timed out with output that was not valid
UTF-8, provider_version_probe kept the decoded text, replacement
characters included, with no flag. Undecodable output's stderr had the
same gap.

The failure capture (execFileOutputFailure) now reads the runner's
stdoutInvalidUtf8 and stderrInvalidUtf8, as it already reads
collectionFailure. The probe diagnostics record them for every outcome
that keeps output, as stdout_invalid_utf8 and stderr_invalid_utf8,
following gdb Evidence's stderr_invalid_utf8. The command path takes its
flags from the same capture instead of reading the owned failure
directly. The guide names the two fields.

Tests cover failed and timed-out probes with invalid stdout or stderr,
undecodable output on both streams, and a failed command whose stdout
is not valid UTF-8, which pins the command path's flags to the capture.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c7053da1d9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/rizin/RizinCommand.ts Resolved
When the -v banner did not match, identifyRizinTool returned Rizin's
identity with no limitation, so Evidence named Rizin although nothing
identified the tool; the limitation qualified only the version and
formats. Failed, timed-out and undecodable probes, and an executable
that could not be located or read, named Rizin the same way.

The Evidence provider schema requires a name, so the tool cannot be
recorded as unknown. The parser now returns no identification for a
banner it does not recognise. Wherever no banner identified the tool,
the service keeps the configured identity, sets provider_identity to
"assumed" and adds the probe's assumed-identity limitation, which the
Rizin probe owns; an identified tool gets provider_identity "banner".
The guide and the tool description say so.

Tests cover an empty first line and a Usage: banner; two composition
tests now count the added limitation.
A cancelled or cleanup-incomplete version probe carried captured output
from execFileFailureCapturedOutput, which dropped the runner's
invalid-UTF-8 flags, so its replacement characters looked like provider
output. The command path's own captured output had the same gap when
cancellation ended a run or a failure was captured.

AnalysisCapturedOutput gains stdout_invalid_utf8 and
stderr_invalid_utf8, set to true only when the runner reported invalid
UTF-8, as command observations mark output_invalid_utf8. The shared
projection fills them through capturedInvalidUtf8, and the command
path's two captured outputs use the same helper, so every consumer of
a runner's failure report keeps them. The guide mentions the markers.

Tests cover a cancelled and a cleanup-incomplete probe, and a command
cancelled during and after its run, each with invalid UTF-8 output.
Entrpi added a commit to Entrpi/rea that referenced this pull request Oct 28, 2026
A launcher such as a version-manager shim keeps its path and SHA-256
while the tool it delegates to changes, so a reading kept for that path
and digest could name a tool the command no longer runs. A shim's
delegate cannot be observed, so no kept reading can be checked for
freshness.

Every call now probes in its own environment and under its own deadline
before the command, and nothing is reused. The cache, its keep and
replace rules and the outcome scopes that existed only for it are
removed; without a cache, an unfinished probe is reported as failed, and
its diagnostics still give no exit status when output was not fully
collected. The per-call digest stays in Evidence. The guide and the
tool description say each call probes.

On this Mac (Homebrew rizin 0.9.1) a probe costs about 180 ms through
REA's owned-process runner, of which rizin -v itself takes about 15 ms
warm: the price of identifying the answering tool on every call.

A test runs a launcher whose bytes stay the same while the tool it runs
changes, and checks that each call reports the tool that answered.
Tests that only covered the cache are removed; the rest now expect a
probe per call.
dd06ad2 removed the cache-only tests with a script that also removed
"runs each caller's probe under its own deadline and cancellation",
which covers per-call probing: two concurrent calls each probe under
their own deadline and signal, and cancelling one stops only its probe.
Restore it without the reuse check that only the cache needed.
Entrpi added a commit to Entrpi/rea that referenced this pull request Oct 28, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de4cb41c33

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Entrpi added a commit to Entrpi/rea that referenced this pull request Nov 14, 2026
Entrpi added a commit to Entrpi/rea that referenced this pull request Nov 14, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e1c957fc9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

…le coverage

The cancellation test now covers the command and the version probe as
"waits for a Rizin process cancelled during its %s to exit before
returning", so the lifecycle coverage registry names that title.
…ts wording

The limitation must name the setting that stopped the hash, its value and
the error code; the recovery sentence belongs to nativeDeadlineRecovery,
whose wording may change.
Entrpi added a commit to Entrpi/rea that referenced this pull request Nov 22, 2026
…able

When the ownership helper's compiler could not start for EAGAIN, EMFILE,
ENFILE or ENOMEM, the version probe mapped the failure to a non-retryable
ownership-preparation error with setup remediation, while the command
path classifies the same condition as a retryable resource constraint.
Run the shared preparationHostCapacityFailure owner first in the probe,
as the command does, and test each of the four codes.
…ectory

The fixture root came from mkdtemp before the try block, so a setup failure
skipped its removal. createTestTempDirectory registers the cleanup when it
creates the root.
Entrpi added a commit to Entrpi/rea that referenced this pull request Nov 22, 2026
Entrpi added a commit to Entrpi/rea that referenced this pull request Nov 22, 2026
Entrpi added a commit to Entrpi/rea that referenced this pull request Nov 22, 2026
@morluto morluto added enhancement New feature or request provider: rizin Analysis provider / engine: rizin labels Nov 23, 2026
Entrpi added a commit to Entrpi/rea that referenced this pull request Nov 23, 2026
# Conflicts:
#	tests/boundary/mcp/reverseEngineeringProviderEnvironmentMcp.test.ts
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto enabled auto-merge (squash) November 24, 2026 13:59
@morluto
morluto merged commit 721b25e into morluto:main Nov 24, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request provider: rizin Analysis provider / engine: rizin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants