Files
rea/docs/reverse-engineering-tools.md
T
Entrpiandmorluto 721b25e20d feat(rizin)!: record which tool and version answered execute_rizin_command (#7487)
* refactor(process): share executable lookup with provider commands

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.

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

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.

* fix(rizin): probe per call and reuse only completed probes

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.

* fix(rizin): never let a later probe failure replace a successful reading

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.

* docs(rizin): state what the executable digest and version observe

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.

* test(rizin): pin the banner a real Rizin 0.9.1 printed

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 c73a0be9c.

* fix(rizin): replace the service's lookup and execution together

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.

* fix(rizin): end the call when hashing the executable reaches the deadline

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.

* fix(rizin): bound kept version probes and keep only complete readings

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.

* fix(rizin): keep only probe outcomes that describe the executable

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.

* fix(rizin): flag invalid UTF-8 in version-probe diagnostics

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.

* fix(rizin): mark the provider as assumed when no banner identifies it

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.

* fix(rizin): keep invalid UTF-8 flags in typed errors' captured output

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.

* fix(rizin): probe the executable before every command

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.

* test(rizin): restore the per-caller probe deadline test

dd06ad27c 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.

* fix(rizin): read the working directory only when the lookup needs it

The service passed process.cwd() to the executable lookup on every call.
If the server's working directory had been removed, process.cwd() threw
ENOENT before the lookup looked at an absolute REA_RIZIN_COMMAND, and
executeRizinCommand rejected instead of returning its Result.

lookupExecutable now takes a function for the working directory and
reads it only for a relative command or PATH entry, or on Windows, where
an absolute path can still depend on the working directory's drive. A
failed read is a typed no-working-directory status, which the service
records as an executable it could not locate, so the call still
resolves to a Result. Process capture, whose working directory is
already resolved, maps it to its working-directory input error.

Tests make process.cwd() throw ENOENT: an absolute command and target
identify and run without reading it, and a relative command or PATH
entry gets a Result with an assumed identity.

* fix(rizin): cut probe banners and diagnostics between code points

The banner and a failed probe's two diagnostic streams were cut at
2,048 UTF-16 code units, so a cut could leave a lone surrogate. REA
already owns this cut: boundedUtf8Text keeps text within a UTF-8 byte
budget without splitting a code point, as other providers' probes use
it.

The banner and both streams now go through it with a 2,048-byte budget,
and provider_version_banner_truncated and output_truncated come from
its truncated flag. The guide states the limits in UTF-8 bytes.

Tests cut an astral banner and astral diagnostic streams at the
boundary; an ASCII banner keeps its 2,048 bytes.

* fix(rizin): keep diagnostics for a banner that identifies no tool

When -v exited 0 but its banner identified nothing, Evidence recorded
only provider_version_banner: the probe's exit status, stderr and later
stdout lines were dropped, although the guide promises
provider_version_probe for any probe without a usable banner, and that
is when the assumed identity needs explaining.

Such a probe is now its own unrecognized outcome. It keeps the banner
and versionProbeDiagnostics(0, output), like the other unusable
outcomes, and Evidence records both; a recognized banner remains read.

Tests cover an empty first line with an explanatory stderr and a
Usage: banner followed by more lines.

* fix(rizin): identify nothing from a banner cut at its byte limit

identify ran on the banner even when boundedUtf8Text had cut it, so a
version token running past the 2,048-byte cut was published as an exact
provider.version.

A real banner is about 40 characters, so one guard is enough: a cut
banner identifies nothing. It becomes the unrecognized outcome, with the
probe's diagnostics and the assumed identity; no separate token parser
is added. The guide says so.

A test cuts a first line inside its version token; the banner-cap test
now expects no version from a cut banner.

* fix(rizin): accept only the -v banner Rizin and radare2 print

The banner pattern ^(\S+) (\d\S*) read any first line with a digit token
as an identity, so `Warning: 123 …` became tool "Warning:", version 123.

identifyRizinTool now accepts only the first-line form Rizin and
radare2 print: a plain tool token, a version, any build tokens, then
`@ <os>-<arch>-<bits>` and an optional `, <package>` suffix. The real
banners on this Mac fix the form: Rizin 0.9.1 (Homebrew) prints
`rizin 0.9.1 @ darwin-arm-64, package: 0.9.1_2 (Homebrew)`, and radare2
6.1.8 prints `radare2 6.1.8 +0 abi:110 @ darwin-arm_64`. Anything else
is unrecognized, with the assumed identity and the probe's diagnostics;
a well-formed radare2 banner keeps its non-Rizin limitation. The guide
gives the form.

Tests cover `Warning: 123 …`, a status line before the banner, a banner
without the @ suffix, and the real Rizin and radare2 banners. Two
fixtures that printed `@ test` as the platform now print a real form.

* fix(rizin): keep the probe's identification when the command fails to start

After a successful -v probe, a command that failed to start, such as an
oversized command the host refused with E2BIG, returned its typed error
without the tool, version, path, SHA-256 or banner the probe had
observed: only Evidence carried the identification, and these failures
build none.

The identification now records whether a probe ran. When one did, the
launch failure keeps `provider` and the provider_* parameters in its
diagnostics; the Evidence limitations, which describe command output,
stay out. A probe that is cancelled or whose cleanup is incomplete
keeps the executable path and SHA-256 it ran from. An executable that
was not located or could not be read adds nothing, since nothing about
it was observed.

A real-process MCP test probes a fake rizin, then fails the launch with
a real E2BIG (a 2 MiB command) and with ENOENT (the probe removes the
executable after a banner that identifies no tool). The probe
cancellation test checks the path and SHA-256. The guide says where the
facts appear.

* test(rizin): move tool-identity cases to boundary and process-global projects

The tool-identity cases run the real executable lookup and file digest,
which crosses the production filesystem boundary, so they move from the
shared-worker composition project to tests/boundary/filesystem. The two
cases that replace process.cwd move to tests/process-global, whose
isolated forks keep that process-global state from leaking into other
files. The fixture, fake runner and probe count they share move to
tests/support/rizinToolIdentity.ts.

* fix(process): resolve each PATH entry only when the lookup reaches it

Candidate construction resolved every PATH entry up front, so a relative
entry after the match (PATH=/opt/rizin/bin:.) read the working directory
before the absolute entry was checked. With that directory removed, the
lookup reported no-working-directory and skipped hashing and probing,
while the bare command still ran from /opt/rizin/bin with an assumed
identity. Each entry now resolves when the search reaches it.

* fix(rizin): run the found executable when it cannot be read for hashing

When the lookup found an executable that the hash could not read, such
as a native binary with mode 0111, identification fell back to the bare
command name. The command then searched PATH again instead of running
the file the lookup selected, so another executable could answer, and
Evidence lost the path that was observed. The fallback now keeps the
found path for the launch and as provider_executable_path, without a
SHA-256 or probe. The flag that keeps these facts on a launch failure
is renamed from probed to observed, since it now also covers a lookup
whose hash failed.

* fix(rizin): leave the version unknown when probe stderr is not valid UTF-8

An exit-0 probe with a valid stdout banner and malformed stderr was
accepted as a banner, and the read outcome dropped the probe's
diagnostics, so Evidence published the version while losing stderr and
its stderr_invalid_utf8 marker. The documentation says output that is
not valid UTF-8 leaves the version unknown; the probe now checks both
streams before reading a banner.

* fix(process): report no exit status for output that was not fully collected

execFileFailureCapturedOutput published a failed run's numeric exit
code even when its output was not fully collected. The command path and
the version probe's diagnostics already report null for that status, so
a probe that lost output and whose cleanup also failed carried
conflicting completion facts: null in provider_version_probe, a number
in the error's captured_output. The shared projection now owns the
rule, which also applies it to the ADB, Ghidra launcher, Doctor, Apple
asset catalog and Darwin process-token failures that use it.

* fix(rizin): bound the version banner as printed before trimming it

The probe trimmed the first line before applying its 2,048-byte budget,
so a line with more than 2,048 bytes of leading whitespace before a
valid banner lost that prefix unrecorded and was identified, with
provider_version_banner_truncated false, although the documented budget
covers the banner line. The budget and the recorded banner now cover
the line as printed; only identification reads a trimmed copy.

* fix(process): continue the PATH search past an unreadable relative entry

With the working directory removed and PATH starting with "." or an
empty entry, the lookup stopped at that entry with no-working-directory.
A spawned search finds nothing under a removed directory and moves on,
so the command still ran a later match by its bare name, while Evidence
reported an assumed identity without path, digest or version. The
lookup now skips such an entry and reports the unread working directory
only when no later entry matches; an explicit relative command still
reports it at once.

* fix(rizin): keep the found executable path when hashing it ends the call

When the hash of a PATH-selected executable reached the deadline or was
cancelled, the typed error kept only its phase. The call returns no
Evidence then, so the caller lost the provider_executable_path the
lookup had observed and could not tell which PATH location stalled,
although a cancelled probe and a failed hash keep that path. Both
errors now carry it in details.diagnostics beside the phase.

* fix(rizin): keep the PATH candidate a stalled lookup was checking

When the stat or access of a PATH candidate reached command_timeout_ms
or was cancelled, the lookup reported only that it was interrupted, so
the typed error carried phase executable_lookup and nothing else. The
caller could not tell which PATH location stalled, as on a slow network
mount. The interrupted lookup now returns the candidate it was checking,
and both errors carry it as executable_lookup_candidate.

* fix(rizin): state that the executable digest precedes both launches

REA hashes the selected executable before the -v probe and the command
run, so a file replaced in between gives a SHA-256 of the old file
beside the identity and output of the new one. The documentation said
so, but inline Evidence did not. Evidence that records
provider_executable_sha256, identified or assumed, now carries a
limitation saying the digest was read before both launches and does
not prove the bytes that ran.

* fix(process): check an unreadable relative PATH entry as written

12244b7a3 skipped a relative PATH entry whose working directory could
not be read, assuming nothing under a removed directory is reachable.
The kernel still resolves `..` from a removed directory, so with
PATH=../bin:/usr/bin a spawned search runs ../bin/rizin while the
lookup selected /usr/bin/rizin, and the service probed and ran that
other tool. Such an entry is now checked as written, against the
process's working directory: an entry without the executable lets the
search continue, and a match there ends the lookup with
no-working-directory, so the launch by name follows PATH order.

* test(rizin): join the hash-interruption call before teardown

The hash-interruption test waited for its gate with a bounded wait and
only released the gate and aborted the caller in finally, so a failed
wait left the call running past teardown. It now waits through
awaitAcknowledgement, keeps the call in pending, and in finally
releases the gate, aborts, joins the call and closes the service, as
the stalled-lookup test does.

* fix(rizin): keep the selected executable when the command fails to start

When the command failed to start after identification, for example with
E2BIG, the error kept the provider, the resolved path, the digest and
the banner, but not the executable the caller selected. Evidence records
it as provider_executable, and only the ENOENT launch branch carried it
as command; an E2BIG resource constraint carries just argument_bytes, so
a bare alias or configured path was lost. The retained diagnostics now
include provider_executable beside the lookup, hash and probe facts.

* fix(rizin): keep the selected executable on every error before Evidence

7a003942a kept provider_executable only on a launch failure after
identification. The lookup's, the hash's and the probe's errors also
end the call before Evidence exists, as does a launch failure without
identification facts, and none of them kept the executable the caller
selected, so a bare alias or relative spelling was lost. The service
now adds provider_executable to an identification error where it
returns, and to every launch failure, with the observed facts only when
there are some. inspect_with_objdump's launch failures keep it too.

* fix(rizin): mark a version probe whose completion is unknown

When the owned runner reported a collection failure with completed
cleanup and the partial streams fit the 2,048-byte cut, the probe's
diagnostics showed output_truncated false and no completeness field;
only the nulled exit code hinted that bytes were missing. The probe's
diagnostics now carry completion_status with the command's own rule:
unknown when output was not fully collected or the probe was killed,
signalled or left no exit code, and complete otherwise.

* fix(process): end the PATH search at errors a spawned search stops at

The lookup moved past every PATH candidate whose stat failed. A spawned
search moves past only a missing file, a non-directory and a denied
directory; at any other error, such as a symlink loop (ELOOP), it stops
and the launch fails. With PATH=<loop>:/usr/bin, the lookup selected
/usr/bin/rizin and the service hashed, probed and ran it, although a
launch by name fails. The search now ends there, reporting the error in
checked, so the launch by name fails as a spawned search would. A
non-executable file earlier on PATH still lets the search continue.

* fix(process): end the PATH search at execute-check errors a spawn stops at

c1d66e52f classified only stat failures: the execute check still moved
past any error, so an EIO from a failing network-backed PATH entry let
the lookup select a later executable that a launch by name would not
reach. Both checks now use one rule, searchMovesPast: a spawned search
moves past ENOENT, ENOTDIR and EACCES and stops at any other error. The
execute check is injectable beside stat, so the EIO case is tested.

* fix(rizin): state that the version banner, too, precedes the command

a2fc5a11f qualified only the executable's SHA-256 as a pre-launch
observation. The -v banner, and so the recorded tool and version, is
also read before the command runs, so a package update in between
attributes the command's output to the old version. The limitation,
renamed EXECUTABLE_OBSERVATION_TIMING, now says the SHA-256 and any -v
banner were read before the command launched and do not prove the bytes
or the version that ran; the documentation says so too.

* fix(process): skip PATH entries a spawned search cannot hold

c1d66e52f ended the search at any error a spawned search does not move
past, including ENAMETOOLONG. But glibc's execvp on Linux and libuv's
own search on macOS skip a PATH entry of at least PATH_MAX bytes (4,096
and 1,024) before trying it, so with a 5,000-byte entry first, a launch
by name ran /usr/bin/true while the lookup reported it missing, and
capture_process_scenario rejected a command that worked. Such entries
are now skipped before they are checked; a shorter entry with an
over-long component still stops the search with ENAMETOOLONG, as a
launch by name does. On Linux the search also moves past ESTALE, ENODEV
and ETIMEDOUT, as glibc's execvp does.

* test(rizin): check the timing limitation through its constant only

The regex added in 85eb3b6c0 froze the limitation's wording, which
docs/testing.md rules out: guidance delivery is checked against the
owning constant, beside independent assertions for the facts. The test
keeps the EXECUTABLE_OBSERVATION_TIMING delivery check and its
provider, path, digest and banner assertions; a harmless rewording now
passes.

* fix(process): skip long PATH entries only where the host's limit is known

3e32a4422 used a 1,024-byte limit on every host other than Linux, so on
Android (Termux), where execvp has a 4,096-byte buffer, a valid
1,500-byte PATH entry was skipped and a later rizin ran. The length skip
now applies only on Linux (4,096 bytes, glibc and musl) and macOS (1,024
bytes, libuv); elsewhere an over-long entry stops the lookup, and the
launch by name lets the host's own search decide. By the same rule, the
lookup no longer moves past ESTALE, ENODEV and ETIMEDOUT on Linux: glibc
does but musl does not, so the lookup stops there too, leaving the tool
unidentified rather than possibly wrong.

* fix(rizin): keep a probe's timeout when its cleanup is also incomplete

When the -v probe reached command_timeout_ms and stopping it left
cleanup incomplete, the incomplete-cleanup branch ran first and returned
an AnalysisOutputError, so the error said only that cleanup remained and
lost the timeout and its remediation, even after a cleanup retry. The
command path keeps the AnalysisTimeoutError and attaches the cleanup;
the probe now does the same, so the timeout stays the failure, the call
still ends, and the owner is retained until it stops.

* fix(rizin): keep the target's path and digest on errors before Evidence

The lookup, hash and probe errors, and launch failures, end the call
before Evidence exists, after the target was already resolved and
hashed, but kept only the selected executable and provider facts. The
caller could not bind the failed attempt to the artifact it submitted.
Every such error now also keeps artifact_path and artifact_sha256 for a
call with a target, beside provider_executable.

* test(rizin): expect the long PATH entry skip only on Linux and macOS

The long-entry case required a skip on every POSIX host, but the length
skip applies only on Linux and macOS; on Android and other hosts the
lookup stops with ENAMETOOLONG instead, so the test failed there although
the lookup behaved as intended. It now expects the skip on Linux and
macOS and the stop elsewhere.

* fix(rizin): defer an unstartable file to the host and bound stalled I/O

The lookup took an executable regular file as the match, but a spawned
PATH search also moves past a file that fails to start with ENOENT,
such as a script whose interpreter is missing. Pinning the probe and
the command to that file failed calls that the host would run. When
the version probe does not start, the command now runs as selected,
with the version unknown, and a limitation names the file.

A lookup that stops waiting for a stalled stat or access leaves the
call running, and later lookups of the same path now share it instead
of starting another, so retries no longer add calls on an unresponsive
mount. digestFile ends at its deadline or on cancellation even while
the file's open is pending; a destroyed stream reports its error only
after that open returns. A lookup the host refuses to inspect runs the
resolved path and keeps it as provider_executable_path, also when the
launch fails.

Process capture verifies the file it launches, so it still rejects a
scenario where native searches disagree; its docs now say so.

* docs(rizin): say the lookup stops where any native search stops

The lookup stops at every error other than a missing file, a
non-directory or a denied directory, because at least one native
search stops there; musl's stops at each of them. At a symbolic link
loop or an I/O error the searches agree, so "do not agree" was wrong
there. The process-capture docs and resolveExecutable's comment now
state the same rule.

* fix(rizin): bound stalled hash opens and defer EACCES launches

The interruptible hash let each timed-out retry start another open on a
stalled mount, outside the eight-operation cap. A later hash of the same
path now waits, within its own deadline and cancellation, for an earlier
open that has not returned, and hashes share a stalled stat through the
helper lookups use, now src/process/SharedFileCall.ts.

A probe launch that fails with EACCES, as for a script whose interpreter
is not executable, is one a native PATH search moves past, like ENOENT,
so the command now runs as selected. The shared-check test bounds its
gate wait and joins its started checks in teardown.

* test(rizin): return stalled opens and join their streams in finally

The open-gate test returned its stalled open only after its assertions
passed, and the deadline and cancellation test never returned its open,
so a failed assertion, or every run, left a stream waiting on a pending
open. docs/testing.md asks for held work to be released and joined in
finally. A shared helper now holds each stalled open; both tests return
it, destroy the stream and wait a bounded time for its close in finally,
so a failed assertion is still reported as itself.

* refactor(rizin): own the version-probe types in the domain layer

RizinCommand.ts imported ProviderToolIdentification and
ProviderVersionProbe from the application port, so the Rizin provider
depended on the application layer; the architecture has Rizin depend on
the domain only. Move both neutral types into
src/domain/reverseEngineering.ts beside the command inputs. The port,
the service and the Rizin adapter import them from there.

* fix(rizin): hold a hashed path until its stream closes

A hash released its path when the file's open returned. A read that a
stalled mount then held kept its libuv worker after the digest timed
out, while the next hash of the same path opened the file again, so
repeated hashes could start stalled reads without bound. Keep each
stream registered until it closes: a file stream closes only after its
pending open or read returns, so a later hash of the path waits for it,
and stalled opens and reads stay bounded by the paths.

* fix(rizin): make hashes wait only for streams an earlier hash gave up

13515107a kept every hash's stream registered until it closed, so a
hash waited for every earlier hash of the same path, healthy ones
included, and concurrent calls on one target could spend their deadline
waiting and time out before they launched. Register a stream only when
its hash gives up while its open or a read is pending, and keep it until
it closes. Later hashes of that path wait for those streams, so abandoned
I/O stays bounded by the paths, while hashes that have not given up no
longer wait for each other.

* fix(rizin): keep an explicitly selected path the lookup does not accept

An explicitly selected command that resolved to a file without execute
permission ended the lookup as missing, with its absolute path only in
the checked strings. The command then ran by its relative name, and the
launch failure lost provider_executable_path. A missing lookup now
reports the path an explicit selection names, and the service runs that
path and keeps it, as it does for a path the host refuses to inspect.
Process capture ignores the field and still rejects such a file as an
invalid selection.

* fix(rizin): keep an explicit path's facts when its probe does not start

When the version probe of an explicitly selected path failed to start,
as a script with a missing interpreter does, the command ran the
selection as written and kept nothing the lookup and hash observed, so
its launch failure lost the resolved path and SHA-256. An explicit
selection has no later PATH candidate for the host to try. The lookup
now marks a found explicit path with selectedPath, and the service runs
that path and keeps its observations, while a PATH match still runs by
name for the host's search to decide.

* fix(rizin): launch a selection the lookup did not accept as spelled

73554211b launched the absolute path an explicit selection names
whenever the lookup did not accept it. A relative selection that fits
the host's path limit can have an absolute spelling that does not, so a
command that launched before failed with ENAMETOOLONG. Launch the
selection as the caller spelled it again, and keep the resolved path in
Evidence and launch failures as provider_executable_path. A path the
host refused to inspect still launches as resolved.

* test(rizin): release and join the concurrent hashes in their test

The concurrent-hash test left both hashes running when its wait for the
second open failed, so their later rejections could hide that failure.
Wait with awaitAcknowledgement, settle both hashes together, and destroy
the streams and join the hashes in finally.

* fix(rizin): let the host's search decide after ESTALE or ENODEV probes

When the version probe of the file the lookup found failed to start
with ESTALE or ENODEV, the service recorded a failed probe and ran that
file again, although glibc's PATH search moves past such a file and
musl's stops there. Treat both like the errors every search moves past:
the command runs by name and the host's search decides, as the lookup
does where native searches differ. ETIMEDOUT stays the probe's deadline,
which both runners report with that code.

* fix(rizin): keep a call's place until its abandoned file streams close

A call that ended at its deadline while a hash's stream was stalled on
an unresponsive mount freed its place among the eight concurrent
operations, though the stream's read or close still held a libuv worker,
so calls on different files could pile up stalled file work without
bound. A successful hash also completed at its stream's end, before a
close that could stall. A hash now completes when its stream closes, so
a stalled close reaches the deadline as a stalled read does, and each
stream a hash gives up on is reported to the service, which keeps the
call's place until those streams close. The capacity error counts such
calls as operations_awaiting_file_close.

* test(rizin): keep disk reads and prose out of two tests

The admission test for abandoned file streams called the real
digestFile once its files closed, reading the disk in a composition
test; its fake now returns a fixed digest. Two assertions matched the
not-started limitation's whole phrase; they now check that a
limitation names the skipped file and its launch error, so rewording
the limitation does not fail them.

* fix(rizin): give file work that a call gives up on one owner

A lookup or hash that reached its deadline while a stalled mount held a
stat or access check gave the call's place among the eight concurrent
operations back, although that check still held a libuv worker. Streams
were already held, through a separate map, a callback threaded through
three layers and a second set in the service, while stat and access
checks were shared through a third, module-level map.

FileWork now owns all of it. Each call runs its stat, access and stream
steps through a scope of the service's FileWork under one deadline. A
step the deadline or cancellation interrupts is left with the scope that
started it, later work on that path waits for it instead of starting
more, and the service keeps the call's place until what it left has
returned. A call that only waited for another call's work leaves nothing
and keeps no place. The capacity error counts held calls as
operations_awaiting_file_work.

digestFile takes its bounds as one object, like lookupExecutable.
SharedFileCall, the stream map, the onAbandoned callback and the
per-step deadline helpers are removed, and the two edge-case tests that
probed the gap between the old stat and stream listeners now check the
single deadline instead.

* fix(rizin): let a call that stops waiting for left file work detach

A call waiting for file work left behind on its path raced a
Promise.all over that work against its deadline. When the deadline won,
the reactions stayed attached to the stalled work's promises, so retries
on a stalled path kept about 2 KiB each until the mount answered: 207 MiB
over 100,000 interrupted waits. Each waiting call now adds a wake
function to the path's left work and removes it when it stops waiting,
and the last left step on the path wakes the waiters that remain. The
same measurement retains 2.5 MiB, and 4.5 MiB over 400,000 waits.

* fix(rizin): keep where a stopped PATH lookup stopped

When the lookup of a bare command stopped at a candidate whose error at
least one native search stops at, such as ELOOP, EIO or ESTALE, the
command ran by name, but Evidence and launch failures said only that
the executable could not be located. The candidate and its code existed
only as display text in the lookup's checked list. The lookup now
returns them as stoppedAt, and the service names them in the limitation
and keeps them as executable_lookup_candidate and executable_lookup_code.

* fix(rizin): report held file work when the service closes

close() aborted active calls, awaited their results and retried process
cleanup, then resolved, although a call that had returned could still
hold a stat, access or stream step that an unresponsive mount had not
answered. Waiting for that work could hang shutdown on a mount that
never answers, so close now fails instead with a cleanup error that
names file_system_work and counts the calls holding it
(operations_awaiting_file_work), and a later close checks again, as it
does for retained provider processes.

* fix(rizin): keep stalled file work out of close

ad4a22b32 made close() fail while a call still held file work that a
stuck mount had not returned. That error could not clear once the work
returned, it hid behind a process-cleanup failure, and the CLI replaced
the command's own error and Evidence with it. Close cannot release that
work anyway: it cannot be cancelled, joining it would hang shutdown on a
mount that never answers, and the runtime keeps the process alive until
it returns. close() again aborts active calls, awaits them and retries
process cleanup; the call keeps its slot until its file work returns.

* fix(rizin): bound stalled file work by the thread pool

Each stalled stat, access or stream step holds a thread of libuv's pool,
which Node sizes at 4, while the eight-call cap allowed eight on distinct
paths. Four would stall every other file, DNS and compression call in the
process. The pool belongs to the process, so FileWork now has one
process-wide owner, HOST_FILE_WORK, with a budget of 2 held steps. Past
it a new step starts nothing: the service reports a retryable capacity
error with file_steps_held and max_held_file_steps, and the lookup returns
saturated, which capture reports too. A step on a path that already has
stalled work waits and takes no thread. The service takes its owner as an
option, and test services get their own.

* fix(cli): exit after a command while a stalled file step is held

A pending system call keeps Node's event loop alive, so a CLI command
that timed out on a stalled mount wrote its result and then stayed
running until the mount answered, which may be never. The launcher now
asks the CLI runtime whether the process holds stalled file work and, once
the result is delivered and stdout has drained, exits explicitly. Runs
that hold no stalled work end as before.

* fix(rizin): reserve the file-step budget before a step starts

The budget counted only steps already left behind, so calls that stalled
together all started while it read zero, and eight concurrent stats could
exhaust the pool. A step now reserves the budget before it starts and
releases it when the underlying work settles. A step waits within its
deadline while running steps fill the budget, and is refused once
left-behind steps fill it. The budget is half of libuv's pool as
UV_THREADPOOL_SIZE sizes it, with at least one step, instead of a fixed 2.
A refused target preflight also keeps its path as artifact_path.

* fix(rizin): keep unbounded file work out of the shared budget

Process capture's executable lookup has no deadline, so a stalled check
would stay running forever, fill the shared budget and make healthy
captures wait without end. A lookup or hash that is given no owner now
joins no budget, so capture behaves as it does on main, and only the
service, whose calls have deadlines, shares the process-wide owner.
Tests that count steps fix their budget instead of inheriting the host's
UV_THREADPOOL_SIZE, and the concurrent-step tests use bounded waits and
release their work in finally.

* Revert "fix(cli): exit after a command while a stalled file step is held"

This reverts commit 4a4bb74bc. It did not work: process.exit() also
hangs while a pool thread is stuck in a system call, because Node joins
the pool at exit. Its test passed only because the simulated stall held
no thread. The docs now state the limit: a CLI command prints its result
and then stays alive until the mount answers. A real exit path needs a
process-wide design and goes to the maintainer proposal.

* fix(rizin): keep a found file that did not start as a candidate

When the file a bare command's lookup found did not start, the command
ran by name, and a failed launch then lost that file's path, digest and
launch error. Evidence and launch failures now keep them as
executable_lookup_candidate, executable_lookup_candidate_sha256 and
executable_lookup_code, without claiming that the candidate ran.

* fix(rizin): keep why a post-run digest or lookup gave no answer

A post-run hash that the file-step budget refused was reported as an
artifact that could not be read. Evidence now keeps the command output
with artifact_digest_after_refused and a limitation saying the artifact
was not read. A lookup that needed an unreadable working directory also
lost that outcome when the launch by name failed; it now keeps it as
executable_lookup_outcome and executable_lookup_code.

* test(rizin): compare the post-run limitation through its owner

The refused post-run digest test froze one explanatory phrase and banned
another. It now keeps the structured refusal facts and checks that the
unreadable-artifact limitation, an exported constant, is absent.

* fix(rizin): keep preparation failures' output and cleanup

Ownership preparation throws its own failure, or an interruption wraps
it, and runOwnedCommandOutput recognized neither. The compiler output
was lost and a retained helper could not be retried, for the version
probe and for the command. Normalize both shapes at that boundary, so
preparation is a launch failure that carries its output, and its
cleanup reaches retryCleanup through the same stop contract.

* refactor(rizin): drop the shared file-work pool from tool identity

A maintainer asked to separate the shared FileWork pool from this PR
until the lifetime design in #8860 settles. The pool kept a call's place
while file work it gave up on was running, made later work on that path
wait for it, reserved half of libuv's pool as a budget of stalled steps,
and refused new steps with a capacity error once that budget was held.

The lookup and hash now run each stat, access and stream step under one
deadline and cancellation listener (FileDeadline). A step the call stops
waiting for keeps running until its mount answers, untracked, as main's
stat already did. The call returns and gives back its place. The
saturated lookup outcome, FileWorkSaturatedError, the
operations_awaiting_file_work count and artifact_digest_after_refused
are removed, with the tests that covered them. New tests check that a
call gives back its place at its deadline, and that a hash ends at its
deadline on a stalled open, read or close while a later hash of the
path starts its own read.

The pool is kept on the fork branch rizin-filework-pool.

* fix(rizin): keep the PATH candidate a launch by name is denied

When a bare REA_RIZIN_COMMAND finds only a file without execute
permission or a candidate under an unsearchable directory, the lookup
records it only as display text, and the by-name launch then fails with
EACCES. The capability error kept neither selectedPath nor stoppedAt, so
it lost the file whose permissions need repair. The lookup now reports
the first PATH candidate it moved past with EACCES as deniedAt, and the
service keeps it as executable_lookup_denied_candidate in Evidence and
launch failures, with a limitation naming it.

* fix(rizin): keep a non-regular PATH candidate a launch by name is denied

A launch by name also fails with EACCES when the only PATH match is a
directory or another non-regular file, which execve refuses; the lookup
kept that candidate only as checked display text. deniedAt now covers it
and carries its reason, permission or not-regular-file, which the service
keeps as executable_lookup_denied_reason beside the candidate and names
in its limitation.

* fix(process): mark invalid UTF-8 where execFileBytes decodes a failure

execFileOutputFailure projects stdoutInvalidUtf8 and stderrInvalidUtf8,
but execFileBytes decoded a failed command's buffers without setting
them, so direct runner callers such as adb reported replacement
characters without the stdout_invalid_utf8 and stderr_invalid_utf8
markers. The failure now validates each buffer when it decodes it, on
both the execFile and owned-spawn routes, and execFileOutput's result
marks invalid streams the same way, as the owned process runner does.

* test(process): expect the invalid UTF-8 marker on compiler failures

The Darwin token reader's compiler capture now reports stderr_invalid_utf8
for a replaced byte, and the decoding tests get their own block under the
150-line function limit.

* fix(reverse): report a post-run digest deadline with its recovery

A post-run hash that reached command_timeout_ms, for example at a close a
stalled mount holds, fell into the empty catch and was reported as an
unreadable artifact. It now adds a limitation naming the deadline
(ETIMEDOUT) and how to raise command_timeout_ms, and the command's Evidence
is kept. The deadline-raising sentence is shared with the timeout error.

* refactor(rizin): retain version-probe preparation through main's inspection owner

main's #10113 owns ownership-preparation failures for the command: it
maps them to analysis errors and retains their cleanup in the service's
inspection scope. This branch had its own copy in runOwnedCommandOutput
(630610d30), so a retained helper now had two owners, and the copy no
longer typechecked against the inspection-failure union.

The runner returns to main's version. Main's two inline mappings become
one ownershipPreparationError, which the command and the version probe
share: a preparation that fails or stops during the probe ends the call
as it would for the command, and its cleanup joins the same scope, so
retryCleanup closes the helper once. A deadline that interrupts Darwin
preparation keeps the compiler output, as a failed preparation does.

The preparation tests read the primary error under the cleanup wrapper;
main's two new collection-failure tests use this branch's processes
option.
reverseProviderLaunchErrors.test.ts returns to main's version: the
retry assertions this branch added there expected a cleanup failure with
no owner to be retried by polling its state, which main's owner does not
retain; the error still reports the cleanup as incomplete.

* refactor(rizin): parse an ownership preparation failure once before mapping it to an error

* test(rizin): expect PATH entries on search candidates and the launched path in launch failures

* refactor(process): take the host platform of an executable lookup from its caller

* test(rizin): register the renamed Rizin cancellation test for lifecycle 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.

* test(rizin): assert the facts a post-run digest deadline names, not its 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.

* fix(rizin): keep host capacity during version-probe preparation retryable

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.

* test(rizin): create the abandoned-stat fixture with createTestTempDirectory

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.

* test(rizin): align tool identity assertions with normalized_result and clean up lookup

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-11-24 14:22:27 +00:00

47 KiB
Raw Blame History

Reverse-engineering tool integrations

REA can call caller-supplied GNU objdump, GDB, and Rizin installations. REA does not install or update these tools. Static objdump/Rizin workflows use the same services from CLI and MCP. GDB's persistent MCP sessions and ephemeral CLI command are available only on Linux. Persistent debugger sessions exist only for the lifetime of the REA MCP server process.

In a shared MCP server, unrestricted Rizin and Cutter commands, GDB console commands, Rizin debugger start/close, and GDB debugger close retire any active binary analysis session after the operation. This prevents a fresh analysis provider from being rebound automatically while command effects may still be writing. After the command and any background writers have stopped, call open_binary explicitly before continuing analysis. A successful command response alone does not prove that background writers have stopped. An active Ghidra analysis session must be closed explicitly before an external mutation can run.

GNU objdump

REA sends GNU-style arguments to the selected command but does not verify its implementation or version. Evidence identifies the command profile as objdump.command and retains the selected executable; it does not claim that the executable is GNU objdump. Other implementations may accept some commands while differing in supported options and output.

inspect_with_objdump and rea inspect-with-objdump capture stdout and stderr as inline Evidence. Artifact inspection Evidence records SHA-256 digests before and after the provider call and whether those observed digests differ; this cannot prove the exact bytes consumed if the artifact changes during execution. Choose one artifact operation: file_headers, section_headers, symbols, relocations, dwarf, disassemble, or disassemble_all. disassemble maps to -d; disassemble_all maps to -D and has different symbol-boundary semantics. The pathless inspect_with_objdump {"operation":"architectures"} MCP call or rea list-objdump-architectures CLI command maps to -i and produces subjectless Evidence containing the selected command’s output, not a guarantee that any target is supported. GNU objdump uses this option to list its compiled-in BFD targets.

Failure to launch the selected executable reports provider unavailability, the configured command and the host error under boundary: "provider-launch". Recovery concerns REA_OBJDUMP_COMMAND, PATH and execution permission, including for target-free architecture listing. In MCP discovery (binary_session), an unprobed executable is reported available; observing a launch failure marks the operation unavailable with its remediation until a later dispatched request succeeds. Artifact admission keeps separate input and filesystem-read diagnostics. Invalid operation/selector combinations retain their rejected fields in input issues before artifact reads or provider launch.

For DWARF, REA does not follow local debug links by default. Set follow_debug_links to true to pass -WK; external debug-file identities are not bound to Evidence when following links is enabled. The CLI flag is --follow-debug-links; --no-follow-debug-links or --follow-debug-links=false keeps the default. A separate true or false word after the flag is not its value. REA clears DEBUGINFOD_URLS in the objdump child environment to disable debuginfod network access on GNU binutils versions that do not support -WE. The complete raw output is authoritative; REA does not normalize it into a version-independent disassembly schema.

For a known native symbol, use operation: "disassemble", symbol: "my_function" in MCP or --symbol my_function in CLI. REA passes --disassemble=my_function to objdump before collecting output, rather than producing the whole disassembly and filtering it afterward. Omit symbol to keep full code-section disassembly. Other operations reject this selector. Use a nonempty, NUL-free name with well-formed Unicode; unsupported values are rejected before reading the artifact or starting objdump. Symbol names are passed unchanged; matching, versioned symbols, aliases and the end of the disassembly follow the selected executable's semantics. Evidence records the selector and actual arguments. An empty match does not establish artifact-wide absence, and the selected observation does not contain the omitted disassembly; request the complete operation when needed.

rea inspect-with-objdump ./program disassemble
rea inspect-with-objdump ./program disassemble --symbol my_function
rea inspect-with-objdump ./program dwarf
rea inspect-with-objdump ./program dwarf --follow-debug-links

Captured stdout and stderr share max_output_bytes (CLI: --max-output-bytes), default 16777216 bytes (16 MiB). Select an integer from 1 to 44651859 bytes. The maximum leaves room for worst-case JSON escaping of both Evidence output mirrors under Node's single-string ceiling. The selected budget applies on the next call without a restart; output_budget_bytes reports it and output_budget_source distinguishes a default from an explicit request. On exhaustion REA retains a prefix, requests provider termination, marks output_truncated with unknown completion, and records the budget as output_limit, a max_output_bytes parameter control (the CLI --full-output envelope names its option in meta.cli_controls). Narrow or page the native command, or raise the selected budget. Verify command effects and outstanding cleanup before deciding whether repeating it is safe. Client deadlines and receive buffers remain separate. Concurrent one-shot captures reserve their selected budgets within a 128 MiB aggregate admission and eight-operation capacity; wait for active work or select a smaller output budget when that capacity is occupied.

inspect_with_objdump, rea list-objdump-architectures, and one-shot execute_rizin_command accept command_timeout_ms (CLI: --command-timeout-ms). Omitted means 120000. The integer range is 1 to 2147483647. Target preflight shares one budget across stat and digest. The one-shot command receives that budget again. It applies on the next call; no restart is required. It does not raise the separately selected max_output_bytes, a Ghidra or Hopper startup deadline, or a debugger session deadline.

GDB

Persistent GDB sessions, including the MCP workflow and one-shot rea debug-with-gdb CLI, are available only on Linux. REA verifies a live inferior's output descriptors through /proc before detaching it; it does not claim equivalent descriptor verification on macOS. Windows is also unsupported because owned Job Object cleanup can terminate debugger inferiors. On supported Linux hosts, start_gdb_session, gdb_console, gdb_session_status, and close_gdb_session manage a persistent GDB/MI session in MCP. The one-shot CLI requires a caller-selected durable TTY: rea debug-with-gdb --inferior-tty /dev/pts/7 --executable ./program 'info files'. The TTY must remain available after GDB exits so a detached inferior can continue writing. MCP starts GDB with --nx --quiet --interpreter=mi3, retries protocol initialization with MI2 when applicable and cleanup succeeds, waits for its prompt, and disables auto-loading. Optional executable hashes and loads an initial local file without running it; readiness requires a confirmed load. A refused load is not repeated with MI2. Pass optional inferior_tty to select the terminal that future inferior runs use; REA configures it before the session becomes ready and checks the exact value with GDB/MI. gdb_session_status reports the selected path, whether REA still considers the configuration verified, and whether invalid UTF-8 has been observed in MI bytes (mi_invalid_utf8) or stderr (stderr_invalid_utf8). Commands that can change the inferior TTY or redirect a run revoke that verification permanently for the session, so close retains GDB ownership if a live inferior remains. The complete built-in inspections show inferior-tty and help inferior-tty preserve verification; compound commands still use the conservative mutation checks. Closing a session with one live inferior and a verified TTY automatically detaches the target, which can resume execution; MCP clients receive destructive-operation annotations for this behavior. The console remains unrestricted and can run shell commands, change target state, access files, and use network in the REA process user's security context. Raw MI records and console/target/log streams are returned with Evidence. Its subject names the session and its initial file selection: { "kind": "session", "session_kind": "gdb", "id": <session_id>, "target": <file identity or unknown> }. Selecting executable binds the initial stable file hash; omission or a physical hash failure leaves the target unknown, with the failure reason retained. parameters.launch_provenance preserves the original and absolute startup paths. Later console loads or attaches do not rebind this initial selection or establish the current inferior's identity; command output is retained up to the configured budget (16 MiB by default) and explicitly marked when truncated. A single console, target or log record over the 16 MiB MI line limit is dropped and the command is marked truncated, while an oversized result or async record still stops the session. GDB startup waits 10000 ms with no runtime override. Each MI command defaults to 120000 ms; its deadline, command-output budget, session capacity and pending-command queue use the shared debugger launch settings. command_timeout_ms does not change a persistent debugger session.

A truncated GDB command capture includes output_limits with the exact causes and effective maxima: command_bytes, command_records, or mi_line_bytes. Only byte-budget exhaustion recommends raising REA_DEBUGGER_MAX_COMMAND_OUTPUT_BYTES. The 16384-record retention ceiling and 16 MiB single-line protocol ceiling stay fixed; select a command with fewer or smaller records when either is reached. These cause facts survive timeout, cancellation and process-exit captures as well as successful commands.

With multiple live inferiors, or a live inferior without a verified TTY, manual close requests an explicit disposition and keeps the session ready. Use gdb_console to select and explicitly detach or terminate each remaining inferior, then retry close_gdb_session. After owned cleanup has started, console commands remain unavailable while that cleanup can be retried.

completion_status describes completion of the selected console command, not termination of its inferior. After a ^running result, REA queues a read-only -gdb-show mi-async query and waits for its tokenized reply before releasing the command's output collector. The ordered records include that query reply; mi retains the console command's result. If raw shell stdout joins that result without a newline, REA preserves the combined bytes as one raw record and uses a fresh read-only query after GDB's prompt to establish completion. It does not guess a result token inside caller output: mi is empty and the original result class remains unknown. An inferior *stopped event or an early compatibility prompt does not establish that an outer command file has finished. See GDB's MI output syntax and command-file semantics.

Before a normal close, REA checks for live GDB thread groups. If one remains and a durable inferior_tty is verified, REA asks GDB to detach it and confirms the detach before stopping the debugger. Without that sink, select and apply a disposition to each inferior through gdb_console (for example, detach or kill as appropriate), then retry close. REA never infers target ownership from a PID or path. When the MCP server shuts down, REA terminates only its directly owned GDB process after confirming no inferior or a sink-backed detach; otherwise it retains the process and its output streams for retry.

start_gdb_session {"inferior_tty":"/dev/pts/7"}
gdb_console {"session_id":"…","command":"file ./program"}
gdb_console {"session_id":"…","command":"info files"}
gdb_session_status {"session_id":"…"}
close_gdb_session {"session_id":"…"}

Rizin

start_rizin_debug_session and rea debug-with-rizin require an explicit inferior_tty on Linux. REA asks Rizin to launch the target with stdin, stdout and stderr routed to that caller-selected TTY and dbg.exitkills=false; the target can therefore continue running, reading input from the TTY and writing to it after REA closes the debugger. This is a visible target input and output effect, and the caller is responsible for selecting a suitable terminal that remains available. REA sends Rizin its commands on Rizin's own stdin, so a target left on that stream would read them. Before closing, REA serializes after the active command, parses the structured olj descriptor list, detaches only a unique ptrace:// descriptor, confirms its absence, reads back dbg.exitkills=false, verifies /proc/<pid>/fd/1 and /proc/<pid>/fd/2 still identify the selected TTY by device and inode, and refuses to detach while /proc/<pid>/fd/0 is Rizin's command stream. A target may close or replace its own stdin. If a previously identified inferior exits after Rizin confirms detach, REA verifies that the original process has ended instead of requiring output descriptors from an exited process. Unresolved identity or ambiguous readback keeps the Rizin session owned for retry. After output limits or a failed command interval, cleanup first waits up to 1000 ms for a fresh private NUL-delimited marker, discarding earlier frames before obtaining that new inferior readback. Synchronization never reopens user command admission. A missing marker, unavailable transport, or unknown inferior identity retains the cleanup owner. Caller cancellation keeps its exact reason and typed cancellation outcome even when cleanup remains incomplete; a successful retry resolves that retained cleanup state. Cancellation during final cleanup retains the captured observation and cleanup owner. An already observed startup or protocol failure remains primary and retains a later cancellation as a secondary failure; recovering the transport does not erase that original diagnosis. Persistent Rizin debugger sessions are unavailable outside Linux because this verification depends on /proc.

Persistent command Evidence retains the caller-selected and resolved startup paths in parameters.launch_provenance. These paths describe launch provenance, not the current target after unrestricted commands. Command Evidence names the session as its subject, { "kind": "session", "session_kind": "rizin", "id": <session_id>, "target": … }, where target is the launch file REA hashed before Rizin started ({ "kind": "file", "sha256", "format": "file", "architecture": null, "selection": null }). Later debugger commands do not rebind it. If the launch file cannot be hashed (for example it does not exist or is not a regular file), the session still starts, target is { "kind": "unknown", "reason": "not-observed" }, and a limitation records the reason; cancellation or a descriptor that cannot be closed during the hash fails the start. rizin_debug_session_status.output_invalid_utf8 reports whether lossy frame decoding has been observed during the session. Command Evidence sets output_invalid_utf8 only when loss was observed in frames collected for that command, including retained partial output; earlier startup or command frames do not mark later valid output as lossy.

Session status retains up to 64 recent protocol frames. Each history entry keeps a complete-character UTF-8 prefix of at most 16 KiB, plus a truncation marker when needed; recent_output_truncated reports omitted history. This history budget also accounts for replacement characters from invalid UTF-8. It does not shorten command Evidence, whose output budget defaults to 16 MiB. Rizin debug startup waits 30000 ms with no runtime override. Each command frame defaults to 120000 ms; its deadline, command-output budget, session capacity and pending-command queue use the shared debugger launch settings. The 16777216-byte frame cap and 4096-frame command cap remain fixed. Evidence names the cap that stopped the command. The one-shot command_timeout_ms setting does not change a debug session.

Stopped debugger sessions

A Rizin or GDB session stops accepting commands when REA stops it, for example after an output or frame limit, a command deadline, cancellation or a protocol failure, or when the debugger process exits. REA keeps the stopped session and the first reason it observed until close_rizin_debug_session or close_gdb_session releases it, including after a retried cleanup succeeds. rizin_debug_session_status and gdb_session_status then report state: "closed" with that reason in closed_reason and its code in closed_reason_code: input-stream-failure, output-correlation-failure, command-deadline, command-cancelled, server-shutdown, close-requested, process-exited or stopped. A later rizin_debug_command or gdb_console on the session fails with capability_unavailable; details.reason carries the same reason and details.diagnostics.session_stop the same code (when that failure also left cleanup incomplete and REA reports cleanup_incomplete, the stopping failure and its code are under details.diagnostics.primary_error), and the remediation is to close the session and start a new one. A session_id that this server never returned, or that close already released, fails with invalid_request instead.

When REA cannot confirm that an owned Rizin or GDB process stopped, it keeps the session for cleanup retry and the failure carries details.diagnostics.debugger_cleanup: output-unsettled, detach-pending, inferior-disposition-unverified, inferior-identity-unverified, windows-stop-unsafe, detach-unsupported, detach-timeout, detach-unconfirmed, inferior-state-unknown, multiple-inferiors, no-durable-output-sink, inferior-tty-changed, detach-failed, process-did-not-exit or stop-failed. For example, closing a GDB session whose debugger exited before its inferior was detached or confirmed absent reports inferior-disposition-unverified, and a GDB session with several live inferiors reports multiple-inferiors when REA closes every session. The code is on the returned failure itself, including startup failures, cancellations and composed cleanup_incomplete results. When rea debug-with-gdb or rea debug-with-rizin cannot confirm its final cleanup, details.diagnostics.debugger_cleanup_codes lists the codes beside retained_debugger_pids.

Debugger launch settings

GDB and Rizin share these settings in the environment that launches REA:

Setting Default Accepted decimal integer
REA_DEBUGGER_COMMAND_DEADLINE_MS 120000 ms 1 to 2147483647 ms
REA_DEBUGGER_MAX_COMMAND_OUTPUT_BYTES 16777216 bytes 1 to 89303718 bytes
REA_DEBUGGER_MAX_SESSIONS 8 1 to 64
REA_DEBUGGER_MAX_PENDING_COMMANDS 16 1 to 256

Unset settings keep the defaults. Invalid values are refused when the setting is used instead of falling back. Change the command deadline and output budget for subsequent operations with update_analysis_settings using debugger.command_deadline_ms and debugger.max_command_output_bytes. Session and pending-command capacities require a restart. To change the launch values, update REA's environment and restart; for MCP, edit the client registration and restart that server.

These settings also apply to one-shot rea debug-with-gdb and rea debug-with-rizin commands. They do not change the fixed initial-prompt or owned-cleanup waits, Rizin's fixed frame and frame-count limits, or the limits of inspect_with_objdump and execute_rizin_command. GDB initialization and normal-close detach MI requests use the configured command deadline, so a shorter selection can also time out those control commands. Startup/detach control replies have a separate 16 MiB allowance that a smaller command-output setting does not lower. A larger command deadline does not establish that a blocked debugger can detach or that cleanup will succeed; retain and inspect any cleanup_incomplete result before retrying.

rea debug-with-rizin --inferior-tty /dev/pts/7 ./program dr

execute_rizin_command and rea execute-rizin-command run one selected command against a local artifact. The one-shot profile uses -N -q -e scr.color=0 -c, suppressing user settings and scripts while leaving plugins available. Native terminal presentation defaults to plain text; the caller can explicitly enable colour with e scr.color=1 in the selected command. REA preserves raw output, including literal ANSI bytes, and does not claim that command-specific JSON has one universal schema. Commands and plugins run with the REA process user's security context and may access files, the network, or perform other actions.

rea execute-rizin-command ./program iI

Before a one-shot command, REA resolves the selected executable through PATH, hashes it, runs it with -v and reads the tool and version from its banner, the first line of that output, in the form Rizin and radare2 print: <tool> <version>, any build tokens, then @ <os>-<arch>-<bits> (for example rizin 0.9.1 @ darwin-arm-64). Any other first line identifies no tool. The command then runs the same path. Evidence records the tool and version as the provider name and version, and records the executable path, its SHA-256 and the banner in its parameters; a banner longer than 2,048 UTF-8 bytes is cut within that budget, between characters, and marked by provider_version_banner_truncated; a cut banner identifies no tool, since the cut could fall inside its version. The budget and the recorded banner cover the line as printed, surrounding whitespace included; only identification ignores that whitespace. These describe the file at that path when REA checked it; they cannot prove the exact bytes or version executed if the file changes before the launch, and Evidence that records them says so in a limitation. A different tool that accepts the same arguments, such as radare2, still runs: its Evidence names that tool and adds a limitation. A probe that fails, times out, prints output that is not valid UTF-8 or prints an unrecognized banner leaves the version unknown, and the command still runs. Evidence then keeps the provider name Rizin with provider_identity: "assumed" and a limitation saying the tool itself was not identified; an identified tool has provider_identity: "banner". The probe runs before the command within the call's max_output_bytes allowance, and output that the allowance cuts identifies no tool. The probe's exit status and output, each stream cut to 2,048 UTF-8 bytes in the same way, are recorded in provider_version_probe, where stdout_invalid_utf8 and stderr_invalid_utf8 mark output that was not valid UTF-8 and so holds replacement characters, and completion_status is unknown, as for the command, when the probe's output was not fully collected or the probe was killed, signalled or left no exit code. Each call's lookup, hash and probe use that call's command_timeout_ms budget and cancellation; a lookup or hash that reaches the deadline ends the call without running the command. A hash that fails for another reason, for example on an executable that can be run but not read, leaves the version unknown without a probe; the command still runs the path the lookup found, which Evidence records without a SHA-256. REA probes before every command and reuses no reading: a launcher, such as a version-manager shim, keeps its path and SHA-256 while the tool it runs changes, so only the call's own probe describes the tool that answers. Each call therefore launches the executable twice, the probe and then the command. If the command then fails to start, for example with E2BIG because its arguments exceed the host's launch limit, the call returns no Evidence; the error's details.diagnostics keep provider, the tool and version, the selected provider_executable, and the provider_* parameters above. A probe that is cancelled, or whose cleanup is incomplete, keeps the executable path and SHA-256 there; a hash that is cancelled or reaches the deadline keeps the executable path; and a lookup that is cancelled or reaches the deadline keeps the path it was checking, as executable_lookup_candidate. Every error from the lookup through the launch also keeps the selected provider_executable and, for a call with a target, its artifact_path and artifact_sha256.

REA reports a version only for the file it runs. The lookup moves past what every native PATH search moves past: a missing file, a non-directory, a denied directory and a file without execute permission. When it finds no executable after moving past a denied directory or file, a launch by name fails with EACCES: a limitation names the first such file, and Evidence or the launch failure keeps it as executable_lookup_denied_candidate, where access must be granted. A candidate that is not a regular file, such as a directory, is denied the same way, since the host refuses to run it; executable_lookup_denied_reason is permission or not-regular-file. On Linux and macOS it also skips an entry too long for the native path buffer. At any other error, such as a symbolic link loop, a stale network file handle or an I/O error, at least one of the searches of glibc, musl, Android and libuv stops, so the lookup stops there. The command then runs by name, with the version unknown, and the host's own search decides what runs. A limitation names the file where the lookup stopped and its error, and Evidence or the launch failure keeps them as executable_lookup_candidate and executable_lookup_code. 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. At ESTALE or ENODEV, glibc's search moves past it and musl's stops, so the host decides. The command then also runs as selected, with the version unknown, and a limitation names that file. Evidence or the launch failure keeps it as executable_lookup_candidate, with its error as executable_lookup_code and its digest as executable_lookup_candidate_sha256, without claiming that it ran. An explicitly selected path has no later candidate, so the command runs that path, and Evidence or the launch failure keeps its path and SHA-256. When the host refuses to inspect an explicitly selected path (EACCES or EPERM), the command runs that path with the version unknown. When the lookup does not accept an explicitly selected path, for example because it lacks execute permission or its absolute spelling is too long, the command runs the selection as written. Either way, Evidence or the launch failure keeps the resolved path as provider_executable_path. A lookup or hash stops waiting, at the deadline or on cancellation, for a stat, an access, or a file's open, read or close that a stalled mount holds, but it cannot cancel that work. A hash completes only after its file closes, so a stalled close also reaches the deadline. Before the command, that deadline ends the call. The artifact's post-run hash instead keeps the command's Evidence: artifact_sha256_after is null, and a limitation names the deadline (ETIMEDOUT) and how to raise command_timeout_ms. The call then returns and gives back its place among the eight concurrent objdump and rizin operations. The work it stopped waiting for keeps running, and holds a thread of Node's file pool, until the mount answers. REA does not track or bound that work, and a later call on the same path starts its own. Closing the service does not wait for it. The process cannot exit until that work returns, even through process.exit(), because Node joins its pool threads at exit. A CLI command therefore prints its result and then stays alive until the mount answers.

Rizin exits with status 0 even when its shell refuses a statement, so the exit code does not show whether the command ran. Rizin 0.6 through 0.9.1 log one of four stderr lines for such a refusal: ERROR: Command '…' does not exist., ERROR: Wrong number of arguments passed to `…`…, ERROR: core: Error while executing command: … (an invalid statement), or ERROR: core: Error while parsing command: …. Rizin then skips the refused statement and every later one in the command. When the completed process's stderr contains one of these lines, REA reports completion_status: "rejected", a refusal record (reason: unknown_command, wrong_argument_count, invalid_statement or parse_failure; command: the command the line names, or null; line: the exact stderr line), and a limitation naming the refusal. stdout then holds only the output of earlier statements, so empty stdout is not an empty result. Other ERROR: lines, such as ERROR: Cannot find function at …, come from commands that ran; REA keeps them in stderr and reports complete. A command that lowers log.level or redirects stderr hides refusals from REA.

Captured stdout and stderr use the same max_output_bytes (CLI: --max-output-bytes) admission and recovery described above, default 16 MiB. One-shot commands independently use command_timeout_ms. Raising output admission cannot recover an earlier capture; command effects and cleanup must be checked before another invocation. A typed failure's captured_output marks a stream that held invalid UTF-8 with stdout_invalid_utf8 or stderr_invalid_utf8.

Decoder and map inputs

Four optional inputs select how Rizin decodes the artifact and where it maps it. REA passes each one to Rizin before the artifact path:

Input CLI option Rizin argument Example
asm_arch --asm-arch -a arm, x86, 6502
asm_bits --asm-bits -b 16 for Thumb
asm_cpu --asm-cpu -e asm.cpu= cortexm
base_address --base-address -n -m 0x08000000

Rizin 0.9.1 refuses -e asm.arch= and -e asm.bits= at startup, and Rizin 0.7.4 accepts them, so REA uses -a and -b, which both accept. Rizin applies -e settings after -a and -b, so asm_cpu applies to the selected arch.

base_address is the address of file offset 0, as in REA's raw-binary inputs. REA passes it as -m together with -n, so Rizin maps the whole file there as a raw image and loads no format information, such as sections, symbols or an entry point, even from an ELF file. Without -n, a Rizin format loader can claim a raw image and give wrong reads with no error. In Rizin 0.9.1 the AVR loader turns io.va off, so every read at the mapped address returns 0xff. In Rizin 0.7.4 and 0.9.1 the BIOS loader maps the file at another address. A loader can also claim a raw image that you open with only asm_* inputs, so pass base_address, 0x0 if the image has no known address. Evidence records each input and the complete argument list.

With -n, Rizin has no headers to read, so arch, bits and byte order stay at its defaults unless the call selects them. A Thumb image opened with only base_address decodes as plausible AArch64 on an arm64 host. Pass asm_arch and asm_bits with base_address, and for a big-endian image start the command with e cfg.bigendian=true.

REA checks only the spelling. Arch and CPU names contain letters, digits, _, ., + and -, and start with a letter or a digit. asm_bits is an integer from 1 to 64. base_address is 0x followed by 1 to 16 hexadecimal digits. Rizin owns the names, and its builds differ: for example, the Homebrew build of Rizin 0.9.1 has no xtensa or riscv plugin, while the official static Linux build of Rizin 0.7.4 has both. The commands e asm.arch=? and e asm.cpu=? list what the installed Rizin supports. To use another build, set REA_RIZIN_COMMAND. When Rizin cannot apply an arch or bits value, it uses another value and exits with status 0. Rizin 0.9.1 keeps its default and reports the value on stderr. Rizin 0.7.4 reports an unknown arch on stderr, but for arm it used 16 bits instead of 8 without a message. Both accept any asm.cpu value, and e asm.cpu then echoes it, so compare it with e asm.cpu=?, which lists the CPUs of the selected arch. Evidence therefore states that REA does not confirm the decoder that Rizin used. To check the decoder and the map, start the command with e asm.arch; e asm.bits; e asm.cpu; e cfg.bigendian; oml.

This call reads a Cortex-M flash dump at its address, in Thumb state:

rea execute-rizin-command ./flash.bin "e asm.arch; e asm.bits; oml; pxw 8 @ 0x08000000" --asm-arch arm --asm-bits 16 --asm-cpu cortexm --base-address 0x08000000

Through MCP, the same call is:

{
  "path": "/firmware/flash.bin",
  "command": "e asm.arch; e asm.bits; oml; pxw 8 @ 0x08000000",
  "asm_arch": "arm",
  "asm_bits": 16,
  "asm_cpu": "cortexm",
  "base_address": "0x08000000"
}

pxw 8 prints the initial stack pointer and the Reset vector. The Reset vector is a Thumb address with its low bit set. Disassemble the handler at the even address, for example pd 16 @ 0x08000108 for a Reset vector of 0x08000109.

Multi-segment ESP images

An app or bootloader image of the ESP32 family (the ESP32, ESP32-S, ESP32-C, ESP32-H and ESP32-P series) starts with the magic byte 0xE9 and holds several segments. ESP8266 images use a different header, and this recipe does not cover them. Each segment loads at its own address, so one base_address cannot map the image. Instead, remove the default map and add one om map for each segment, in the same command:

  1. Find the load address and the length of each segment, and the file offset of its data. The image header is 24 bytes. Each segment starts with an 8-byte header that holds the load address and the data length, both 32-bit little-endian, and its data follows. So the data of the first segment starts at file offset 0x20, and each later segment header follows the data of the segment before it. esptool image-info lists the same segments; esptool v4 spells it image_info --version 2. Its File offs column is the offset of the 8-byte segment header, so the data starts 8 bytes later. A padding segment carries no code or data, and you can skip it.
  2. Start the command with e io.va=true. Reads use the maps only while io.va is on, and a Rizin format loader can turn it off.
  3. Rizin opens the image as file descriptor 3, which ol shows. For each segment, add this map, with r-x for code and r-- for data: om 3 <load address> <length> <data offset> <permissions> <name>. A map cannot have more permissions than the opened file, which is read-only.
  4. Select the decoder with asm_arch and set asm_bits to 32. ESP32, ESP32-S2 and ESP32-S3 use Xtensa. The ESP32-C and ESP32-H series and ESP32-P4 use RISC-V. Use the plugin name that e asm.arch=? lists for the installed Rizin.

For example, for an image with an IRAM segment of 8 bytes at 0x40080000 and a DRAM segment of 16 bytes at 0x3ffb0000:

rea execute-rizin-command ./app.bin "e io.va=true; om-*; om 3 0x40080000 0x8 0x20 r-x iram0; om 3 0x3ffb0000 0x10 0x30 r-- dram0; oml; pd 4 @ 0x40080000" --asm-arch xtensa --asm-bits 32

om-* removes the maps that Rizin made when it opened the file, such as the default map of the whole file at address 0. The entry address is the 32-bit little-endian value at file offset 4.

Cutter bridge

Cutter commands use the local REA Python bridge and authenticated loopback messages. Discovery reads the session descriptors that the plugin publishes in the bridge directory. Set REA_CUTTER_BRIDGE_DIR in both REA's environment and the environment that starts Cutter to select a custom directory. Both expand ~ and ~/ paths against the current user's home, including ~\ paths on Windows. By default, they use %LOCALAPPDATA%\REA\CutterBridge on Windows when LOCALAPPDATA is set, and ~/.cache/rea/cutter-bridge otherwise. The two processes must resolve the same directory for discovery to find the published sessions.

REA's npm package includes the plugin as bridge/cutter/rea_bridge.py. Use the copy from the REA version you run (rea --version, or the version in an npx rea-agents@<version> registration). An npx installation keeps that package in npm's cache rather than a stable folder, so take the file from the published package of the same version instead (in Windows PowerShell, use npm.cmd):

npm pack rea-agents@<version>
tar -xzf rea-agents-<version>.tgz package/bridge/cutter/rea_bridge.py

Copy the extracted package/bridge/cutter/rea_bridge.py into the python subdirectory of Cutter's plugin directory, then restart Cutter. Cutter shows that directory and the loaded plugins under Edit > Preferences > Plugins. When no session in the bridge directory answers, list_cutter_sessions reports no_live_bridge_found with a limitation that names the possible causes. Whether or not a session answers, it also counts descriptor files it could not read, without claiming they belong to a session, and published sessions that did not answer, because neither is listed. If Cutter lists the plugin as loaded but discovery still finds no session, check that the bridge directory is writable and has free space: the bridge does not log a failure to publish its session.

Official Cutter 2.5.0 builds have been observed to reject Python plugins at startup: Cutter's own sample plugin in the Linux AppImage, and this bridge and a minimal independent plugin on macOS arm64 (rizinorg/cutter#3659). The log then shows Plugin's create_cutter_plugin() function did not return an instance of CutterPlugin and Loaded 0 plugin(s), and no session is published. Because a minimal plugin fails the same way, a change to REA's bridge is not expected to help; the cause is unconfirmed upstream. Cutter 2.4.1 loaded the bridge on the same macOS arm64 host, where discovery and an ij command worked. Other hosts and Cutter builds have not been checked.

The plugin publishes the SHA-256 of its own file on its session descriptor. Discovery reports each session's bridge_source: packaged when it matches REA's packaged bridge/cutter/rea_bridge.py, modified when it differs, and unknown when the plugin predates this field. cutter_command refuses a modified session before sending anything and names the packaged plugin to copy into Cutter's plugins/python directory. An unknown session still runs. For modified and unknown sessions, discovery also returns bridge_source_recovery, which names the packaged plugin to copy before restarting Cutter.

The client and plugin must support the current v2 handshake; older peers are rejected before dispatch because they cannot preserve cross-caller recovery proof. The client checks the final encoded request against REA_BRIDGE_MAX_REQUEST_BYTES before dispatch. The budget applies to request payload bytes and excludes the terminating LF. Unset, the ceiling is 16777216 bytes (16 MiB). A decimal integer from 7464 to 536870887 is accepted. The floor fits the largest bounded symbol-name command inside an authenticated Cutter frame. A Cutter status keeps its session id, connection proof, and up to 64 completion receipts when the frame is tight. The observed current_file is included when it fits. When it does not, the status reports that path as unknown, and the client does not reuse the descriptor path with the new generation. The maximum is one byte under Node's 536870888-character string ceiling so the framing LF still fits. The ceiling counts the encoded payload. A JSON escape is measured before serialization and is not divided into the maximum again. A structured Cutter reply is admitted when that encoded payload fits, including a dense array of numbers. Cutter hashes the HMAC prefix and the payload as separate updates, so an exact-limit frame does not build one preimage string. The plugin measures and signs the response from bounded JSON pieces, then writes the authenticated frame in 64 KiB chunks. The bridge searches only the newly read bytes for the framing LF. The client unescapes each socket chunk into one response string, checks the proof, and then parses that string. A fitting reply keeps the original output and does not retain the paged wire frame plus another concatenated copy. Zero, negative, non-decimal, and out-of-range values are configuration_invalid and do not fall back to the default. The bridge accepts that full payload size and rejects a larger payload while bounding the read. An incomplete frame is still Incomplete bridge request frame. An oversized command does not retain a cleanup owner. Hopper uses the same request payload budget. A Hopper request is serialized when it reaches the bridge, so one waiting behind Hopper's serial bridge does not retain another copy of the encoded frame. REA injects a caller-selected value into the Hopper bootstrap and the bridge also reads the process environment; an injected value wins. Cutter reads the environment that starts Cutter and publishes max_request_bytes on its session descriptor. A Hopper or Cutter process started out of band without the setting uses 16777216 bytes. The client compares that advertisement with its own ceiling before a discovery status probe and before sending a command. A different ceiling is a mismatch only after the hello proves that descriptor is a live authenticated bridge; a stale descriptor is ignored. That hello does not send a status request. Discovery fails if any such live ceiling differs, even when another live session matches. A hello that never sends its authenticated frame does not hold the bridge accept loop. At most 8 connection threads run. A further accept is closed, and a failure to start a thread closes that socket without stopping the listener. A status completed_connection is the longest prefix of accepted connections that have terminated. It does not treat an earlier connection as finished because a later status reached the command lock first. Scalar values in one Cutter reply are encoded in bounded batches. A command reply that does not fit keeps its completion state and document generation, and reports an oversized path as unknown. Cutter response frames use this same ceiling and also exclude the terminating LF. A command response the client discards because it exceeds that ceiling stays an unknown execution and sets output_truncated, so Evidence records the omitted output. Hopper and Ghidra reply lines are bounded separately by REA_BRIDGE_MAX_REPLY_BYTES (bridge.max_reply_bytes): default 268435456 bytes (256 MiB), from 1048576 to 536870888. The client admits the value with each request. A reply line, or an unterminated tail, above it is refused as a typed transport resource constraint naming the setting; REA discards the bytes and closes that bridge connection rather than retaining them. cutter_command reports output_truncated and document_generation as null when the plugin did not declare them, for example when no reply was read, the reply was malformed, or an older plugin omitted them. A null generation means the document may have changed; list sessions again before choosing an expected_generation. Evidence carries a limitation for each unknown field. With json: true, Cutter command output retains integer literals outside JavaScript's safe integer range as decimal strings, so 64-bit addresses and offsets keep their original digits. Each bridge request waits 25000 ms. The Cutter hello frame still must arrive within 1 second. The authenticated command frame is read with one second per mebibyte of REA_BRIDGE_MAX_REQUEST_BYTES, and that read never waits longer than the same 25000 ms. Discovery admits at most 256 descriptor candidates and reads and probes at most eight concurrently. A larger directory reports bridge_directory_capacity_exceeded. This release has no runtime override for the 25000 ms request deadline or the 256-candidate discovery budget. Those limits do not follow REA_BRIDGE_MAX_REQUEST_BYTES.

Terminal receipts are recovered before another command, including from a new CLI invocation. A signed status response also confirms completion of older bridge connections after its UI dispatch, preserving recovery proof for a caller whose receipt another caller has acknowledged. Neither receipt recovery nor a status probe retries the original command. Failed acknowledgements remain pending and block new commands until they can be retried successfully. Status proof failures identify cutter_command and retain status in details.diagnostics.auxiliary_operation; malformed proof still blocks dispatch. Descriptor failures likewise retain the requesting operation through cleanup. If a completion-proof read fails while an earlier command is unresolved, retry admission preserves both errors and their independently owned resources. Releasing one owner does not settle the other, and the command is not replayed to recover proof. Command admission reports typed cancellation and treats the caller's abort reason as opaque metadata, without inferring cleanup ownership from it. A generation mismatch is an input correction only when the authenticated reply confirms not_started. Missing or ambiguous execution state retains the command's completion uncertainty until terminal proof arrives, even if the reply names a generation error.

Configuration and coverage

The optional REA_OBJDUMP_COMMAND, REA_GDB_COMMAND, and REA_RIZIN_COMMAND values select executable names or paths; otherwise REA searches PATH. On Windows, REA searches PATH and PATHEXT for a bare objdump or Rizin name itself and refuses with capability_unavailable (boundary: "provider-lookup") when it is not found, rather than letting Windows also search the current directory. Values are passed directly to process spawning, not expanded as shell command lines. A host executable launch refusal preserves the selected command and host error code, with recovery through the corresponding command setting, PATH, or execute/search permissions. GDB does not retry that refusal with MI2; its MI2 fallback applies to protocol initialization failures. Provider versions and capabilities remain unknown until observed from the installed tool and verified in the corresponding real-provider lane. The Rizin version that Evidence records is the installed tool's -v banner, described above; it is an observation, not lane verification.

Provider capture limits are separate from the MCP response budget. A result that fits the provider limit may still exceed the default 10 MiB MCP response budget and return a transport resource_constraint. Configure REA_MCP_MAX_RESPONSE_BYTES to match a larger client receive buffer when that client supports one; otherwise use retained Evidence/export or complete CLI JSON output. See MCP response limits.