Skip to content

fix(adb): separate unresolvable paths and host capacity in adb spawn failures - #6188

Merged
morluto merged 28 commits into
morluto:mainfrom
chordpli:fix/adb-client-unusable-path
Nov 5, 2026
Merged

morluto merged 28 commits into
morluto:mainfrom
chordpli:fix/adb-client-unusable-path

Conversation

@chordpli

@chordpli chordpli commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follows up #5689, which main closed with 57e3e0b04 (an EACCES/EPERM adb now names its path). No open issue tracks the two cases that remain:

  • A path that cannot resolve because a parent is a regular file (ENOTDIR) still reports only "The selected adb binary did not report a usable version." Node throws that spawn error synchronously, so it never reaches the adb classifier. It now reports the path as missing, like ENOENT.
  • Exhausted host capacity (EAGAIN, EMFILE, ENFILE, ENOMEM) is not separated from a bad path. It now says the host could not start adb and keeps REA_ADB_PATH out of the blame. inspect_adb_client and the device operations (at the version probe or a later adb command) report it as a retryable capacity constraint; the binary_session inventory reports runtime_unavailable.

The remediation for EACCES also now distinguishes REA_ADB_PATH from an adb on PATH.

Fixing that needed the process capture owner to say when a command never started. execFileBytes now marks every spawn failure, including the ones Node throws synchronously (ENOTDIR, EPERM), as spawnFailed. Only the adb readiness probe and adb commands read that fact; the DMG reader, the Darwin compiler probe and assetutil are unchanged from main, as requested in the review.

Problem and expected behavior

  • Trigger: REA_ADB_PATH=/some/file/adb rea inspect-adb-client --json, where /some/file is a regular file (ENOTDIR). Same result for list-adb-devices.
  • Cause: synchronous spawn errors (ENOTDIR, EPERM) were rejected from execFileBytes without capture fields, so execFileOutputFailure returned undefined and no consumer could see their code. inspectAdbClient then fell through to the generic version_unresolved refusal. Host-capacity errnos had no classification and were treated as a refusal of the selected path.
  • Expected: readiness stays refused, but the refusal names the selected path and the actual start failure. It stays distinct from a missing binary, from exhausted host capacity, and from real unrecognized version output.

Change and scope

  • src/process/ExecFileOutput.ts (owner): admits synchronous and asynchronous spawn errno failures with the same empty capture and spawnFailed: true. Argument validation errors stay unadmitted. spawnCapacityExhausted classifies EAGAIN, EMFILE, ENFILE and ENOMEM next to the fact it reads. After an EMFILE or ENFILE spawn failure Node creates no stdio, so the owned stop-signal route (the one adb uses) attaches its error listener first and captures absent streams as empty; before, reading the streams threw a TypeError and the later spawn error went unhandled.
  • inspectAdbClient:
    • Path-resolution errnos (ENOENT, ENOTDIR, ELOOP, ENAMETOOLONG, from the filesystem owner's predicate) stay binary_missing.
    • EACCES/EPERM and other spawn errnos stay binary_not_executable (not_configured, as on main). The remediation now depends on whether adb came from REA_ADB_PATH or PATH. ADB_NOT_EXECUTABLE_REMEDIATION now holds the REA_ADB_PATH EACCES text, so capability discovery reports the same repair as the failure.
    • Host capacity is a new host_capacity failure, mapped to runtime_unavailable for the inventory availability and to the retryable capacity constraint for inspect_adb_client and the device operations. One remediation text, owned by AdbConfiguration (adbHostCapacityRemediation), says the host could not start adb and that REA_ADB_PATH does not need to change; it travels as the failure's remediation (the shape main adopted in fix(discovery): carry provider repair instructions into capability discovery #8532), and the constraint's remediation.action uses the same function, with no copy in diagnostics. PROVIDER_REJECTION_CODES is unchanged.
    • A spawn errno is recorded as filesystem_error, never as exit_code. The generic fallback also names the path and path_source.
  • runAdbCapture: a never-started adb says so instead of claiming an exit code; host capacity is a retryable capacity resource constraint (adbSpawnCapacityError, shared with the version probe). The exception is push_adb_file after adb push has completed: a capacity failure starting sha256sum returns the receipt with device_digest_source: "unavailable" and names the failure in its limitations, because repeating the request with overwrite: false would be refused.
  • Not included: the other execFileBytes consumers. An earlier revision moved the DMG reader, the Darwin compiler probe and assetutil onto spawnFailed and gave assetutil a capacity constraint; those changes are reverted so the diff stays on the adb start-failure and capacity cases. They can follow separately if wanted.
  • Not included: with adb from PATH, the message names adb, not the resolved file. Resolving the first PATH match would add a lookup the spawn does not use; the remediation points at PATH.

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage: execFileBytes / execFileOutputFailure in src/process/ExecFileOutput.ts; adb classification in inspectAdbClient and runAdbCapture; adbSpawnCapacityError is the one capacity constraint for both the version probe and later adb commands.
  • Contribution scope fit and linked maintainer decision: not applicable; ordinary fix within existing boundaries.
  • CLI and MCP/tool-catalog contract: readiness error code stays capability_unavailable; message and remediation text change. Host capacity from inspect_adb_client and the adb device operations becomes a retryable capacity resource constraint; the inventory availability is runtime_unavailable. No schema change.
  • Provider, bridge, target-format, or platform compatibility: POSIX spawn semantics. Windows not run.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable; no device is contacted on the refused paths.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

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

The checked box covers how an existing adb launch reports a failed start. No new process is launched. execFileBytes is shared: on a synchronous spawn throw its other callers now receive the same empty stdout/stderr capture and spawnFailed marker an asynchronous spawn failure carries; code and syscall are unchanged, and those callers read only code/syscall directly (searched, not individually tested). No other consumer reads spawnFailed.

Evidence and regression coverage

  • Tests added or updated:
    • tests/boundary/cli/adbCli.test.ts: directory and 0644 REA_ADB_PATH through inspect-adb-client and list-adb-devices, a chmod 755 success control, and a 0644 adb as the only PATH entry.
    • src/process/ExecFileOutput.test.ts: synchronous ENOTDIR spawn admitted with an empty capture and spawnFailed on both routes, Node's execFile (no stopSignal) and the owned spawn route (stopSignal, the one adb uses); argument validation errors stay unadmitted.
    • src/adb/AdbVersionProbe.test.ts, src/adb/AdbCommand.test.ts: EPERM, ENOTDIR and host-capacity classification, and no exit_code for a never-started adb. The assertions check code, filesystem_error, selected_binary, path_source and the owner's spawnFailed marker, not refusal wording.
    • tests/boundary/process/adbDescriptorPressure.test.ts: real EMFILE under ulimit -n 64 against the built modules. The version probe reports host_capacity with filesystem_error: EMFILE, a device command reports a retryable capacity constraint, no unhandled error reaches stderr, and both succeed after the descriptors are released. Without the stop-signal stdio fix it fails with an unhandled spawn ... EMFILE.
    • src/adb/AdbProvider.test.ts: host capacity at the version probe of list_adb_devices is a retryable resource_constraint that keeps selected_binary, path_source and filesystem_error, not capability_unavailable (fails with the AdbProvider.ts change reverted).
    • With src/adb/AdbConfiguration.ts reverted to main (1173c0a9d), the two new CLI tests fail (2 failed, 34 passed). Reverting the host_capacity mapping fails the capacity readiness test. Reverting the runAdbCapture capacity branch fails its capacity test.
  • Base reproduction or other evidence: built CLI E2E below, base main 1173c0a9d and head 454f0177f.
  • User-visible CLI/MCP output (if applicable): below.
  • Remaining proof gaps: a real EPERM, EAGAIN and ENOMEM were not produced; those branches are covered by tests that fake the spawn error. Real EMFILE is produced by the descriptor-pressure test. No device was attached for either run's list-adb-devices control. Windows and Linux not run.

Boundary regressions covered:

  • Missing, empty, and unknown values: a never-started adb is kept distinct from a non-zero exit. The spawn errno is recorded as filesystem_error, never as exit_code, and the empty capture is admitted only for spawn failures; argument validation errors stay unadmitted (ExecFileOutput.test.ts, AdbVersionProbe.test.ts).
  • Public success and error delivery: adbCli.test.ts and the E2E below run inspect-adb-client and list-adb-devices through the built CLI. Gap: MCP was not exercised separately (same refusal projection), and host capacity is covered at the provider and module level, plus real EMFILE against the built modules (adbDescriptorPressure.test.ts), not through the CLI.

Lifecycle regressions: not applicable. A failed spawn acquires no process or resource, and existing cleanup paths are unchanged.

For evidence-bearing changes:

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

E2E: built CLI, real adb 37.0.1

$WORK is a fresh temp directory. The 0644 files are copies of the real platform-tools adb. Output is reduced with jq to {code, message} for errors and a summary for successes.

Only ENOTDIR changes the outcome. The EACCES rows differ only in remediation wording. Controls are identical.

Base (origin/main 1173c0a9d)
# Base (origin/main) — 1173c0a9d, macOS 26.5.2, node v24.22.1, Version 37.0.1-15733141

$ REA_ADB_PATH=$WORK/adb-dir rea inspect-adb-client --json   # directory
{"code":"capability_unavailable","message":"Execution of the selected adb binary was denied (EACCES): $WORK/adb-dir. Check file type and execute permission for REA_ADB_PATH or select an executable adb binary."}
exit=1

$ REA_ADB_PATH=$WORK/adb-noexec rea inspect-adb-client --json   # real adb copy, mode 0644
{"code":"capability_unavailable","message":"Execution of the selected adb binary was denied (EACCES): $WORK/adb-noexec. Check file type and execute permission for REA_ADB_PATH or select an executable adb binary."}
exit=1

$ REA_ADB_PATH=$WORK/adb-dir rea list-adb-devices --json   # device operation
{"code":"capability_unavailable","message":"Execution of the selected adb binary was denied (EACCES): $WORK/adb-dir. Check file type and execute permission for REA_ADB_PATH or select an executable adb binary."}
exit=1

$ PATH=$WORK/bin rea inspect-adb-client --json   # REA_ADB_PATH unset, adb on PATH is mode 0644
{"code":"capability_unavailable","message":"Execution of the selected adb binary was denied (EACCES): adb. Check file type and execute permission for REA_ADB_PATH or select an executable adb binary."}
exit=1

$ REA_ADB_PATH=$WORK/notdir/adb rea inspect-adb-client --json   # parent is a regular file (ENOTDIR)
{"code":"capability_unavailable","message":"The selected adb binary did not report a usable version."}
exit=1

$ REA_ADB_PATH=$WORK/notdir/adb rea list-adb-devices --json   # device operation, ENOTDIR
{"code":"capability_unavailable","message":"The selected adb binary did not report a usable version."}
exit=1

$ REA_ADB_PATH=$WORK/missing rea inspect-adb-client --json   # control: missing path
{"code":"capability_unavailable","message":"The selected adb binary was not found: $WORK/missing. Set REA_ADB_PATH to an absolute path to an existing adb binary."}
exit=1

$ chmod 755 $WORK/adb-noexec; REA_ADB_PATH=$WORK/adb-noexec rea inspect-adb-client --json   # control: same file, executable
{"ok":true,"version":"37.0.1-15733141"}
exit=0

$ REA_ADB_PATH=~/Library/Android/sdk/platform-tools/adb rea list-adb-devices --json   # control: real adb
{"ok":true,"version":"37.0.1-15733141"}
exit=0
This branch (454f0177f, main merged)
# This branch — 454f0177f, macOS 26.5.2, node v24.22.1, Version 37.0.1-15733141

$ REA_ADB_PATH=$WORK/adb-dir rea inspect-adb-client --json   # directory
{"code":"capability_unavailable","message":"Execution of the selected adb binary was denied (EACCES): $WORK/adb-dir. Set REA_ADB_PATH to an absolute path to the adb executable file, not a directory, and check execute permission on it and search permission on its parent directories."}
exit=1

$ REA_ADB_PATH=$WORK/adb-noexec rea inspect-adb-client --json   # real adb copy, mode 0644
{"code":"capability_unavailable","message":"Execution of the selected adb binary was denied (EACCES): $WORK/adb-noexec. Set REA_ADB_PATH to an absolute path to the adb executable file, not a directory, and check execute permission on it and search permission on its parent directories."}
exit=1

$ REA_ADB_PATH=$WORK/adb-dir rea list-adb-devices --json   # device operation
{"code":"capability_unavailable","message":"Execution of the selected adb binary was denied (EACCES): $WORK/adb-dir. Set REA_ADB_PATH to an absolute path to the adb executable file, not a directory, and check execute permission on it and search permission on its parent directories."}
exit=1

$ PATH=$WORK/bin rea inspect-adb-client --json   # REA_ADB_PATH unset, adb on PATH is mode 0644
{"code":"capability_unavailable","message":"Execution of the selected adb binary was denied (EACCES): adb. Make sure the adb found on PATH is a file with execute permission, not a directory, and that its parent directories have search permission, or set REA_ADB_PATH to an absolute path to an executable adb binary."}
exit=1

$ REA_ADB_PATH=$WORK/notdir/adb rea inspect-adb-client --json   # parent is a regular file (ENOTDIR)
{"code":"capability_unavailable","message":"The selected adb binary was not found: $WORK/notdir/adb. Set REA_ADB_PATH to an absolute path to an existing adb binary."}
exit=1

$ REA_ADB_PATH=$WORK/notdir/adb rea list-adb-devices --json   # device operation, ENOTDIR
{"code":"capability_unavailable","message":"The selected adb binary was not found: $WORK/notdir/adb. Set REA_ADB_PATH to an absolute path to an existing adb binary."}
exit=1

$ REA_ADB_PATH=$WORK/missing rea inspect-adb-client --json   # control: missing path
{"code":"capability_unavailable","message":"The selected adb binary was not found: $WORK/missing. Set REA_ADB_PATH to an absolute path to an existing adb binary."}
exit=1

$ chmod 755 $WORK/adb-noexec; REA_ADB_PATH=$WORK/adb-noexec rea inspect-adb-client --json   # control: same file, executable
{"ok":true,"version":"37.0.1-15733141"}
exit=0

$ REA_ADB_PATH=~/Library/Android/sdk/platform-tools/adb rea list-adb-devices --json   # control: real adb
{"ok":true,"version":"37.0.1-15733141"}
exit=0

Validation performed

At 16b272d00 (main 71f680d7c merged; macOS 26.5.2, Node 24.22.1):

  • Conflicts in src/adb/AdbCommand.ts and src/adb/AdbCommand.test.ts with main's adb startup-notice handling. Both sides' imports and tests are kept; the test file has no lines removed relative to main.
  • npm run test:focused -- AdbCommand, AdbProvider, AdbVersionProbe, ExecFileOutput, tests/boundary/cli/adbCli.test.ts, adbDescriptorPressure — 6 files, 237 passed.
  • npm run check:fast, npm run format:check and npm run docs:check — passed. The Static checks failure at a3f2d6caf was format:check on website/wrangler.toml, which this PR doesn't touch; main has since fixed it. CI on this head is still pending.
  • Built CLI: REA_ADB_PATH=/etc/passwd/adb rea inspect-adb-client --json reports capability_unavailable, "The selected adb binary was not found: ..."; with the real adb (37.0.1), inspect-adb-client succeeds.
  • Not run on this head: full npm run check:pr, a real device, Linux, Windows.

At 8151d0a7d (main 8250bf232 merged; macOS 26.5.2, Node 24.22.1):

  • The commit hook on c68f0dab5 had reformatted 23 unrelated files. This merge restores them to main's content, so the diff against main is again the 12 adb and spawn-failure files. That merge commit used --no-verify so the hook would not reapply those changes; the pre-push check:fast ran.
  • npm run test:focused -- the same 8 files as below — 240 passed
  • npm run check:fast and npm run docs:check — passed
  • CI: Native package baseline (darwin arm64) failed at c68f0dab5 and 3b927674c with malformed_procargs_path_padding during verifier cleanup, at different stages (package install, package update). feat/owned-debugger-process-lifecycle failed the same job with the same diagnostic at b21c2a19a and passed at its next commit. The same job passed at 8151d0a7d, whose only change from 3b927674c is the merge above. The cause of the two failures is unconfirmed: the ownership reader's helper path uses ExecFileOutput, which this PR changes, so one pass does not exclude this PR.
  • Local npm run verify:package at 3b927674c and main 8250bf232: 3 of 3 rounds passed on both (macOS arm64, a different host from the CI runner). This did not reproduce the failure, and does not establish that it is unrelated.

At 3b927674c (no new merge; macOS 26.5.2, Node 24.22.1):

  • npm run test:focused -- the same 8 files as below — 240 passed
  • New AdbProvider.test.ts case for a capacity failure at the digest check, with a faked EMFILE spawn error — fails with src/adb/AdbProvider.ts reverted (resource_constraint, retryable: true), passes with the change
  • npm run check:fast and npm run docs:check — passed
  • Not run: the repeated overwrite: false request (source-derived), a real device, a real EMFILE at this step, Linux, Windows.

At c68f0dab5 (main d3ab0faf5 merged; conflict in AdbConfiguration.ts with #8532 resolved by passing each repair as the failure's remediation instead of diagnostics.remediation; macOS 26.5.2, Node 24.22.1):

  • npm run test:focused -- AdbConfiguration, AdbVersionProbe, AdbCommand, AdbProvider, ExecFileOutput, adbDescriptorPressure, tests/boundary/cli/adbCli.test.ts, tests/boundary/mcp/capabilityRemediationMcp.test.ts — 8 files, 239 passed
  • npm run check:fast and npm run docs:check — passed
  • Built CLI: REA_ADB_PATH=<regular file>/adb rea inspect-adb-client --json reports capability_unavailable, "The selected adb binary was not found: ..." and the REA_ADB_PATH repair
  • Not run on this head: full npm run check:pr, Linux, Windows. main has since moved to 8250bf232; that merge is textually clean and its two commits do not touch src/adb or src/process.

At 02bc03d9f (main 317bf3fe2 merged cleanly; stop-signal stdio fix in b08e27e77; macOS 26.5.2, Node 24.22.1):

  • npm run test:focused -- adbDescriptorPressure, ExecFileOutput, AdbCommand, AdbProvider, AdbVersionProbe, tests/boundary/cli/adbCli.test.ts — 6 files, 228 passed
  • adbDescriptorPressure.test.ts with src/process/ExecFileOutput.ts reverted to the previous head — fails with an unhandled spawn ... EMFILE
  • npm run check:fast — passed
  • npm run format:check — passed
  • The previous CI run at 7495a3440 failed in bundleComparisonCli/bundleComparisonMcp and flutterMcp, which also failed on main d3ecf6800; bundleComparisonCli and bundleComparisonMcp pass locally after this merge (2 files, 12 passed)

At d90f12364 (main 18a8e71c9 merged; main 2b8fb38 made resolveAdbBinary asynchronous and added Windows PATH resolution in AdbConfiguration.ts, no conflict with the spawn-failure classification; macOS 26.5.2, Node 24.22.1):

  • npm run test:focused -- AdbCommand, AdbProvider, AdbVersionProbe, AdbConfiguration, ExecFileOutput, tests/boundary/cli/adbCli.test.ts — 6 files, 225 passed
  • npm run check:fast — passed
  • npm run docs:check — passed

At 0da410cd4 (merge base main a95b83c2b unchanged; macOS 26.5.2, Node 24.22.1):

  • npm run test:focused -- AdbCommand, AdbProvider, AdbVersionProbe, ExecFileOutput, tests/boundary/cli/adbCli.test.ts — 5 files, 218 passed (the synchronous spawn-throw case now runs on both routes; inspect_adb_client added to the host-capacity provider test)
  • npm run check:fast — passed
  • npm run docs:check — passed

At 180caed03 (main a95b83c2b merged cleanly; macOS 26.5.2, Node 24.22.1):

  • npm run test:local -- AdbCommand, AdbProvider, AdbVersionProbe, ExecFileOutput — 181 passed
  • npm run test:focused -- tests/boundary/cli/adbCli.test.ts — 36 passed
  • npm run check:fast — passed
  • npm run docs:check — passed

At d1c9203fe (main 365fb03e7 merged; execFileBytes keeps main's child.stdin?.end() inside the synchronous-spawn guard; macOS 26.5.2, Node 24.22.1):

  • npm run test:local -- all src/adb/*.test.ts and ExecFileOutput — 287 passed
  • npm run test:focused -- tests/boundary/cli/adbCli.test.ts — 36 passed
  • npm run check:fast — passed
  • npm run docs:check — passed

At 06af91993 (main 8706068b5 merged; test assertions moved to facts in 9737b49e2; macOS 26.5.2, Node 24.22.1):

  • npm run check:fast — passed
  • npm run docs:check — passed
  • npm run test:local -- all src/adb/*.test.ts and ExecFileOutput — 6 files, 278 passed
  • npm run test:focused -- tests/boundary/cli/adbCli.test.ts — 36 passed
  • main's ExecFileOutput refactor (startStoppableCommand) is merged; the synchronous spawn admission now wraps both the execFile and the stoppable spawn start and completes through the shared complete callback.
  • Not caused by this PR: tests/composition/analysis-sessions/providerBinding.test.ts (1 failed) and tests/boundary/filesystem/safeOutputTreeCloseFailures.test.ts (2 failed) fail identically on an unmodified main checkout at 29ebd6740 on this machine, and they were the failures in this PR's CI run at 6f92e8c22 (Source tests, Portable tests). This PR touches neither.

At 6f92e8c22 (main fc7f042c8 merged, macOS 26.5.2, Node 24.22.1):

  • npm run check:fast — passed
  • npm run docs:check — passed
  • npm run test:local -- all src/adb/*.test.ts, ExecFileOutput, assetutil (now main's) — 9 files, 309 passed, 1 skipped (Windows-only skip)
  • npm run test:focused -- adbCli, Darwin token reader and DMG reader boundary files (the latter two now main's) — 3 files, 121 passed
  • Earlier, at 8752d6e79: src/adb/AdbProvider.ts reverted — the probe-capacity test fails; at 454f0177f: src/adb/AdbConfiguration.ts reverted to main — the two new CLI tests fail; host_capacity mapping reverted — the capacity readiness test fails
  • Built-CLI E2E above ran at 454f0177f with adb 37.0.1; the adb classification is unchanged since, so it was not rerun. Not run: full npm run check:pr, Linux, Windows.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Same readiness error code; refusal text is more specific. Host capacity from adb device operations is now a retryable resource constraint instead of a protocol or unavailable error.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS only, with a real adb client.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: the message echoes the caller-selected path, as the existing missing-path refusal already does. No new process is started.

Author readiness

Human owner: @chordpli

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

Before merge

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

When REA_ADB_PATH or the PATH-resolved adb is a directory or a file the
host refuses to execute, the version probe fails at spawn with EACCES or
EPERM. That fell through to the generic "did not report a usable version"
refusal, which named neither the path nor the cause.

Classify those spawn errors as binary_not_executable (provider rejection
executable_missing), name the selected path and errno, and give
remediation for the environment, PATH and host-policy cases. The generic
fallback now names the selected path too.

Fixes morluto#5689
@chordpli
chordpli marked this pull request as ready for review October 22, 2026 00:02
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-22T00:02:10.927268Z
We couldn’t complete this review. Comment @codex review to try again.
0d29c0b Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

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

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[Medium impact] The PR appears safe to merge; no new actionable defect was found.

Summary

Separates unresolved adb paths, denied execution, and exhausted host capacity. The shared process helper now preserves synchronous spawn errors and tolerates absent output streams.

  • Adb readiness now names missing paths and execution refusals.
  • Host capacity failures now get a retryable response from adb operations.
  • A completed adb push keeps its receipt when digest checking cannot start.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Start adb] --> B{Process started?}
  B -->|Yes| C[Existing output and exit handling]
  B -->|No| D[Preserve spawn errno]
  D --> E{Failure kind}
  E -->|Unresolved path| F[Binary missing]
  E -->|Denied or other start failure| G[Binary not executable]
  E -->|Host capacity| H{Push already completed?}
  H -->|No| I[Retryable capacity error]
  H -->|Yes, digest check failed| J[Unverified push receipt]
Loading

Reviews (20) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

@CassieFox23 CassieFox23 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TL;DR: Main still hides the cause when REA_ADB_PATH points at a directory or a file without execute permission (issue #5689). This PR names the path and the error, and the directory case works as the body shows. No tests have run on this head yet, and I think the new EPERM branch can never fire.

Edit (25 Oct): The author pushed new commits since this review. I re-reviewed the new head 454f017 here. That review also fixes a mistake below. My "Looks good" note says main still had the bug. In fact, main's 57e3e0b had already fixed the EACCES and EPERM naming.

Findings

Should fix

  • The EPERM branch looks unreachable. Node only reports EACCES, EAGAIN, EMFILE, ENFILE and ENOENT from spawn as an async error event. Any other code is thrown synchronously (I read the v22.23.1 source). execFileBytes calls execFile inside a Promise executor, so that throw becomes a rejection with no stdout or stderr fields. Then execFileOutputFailure returns undefined. So failure?.code === "EPERM" at AdbConfiguration.ts line 180 cannot match. I checked the mechanism on this box (Node 22.23.1) with ENOTDIR, which throws synchronously and has no stdout or stderr. I could not produce a real EPERM, so that part is read from the source, not run. The body already says the EPERM branch was not executed, and the docs sentence promises it. Please do one of three things. The first is to handle synchronous spawn errors at the capture boundary. The body says that is where ENOTDIR belongs. The second is to drop EPERM from the code and docs for now. The third is to cover it with a test that fakes the spawn error.
  • The body does not keep the repo template as written. Please restore the template text. What changed:
    • The "Follow the contribution scope" paragraph is gone. One sentence took its place. That drops the CONTRIBUTING.md link. It also drops the rule about linking a scope decision for new providers or capabilities.
    • The Target selection, authority, upstream behavior, and cleanup details line lost "(if applicable)".
    • The note in brackets after the "Generated metadata" label is gone. It said docs/public/product-catalog.json, CI builds the catalogs and skills/, and never commit build outputs.
    • The "Expected effects" lead-in and 7 of its 8 boxes are gone. Only "Documentation or usability only" is left, and it is checked.
    • The three "For evidence-bearing changes" boxes are gone.
    • Three Evidence labels are reworded. One is "Tests added or updated". Another is "Base reproduction or other evidence". The last is "User-visible CLI/MCP output (if applicable)". The E2E block does give the output.
    • All other headings and labels are present, and the Author readiness text is unchanged.

Worth a look

  • No tests have run on this head. The CI workflow run is action_required, which means it never started, so there is no test result to read, green or red. That is not the author's fault. A maintainer has to approve the run. Greptile's 5/5 is a read of the diff, not a test run. The Codex review on this head failed on a usage limit, so no Codex finding exists to repeat. No human has reviewed it.
  • The checked box says "Documentation or usability only", but the PR changes src/adb/AdbConfiguration.ts and adds an error code. The template says to use that box on its own for documentation-only changes. Is "usability only" what the author means? If so, say so in one line. If not, the other boxes (for example "Launch or attach to a process", since the probe spawns adb) may apply. The template says unchecked boxes do not establish absence.
  • When adb comes from PATH, the message ends in : adb, not the file that was found. The test pins it (adbCli.test.ts line 147 onward). The body says the message "names the selected path", which is true for REA_ADB_PATH only. The remediation does tell the user to look at PATH, so this may be fine. I did not check whether the first PATH match can be resolved cheaply.
  • The new selected_binary, path_source and spawn_error diagnostics will not reach CLI or MCP output yet. providerConfigurationRefusal passes on only the message and the remediation. That gap is issue #6094. Open PR #6150 by agorevski adds diagnostics: failure.diagnostics there. It says it fixes #6094. Its title is fix(diagnostics): attribute input and refusal failures to their source. It also edits inspectAdbClient in the same file (it adds an operation argument). I did not try merging the two. For this PR the message and remediation text still carry the path, so the fix stands on its own.

Nits

  • rejectionCodeOf maps binary_not_executable to executable_missing. That matches how Apktool treats EACCES today, so I have no complaint. It is worth keeping the body's note that this is on purpose.

Looks good

  • Main (9066444) still has the bug. inspectAdbClient handles only ENOENT. It sends everything else to the generic "did not report a usable version" message. git grep for binary_not_executable on main finds nothing.
  • The directory case works the way the PR says. On this box, execFile on a directory gives an async EACCES with stdout and stderr strings, so the new branch does catch it. I used Node 22.23.1 here. The author used 24.19.
  • Small and on target: 3 files, 105 changed lines by the compare API. The issue asked for the path and the failure to survive. It also asked for the missing-path and executable controls to keep working. The table in the body, base versus branch, shows both controls unchanged.
  • The ENOTDIR limit is stated honestly. I confirmed it throws synchronously on this box. It still gets the generic refusal, which now names the path, so it is better than before.
  • Two new CLI tests. They cover the directory, the 0644 file, list-adb-devices, a chmod 755 success control, and an unexecutable adb on PATH. The body says they fail on base. I did not run them.
  • No other open PR targets #5689 (a search on the number found only this one), so there is no overlap to compare. No human has reviewed it yet, so I repeated no one.

Not run

  • No checkout, build, tests or formatter. I ran no REA code.
  • I did not run the two new tests, or the body's E2E on macOS.
  • I did not produce a real EPERM.
  • I did not test a merge with #6150.
  • I did not check Windows.

Thanks, chordpli, for the fix, the clear before and after table, and the honest note about ENOTDIR.

Test setup
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.11
  • Node: 22.23.1 (only for the two small execFile probes; PR code was not run)
  • Head / base: 0d29c0b / 603a7d0 (merge base); main was 9066444

🤖 Written with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

…le-path

# Conflicts:
#	src/adb/AdbConfiguration.ts
Node throws spawn errors other than EACCES, EAGAIN, EMFILE, ENFILE and
ENOENT synchronously from execFile. execFileBytes called execFile inside
its Promise executor, so ENOTDIR or EPERM became a rejection without
capture fields and execFileOutputFailure returned undefined. Consumers
that classify by failure code, such as the adb version probe, could not
see the code, which left the adb EPERM branch unreachable.

Catch synchronous spawn errno errors at the capture boundary and attach
the same empty capture an asynchronous spawn failure carries. Argument
validation errors stay unadmitted.

The adb version probe now reports an ENOTDIR selected path, such as a
REA_ADB_PATH whose parent is a regular file, as a missing binary with
the filesystem error code instead of the generic version refusal.
execFileBytes knows when a command never started, but
ExecFileOutputFailure did not say so, so consumers reread raw syscall
and code fields and disagreed. Mark both the synchronous throw and an
asynchronous `spawn <path>` error with `spawnFailed: true`, and set
`path` on the synchronous error to match the asynchronous shape.
Argument validation errors stay unadmitted.

Consumers now use the owner field:

- inspectAdbClient never reports a spawn errno as `exit_code`. ENOENT,
  ENOTDIR, ELOOP and ENAMETOOLONG are `binary_missing`; EACCES and EPERM
  stay `binary_not_executable`; any other spawn errno, such as EINVAL,
  is `binary_not_executable` with a path-naming "could not be started"
  message. Each records `filesystem_error` and `path_source`. EACCES
  remediation also names parent directory search permission, and EPERM
  remediation no longer names host policy as the only cause.
- DarwinProcessRunTokenReader tags every not-started compiler as
  `spawn_failed`, not only ENOENT. EACCES, EPERM and ENOTDIR were
  previously `failed`.
- NativeDmgArtifactReader uses one not-started rule for both
  `processNotStarted` (previously `spawn ` only, so synchronous errors
  were missed) and the ENOENT unavailable/io split (previously any
  `spawn` prefix). Its fake hosts now reject with real execFileOutput
  spawn failures.
Admit synchronous and asynchronous spawn errnos through one helper that
requires an errno and a `spawn` or `spawn <path>` syscall. The
synchronous shape now also gains `spawnargs`, so both shapes match.

Use the owner's `spawnFailed` fact in the remaining consumers:

- inspectAdbClient reports exhausted host capacity (EAGAIN, EMFILE,
  ENFILE, ENOMEM) as a host failure to retry and no longer tells the
  caller to change REA_ADB_PATH. Path-resolution errnos come from a
  predicate the filesystem owner exports.
- runAdbCapture says adb could not be started instead of claiming an
  exit code for a process that never ran.
- The Darwin compiler probe words every spawn_failed outcome as a start
  failure, not a compilation failure.
- Asset catalog inspection treats any assetutil that never started as
  unavailable, not only ENOENT.
@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Comments Outside Diff

These findings could not be posted inline.

  • P2 Host limits mislabel asset inspection src/artifacts/apple/AppleAssetCatalogAnalysis.ts:448 ▶

    The new spawnFailed check also matches EAGAIN, EMFILE, ENFILE, and ENOMEM. When macOS temporarily runs out of processes, descriptors, or memory, this reports a working assetutil as unavailable. BinarySession then marks inspect_asset_catalog unavailable in its status until a successful retry, without advice to free host resources.

    Handle host-capacity errors separately, such as with AnalysisResourceConstraintError and recovery advice, before the tool-unavailable branch.

Spawn errnos that report exhausted host capacity (EAGAIN, EMFILE, ENFILE,
ENOMEM) were classified by adb readiness alone. assetutil reported them as
an unavailable tool, which marked inspect_asset_catalog unavailable in the
session, and adb commands reported them as protocol failures.

Classify them once in the process capture owner and report a retryable
capacity constraint with recovery advice from assetutil and adb commands.
@chordpli

Copy link
Copy Markdown
Contributor Author

@CassieFox23 Thanks for the careful read. Changes since 0d29c0b3c, head now 62d04edd0:

EPERM branch unreachable (should fix)

  • Root cause: execFileBytes called execFile inside the Promise executor, so the synchronous spawn throws (ENOTDIR, EPERM) became rejections without capture fields, and execFileOutputFailure returned undefined.
  • Fix (your first option): the capture owner now admits synchronous and asynchronous spawn errno failures with the same empty capture and spawnFailed: true (f148871, b3838ba, 6f863f6). Argument validation errors stay unadmitted. Consumers that reread syscall/code themselves (DMG reader, Darwin compiler probe, assetutil) now use that fact.
  • ENOTDIR (REA_ADB_PATH=/file/adb) is now binary_missing with the errno, shown in the head E2E. EPERM is covered by tests that fake the spawn error; I could not produce a real one either.

Template: restored to the template text, including the scope paragraph, "(if applicable)", the generated-metadata note, all Expected effects boxes and the evidence-bearing boxes.

Expected effects: "Documentation or usability only" was wrong. The box checked now is "Launch or attach to a process", with a note that only failure reporting for existing launches changes.

PATH message ends in : adb: the body now says the path is named for REA_ADB_PATH only. Resolving the first PATH match would add a lookup the spawn does not use, so I left it out.

Diagnostics not reaching CLI/MCP (#6094 / #6150): agreed, out of scope here. The message and remediation carry the path on their own.

executable_missing mapping: kept on purpose; the body says so.


@greptile-apps Host limits mislabel asset inspection (AppleAssetCatalogAnalysis.ts:448): valid. I confirmed BinarySession.#observeRuntimeAvailability marks the operation unavailable on AnalysisCapabilityUnavailableError.

  • Root cause: host-capacity errnos were classified only inside inspectAdbClient, so other consumers treated every never-started command alike.
  • Fix (3226dec): spawnCapacityExhausted in ExecFileOutput.ts owns the EAGAIN/EMFILE/ENFILE/ENOMEM set. assetutil and runAdbCapture report a retryable capacity AnalysisResourceConstraintError with recovery advice; inspectAdbClient uses the same predicate.
  • Validation: the 5 new capacity tests fail with the fix reverted and pass with it. Focused adb/process/assetutil/DMG/Darwin files: 345 passed. check:fast and docs:check pass.
  • Remaining cleanup: none in this PR. The DMG reader still maps EMFILE/ENFILE to its existing io reason, which does not mark anything unavailable.

@greptile-apps

greptile-apps Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Thanks for the detailed update. The revised diff addresses the earlier gaps: synchronous spawn errnos are now admitted by the capture owner, host-capacity failures are separated from command failures for adb operations and assetutil, and the documentation and expected-effects checklist now reflect the process-launch scope. The PATH message limitation and executable_missing mapping are clearly explained. I don’t see a remaining actionable issue in these changes.

t and others added 2 commits October 26, 2026 09:51
A host that cannot start adb for lack of process, memory or descriptor
capacity is not a configuration problem. Give it its own failure code and
map it to the runtime_unavailable provider rejection instead of
not_configured.
@chordpli
chordpli requested a review from CassieFox23 October 26, 2026 02:28

@CassieFox23 CassieFox23 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TL;DR: Fixed: synchronous spawn errors keep their code now. So the EPERM and ENOTDIR branches are reachable. The template, Expected effects and PATH points are done. Still open: no test has run on this head. The CI run needs a maintainer to approve it. During the adb version check, a host-capacity failure still comes out as a plain capability_unavailable. Also, issue #5689 was closed on 24 October, so "Fixes #5689" no longer describes what this PR does.

Edit (27 Oct): The author narrowed the PR and pushed more commits after this review. I re-reviewed head 180caed here. The should-fix below is fixed there.

This is a follow-up to my first review. I read the PR's own patch against current main (1173c0a), not the whole range from the old head.

Findings

Should fix

  • At the adb version check, a host-capacity failure is not retryable. This holds on the device-operation path. Every device operation runs inspectAdbClient first. At that step, a host_capacity failure goes to providerConfigurationRefusal. It builds an AnalysisCapabilityUnavailableError without retryable. The source is:

    That class is not retryable unless the caller sets it. So EMFILE at the probe during list-adb-devices comes out as capability_unavailable. The body says device operations report a capacity constraint. The body also says that constraint is retryable. That is true only when the probe already ran and a later adb start fails in runAdbCapture. The runtime_unavailable code from 454f017 appears in one place. That place is the availability check. The source is:

    It matches what Greptile flagged for assetutil. It sits one step earlier. The assetutil case itself is fixed. I read this from the code and did not run it. No test covers the operation path. The capacity test stops at adbConfigurationAvailability. It lives in:

    Either pass retryable: true for this case, or say in the body and docs that readiness refusals are not retryable.

Worth a look

  • No tests have run on this head. The CI workflow run is action_required again, so a maintainer has to approve it. There is no green or red result. Three checks passed. Those are the Greptile review, the author declaration and PR readiness. All of the author's validation is macOS. The ENOTDIR, symlink-loop and PATH cases are POSIX but have not run on Linux anywhere I can see.

  • "Fixes #5689" is stale. The issue was closed as completed on 24 October. Main's 57e3e0b had already added binary_not_executable. It covers EACCES and EPERM. It also passes diagnostics through the refusal. That was the gap in #6094. My first review said main still had the bug. That was true at 9066444, the main I checked. Main's 57e3e0b was committed at 6:29 PM UTC on 23 October. That is two minutes before I posted, and I missed it. What this PR still adds is ENOTDIR, ELOOP and ENAMETOOLONG as "not found", the host-capacity split, and one shared "never started" fact. The body's first lines already say this. Please change the "Fixes" line and the title to match, or link an issue for the remaining cases. No open issue tracks them that I found.

  • The template gained a paragraph on 25 October (efab65c). It came after my first review. The new text reads:

    "For boundary fixes, identify the applicable boundary regressions and lifecycle regressions covered by the evidence above, and explain relevant gaps."

    The body lacks it. It fits now that the change is in the process capture boundary. The matching rows are in docs/testing.md. They are probably these two:

    • "Missing, empty, and unknown values"
    • "Public success and error delivery"

    Everything else in the template matches main word for word.

  • The shared helper has about ten other callers. This PR does not touch or test them:

    • Doctor
    • LinuxHopper and its publisher and Python runner
    • Ghidra Java launch
    • BridgeLauncher
    • HopperMacPublisher
    • NativeUiHelperRuntime
    • ProcessOwnershipObservation
    • ProcessSampling

    After this change, a synchronous spawn throw reaches them. It comes with empty stdout and stderr fields. Before, it had none. I read Ghidra's two uses of execFileOutputFailure. A search for ENOENT and syscall found only direct reads. They read code directly. Those are in these places:

    • LinuxHopper
    • Its publisher
    • ProcessOwnershipObservation

    A synchronous throw still carries code. That is a search, not a full read, and I ran nothing. The body's Expected effects note names these:

    • adb
    • assetutil
    • hdiutil
    • the Darwin compiler

    The note could say the helper is shared.

Nits

  • The comment in the new catch names ENOTDIR and EPERM as the synchronous cases. Also, ENOMEM is synchronous-only. In v22.23.1, Node's async list is:

    • EACCES
    • EAGAIN
    • EMFILE
    • ENFILE
    • ENOENT

    I found the same list in v24.18.0 and v24.19.0. The code handles it correctly. One more word in the comment would stop a reader thinking ENOMEM is dead.

  • The DMG reader's processNotStarted now trusts only the owner's marker. A hand-built { code, syscall } error from an injected host no longer counts as "not started". Two existing tests were rewritten to use a real spawn failure. The only non-test host is createSystemHost, so production is unaffected.

Looks good

  • EPERM is reachable now. Also, execFileBytes wraps execFile in a try. It gives a synchronous spawn error an empty capture. That matches what an asynchronous one carries. admitSpawnFailure checks only for a numeric errno and a spawn syscall, so EPERM takes the same path as ENOTDIR. A real synchronous ENOTDIR is tested through execFileOutput. The EPERM case has its own test. It fakes a rejection at the execFileOutput boundary. The test is in AdbVersionProbe.test.ts L92. No test fakes EPERM at the execFile layer, which is fine given the shared path.
  • Bad arguments are not admitted. Those errors carry no errno, and a test with a NUL byte checks that execFileOutputFailure still returns undefined. A non-zero exit has no syscall, so it is not marked either.
  • ENOTDIR now comes out as binary_missing with the errno. See isUnresolvedPathErrorCode in inspectAdbClient, the CLI test for ${file}/adb and the macOS E2E in the body. A never-started adb no longer reports an exit_code (L139).
  • The capacity set fits Node. EAGAIN, EMFILE and ENFILE arrive as an async error event, and ENOMEM is thrown synchronously. Both ways end in spawnFailed, so one predicate covers all four. Commit 454f017 is small (3 files, 17 added and 3 removed lines) and uses the same predicate as 3226dec. It only adds the host_capacity code and its runtime_unavailable mapping.
  • Greptile's assetutil point is fixed in 3226dec. Greptile now reports nothing left.
  • The body is better. It restores the template text, checks "Launch or attach to a process" with a note, and says the path is named for REA_ADB_PATH only. It keeps the PATH limit as a stated "not included". The executable_missing mapping from my first nit is gone. The PR now uses main's not_configured, and the body says so.
  • Interdiff check: this head contains current main. So the merge base is main itself. The 15 files, +642/-108, are all the PR's own.

Still not run

  • No checkout, build, tests or formatter. I ran no REA code and none of the new tests.
  • I did not run the macOS E2E, and I did not check Windows.
  • I did not produce a real EPERM or a real capacity failure.
  • I did not read every caller of the shared helper.

Thanks, chordpli, for the point-by-point reply. Thanks also for fixing the synchronous spawn case at its source.

Test setup
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.11
  • Node: none run this round (Node's child_process source was read from GitHub)
  • Head / base: 454f017 / 1173c0a (merge base, equal to main)

🤖 Written with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

A device operation whose adb version probe could not start for lack of host
capacity was refused as capability_unavailable without retryable. It now
reports the same retryable capacity constraint as a later adb command.
@chordpli chordpli changed the title fix(adb): name unexecutable adb paths in readiness refusals fix(adb): separate unresolvable paths and host capacity in adb spawn failures Oct 26, 2026
@chordpli

Copy link
Copy Markdown
Contributor Author

@CassieFox23 Thanks for the follow-up. Head is now 3a964f0d8.

Probe-time host capacity not retryable (should fix): valid.

  • Root cause: inspectAdbClient already classified host_capacity, but the operation path sent every AdbConfigurationFailure to providerConfigurationRefusal, which carries no retryable. Only a capacity failure at a later adb command reached the capacity constraint.
  • Fix: adbSpawnCapacityError in AdbCommand.ts is now the single capacity constraint. runAdbCapture and the operation path's version-probe catch in AdbProvider.ts both use it, so list_adb_devices with EMFILE at the probe is a retryable resource_constraint with the same remediation. Readiness (inspectAvailability) stays a runtime_unavailable rejection.
  • Validation: a new AdbProvider.test.ts case fails with the AdbProvider.ts change reverted (capability_unavailable) and passes with it. All src/adb tests plus ExecFileOutput and assetutil: 314 passed, 1 skipped. adbCli.test.ts: 36 passed. check:fast and docs:check pass. docs/adb-device-analysis.md now says this applies at the version probe too.

"Fixes #5689": replaced with a follow-up note saying 57e3e0b04 closed it and that no open issue tracks the remaining ENOTDIR/ELOOP/ENAMETOOLONG and capacity cases. The title now reads "fix(adb): separate unresolvable paths and host capacity in adb spawn failures".

Template paragraph: added under Evidence. It names "Missing, empty, and unknown values" and "Public success and error delivery" with their gaps: MCP is not exercised separately, and capacity is covered at provider and module level only. Lifecycle regressions are marked not applicable.

Shared helper: the Expected effects note now says execFileBytes is shared, names its other callers and says they were searched, not individually tested.

ENOMEM comment: the catch comment now lists ENOMEM among the synchronous cases.

DMG processNotStarted: no change. As you noted, production has only createSystemHost.

CI: still action_required; it needs a maintainer to approve the run.

Comment thread src/adb/AdbProvider.ts Resolved
The retryable capacity constraint raised at the version probe dropped the
selected_binary and path_source diagnostics the refusal used to carry.
@chordpli
chordpli requested a review from CassieFox23 October 26, 2026 06:39
@morluto

morluto commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Thank you for documenting the cases beyond #5689. I am keeping this PR open: its scope includes synchronous ENOTDIR spawn failures and host-capacity errors, as well as a shared process-owner fact consumed beyond the original adb permission fix. On main at ca3fd7b, ExecFileOutputFailure does not expose the proposed spawnFailed fact. If you would like to continue, could you focus the diff and tests on the remaining start-failure and capacity cases? This is a source comparison, not a reproduction of the affected host failures.

Restore the DMG reader, Darwin compiler probe and assetutil to main. The
capture owner still marks a never-started command, including the spawn
errors Node throws synchronously, and only the adb readiness probe and
adb commands read that fact.
# Conflicts:
#	src/process/ExecFileOutput.ts

@CassieFox23 CassieFox23 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TL;DR: Round 2's one should-fix is fixed. EMFILE at the adb version check is now a retryable resource_constraint. A sync ENOTDIR or EPERM now counts as a spawn failure. All 217 tests in the PR's five test files pass on Linux, on Node 22, 24 and 26. On main's source, 9 of the 11 new tests fail. I have no should-fix left, only four nits.

Edit (2 Nov): The author pushed more commits after this review, with fixes for all four nits. I reviewed head 8151d0a again here. I have no should-fix.

This is round 3, on 180caed. It follows my round 2 review. I read the PR's own patch against its merge base a95b83c and compared it with the round 2 patch.

Findings

Should fix

  • None.

Nits

  • The docs paragraph opens with "Readiness is rea inspect-adb-client" (docs L25-L41). Then it calls host capacity a runtime_unavailable rejection. The inspect_adb_client operation runs the same version probe as the device operations. So with EMFILE there it comes out as a retryable resource_constraint. I checked with a scratch test that is not part of the PR. inspect_adb_client gave resource_constraint with retryable: true. runtime_unavailable came only from inspectAvailability. No PR test runs inspect_adb_client under capacity. One clause in the docs would settle it.
  • That error also gives two different hints. remediation.action ends with "then retry." The copy in diagnostics.remediation adds "REA_ADB_PATH does not need to change". They come from the command and the provider. It is harmless, but one text would read cleaner.
  • The unit test for a sync throw runs without stopSignal (the test). So it takes the execFile path. Adb always passes stopSignal: "SIGTERM" (here and here). That takes the spawn path. Only the CLI test covers a real ENOTDIR on that path (adbCli.test.ts L184-L205). My scratch test ran a real ENOTDIR with stopSignal, and a faked EPERM and ENOMEM on both paths. Each was admitted with an empty capture and spawnFailed: true. A stopSignal variant of the unit test would pin it.
  • execFileBytes is still shared. A synchronous spawn throw now reaches its other callers with an empty capture and a string code. The body says so, and says those callers were searched, not tested. CI covers their old behavior only. I did not run any of them with a synchronous throw. This is fine to leave.

Looks good

  • The round 2 should-fix is fixed in 3a964f0 and 8752d6e. The provider now sends host_capacity at the probe to adbSpawnCapacityError. It keeps the diagnostics too. A new test covers it for list_adb_devices. That test fails on main's source.
  • Both new Greptile threads are real, and both are fixed. "Failed probe loses its path" is fixed by forwarding cause.diagnostics, and the test asserts selected_binary, path_source and filesystem_error. "Wording edits break tests" is fixed in the three files it named. They now assert codes and fields, not sentences.
  • The narrowing holds. Outside the owner in ExecFileOutput.ts, git grep at 180caed finds spawnFailed and spawnCapacityExhausted only under src/adb. RegularFile.ts adds one export, isUnresolvedPathErrorCode, over the same errno set. The DMG reader, the Darwin compiler probe and assetutil are main's again. Main has 14 newer commits, and none touch the PR's files.
  • The ENOTDIR and EPERM paths work. A real synchronous ENOTDIR is admitted and reported as a missing adb. EPERM is still faked in the PR's own tests, but the faked errors in my scratch test came out the same way.
  • The body is in good shape. It says "Follows up #5689". It fills in the regression paragraph. It ticks the "Launch or attach to a process" box. CI is green on this head, all 8 Linux shards included. I read that from GitHub and did not run it.

Still not run

  • The macOS built-CLI E2E from the body, and Windows.
  • A real EPERM and real host-capacity exhaustion (a real EMFILE ran in round 4; a real ENFILE, ENOMEM and EAGAIN still have not). My scratch test fakes them at node:child_process.
  • Tests of the other execFileBytes callers (Ghidra, Doctor, hdiutil and so on).
  • The rest of the suite, typecheck, lint and format.

Thanks, chordpli, for narrowing the PR and for the quick fixes.

Test setup
  • Where: Fedora 44 VM (4 vCPUs, 8 GB, kernel 7.2.11) on my Nobara 44 box, offline
  • Node: 22.23.4, 24.22.1, 26.12.1
  • Install: npm ci --offline and npm run test:prepare on Node 24.22.1
  • Head / base: 180caed / a95b83c (merge base; main was 40b9c03)
  • Other: rea-agents 6.8.0, g++ 16.2.1
Commands

All of these ran in the VM, from ~/pr-6188/src, as a normal user. Times are wall clock.

Command Exit Time
npm ci --offline (Node 24.22.1) 0 23 s
npm run test:prepare (Node 24.22.1) 0 14 s
npm run test:focused -- src/adb/AdbCommand.test.ts src/adb/AdbProvider.test.ts src/adb/AdbVersionProbe.test.ts src/process/ExecFileOutput.test.ts tests/boundary/cli/adbCli.test.ts on Node 24.22.1 0 (5 files, 217 tests passed) 43 s
the same command on Node 22.23.4 0 (217 passed) 43 s
the same command on Node 26.12.1 0 (217 passed) 43 s
the same command with main's versions of the five changed source files (a95b83c), Node 24.22.1 1 (9 failed, 208 passed) 53 s
scratch tests, not part of the PR, on Node 22.23.4, 24.22.1 and 26.12.1 0, 0, 0 2 to 3 s each

The nine that fail against main's source: 2 in AdbCommand.test.ts, 1 in AdbProvider.test.ts, 2 in AdbVersionProbe.test.ts, 2 in ExecFileOutput.test.ts and 2 in adbCli.test.ts. The two new tests that pass against main are the EPERM naming test and the argument-validation test, because main already names EPERM and never admitted that error.

🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

The host-capacity constraint and the configuration failure each carried their own remediation sentence. AdbConfiguration now owns the text and both use it, so the constraint's remediation.action equals diagnostics.remediation.

The synchronous spawn-throw test now runs on Node's execFile route and on the owned spawn route adb uses (stopSignal). The provider test covers inspect_adb_client under EMFILE next to list_adb_devices, and the docs say which operations report the retryable capacity constraint and which report runtime_unavailable.
@chordpli

Copy link
Copy Markdown
Contributor Author

@CassieFox23 Thank you for round 3. Head is now 0da410cd4; the merge base (main a95b83c2b) is unchanged.

  • Docs clause: the readiness paragraph now says that inspect_adb_client and the device operations report the retryable capacity constraint, and that the binary_session inventory is where host capacity shows up as runtime_unavailable (docs/adb-device-analysis.md). The provider test for EMFILE at the probe now runs inspect_adb_client next to list_adb_devices and asserts resource_constraint / retryable: true for both, so this is covered by a PR test rather than a scratch one.
  • Two hints: one text now. adbHostCapacityRemediation(code) lives in AdbConfiguration.ts, the configuration failure's diagnostics.remediation and adbSpawnCapacityError's remediation.action both call it, and the provider test asserts the two strings are equal.
  • stopSignal variant: the ExecFileOutput synchronous-throw case is now it.each over the execFile route (no stopSignal) and the owned spawn route (stopSignal: "SIGTERM", as adb passes it), with a real ENOTDIR and the same assertions.
  • Other execFileBytes callers: left as is, as you suggested; the body still records that they were searched, not tested.

Validation at 0da410cd4 (macOS 26.5.2, Node 24.22.1): npm run test:focused -- on the same five files — 218 passed (217 plus the spawn-route case); npm run check:fast and npm run docs:check passed. Linux and Windows were not run locally.

@chordpli
chordpli requested a review from CassieFox23 October 28, 2026 13:02
Comment thread src/process/ExecFileOutput.ts Resolved
After an EMFILE or ENFILE spawn failure Node creates no stdio, so the
owned stop-signal route threw a TypeError while reading the streams and
the later spawn error went unhandled. Attach the error listener first and
capture absent streams as empty, so adb reports retryable host capacity.
Comment thread src/adb/AdbCommand.ts Resolved
…heck

A capacity failure starting sha256sum came back as a retryable error even
though adb push had already written the file. Repeating the request with
overwrite=false is then refused because the destination exists.

Return the receipt with an unavailable device digest and name the capacity
failure in its limitations, so the caller is told the transfer is unverified
rather than advised to retry.
…le-path

Restore the files the pre-commit hook reformatted in c68f0da to main's
content, so the branch again changes only the adb and spawn-failure files.

@CassieFox23 CassieFox23 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TL;DR: The push fix, 3b92767, is covered by a new test, and that test fails on the code before it. Running out of open files now gives a capacity error you can retry, not a crash. A new test and my own probe both show it. All four of my round 3 nits are handled, and I have no should-fix, only one docs nit.

This is round 4, on 8151d0a. It follows my round 3 review. Main (b912ec1) has none of this change. git grep for adbSpawnCapacityError, spawnCapacityExhausted, spawnFailed and host_capacity under src finds nothing there. Main's stoppable command still reads child.stdout!. Main's adb command still reports a spawn failure as "adb exited with code".

Findings

Should fix

  • None.

Nits

  • The docs list the cases where a push is reported as unverified: a missing sha256sum, or output with no digest (docs L222-L225). Host capacity at the digest check is now a third case, and the docs do not say so. One clause would do.

Looks good

  • The push fix, 3b92767, is covered. The new test fakes EMFILE at the sha256sum step and expects a receipt with device_digest_source: "unavailable" and a limitation that names EMFILE. I put the provider file from just before the fix back in the VM and ran AdbProvider.test.ts on Node 24. One of 108 failed, and the error was a retryable resource_constraint for push_adb_file. With the fix, it passes. The fix is narrow. The digest step goes through runAdbCapture. Its only other constraint, the output limit, is a memory one, so a capacity constraint there can only come from adbSpawnCapacityError. Greptile found this problem first, and the author agreed. I did not run the repeat with overwrite: false.
  • Hitting the real open-file limit works now. Greptile also found that EMFILE on adb's stopSignal route crashed. The fix, b08e27e, attaches the error listener first and treats missing stdio as empty. The new boundary test, adbDescriptorPressure.test.ts, uses a real ulimit -n 64. It passes on Node 22, 24 and 26. With ExecFileOutput.ts put back to its version just before that fix, that one test fails with an unhandled spawn ... EMFILE, and the other 228 pass. This closes the "real host capacity" item I left in Not run last round.
  • My own probe agrees, and it adds the lifetime-pipe route. Under ulimit -n 64, execFileOutput with no stopSignal, with stopSignal, and with stopSignal plus lifetimePipe each gave code: "EMFILE", spawnFailed: true, an empty capture and spawnCapacityExhausted true. Once those were freed, both routes started a process again. The output was identical on Node 22.23.4, 24.22.1 and 26.12.1.
  • My four round 3 nits are handled. The docs now say inspect_adb_client reports the retryable constraint (docs L33-L38). The provider test now runs both operations. The two hints are one text, from adbHostCapacityRemediation in AdbConfiguration.ts L28. The sync-throw test now runs on both routes. The fourth nit, the other execFileBytes callers, was left as we agreed.
  • All 229 tests in the PR's six test files pass on Node 22.23.4, 24.22.1 and 26.12.1. The count was 217 in five files last round. Per file: AdbProvider.test.ts 106 to 108, ExecFileOutput.test.ts 46 to 48, adbCli.test.ts 36 to 43, the new descriptor file 1, the other two unchanged. The push test, the second route case and the descriptor test are the PR's own three. I did not trace the other nine, which sit in files main also changed. No adb device was needed: the VM has none, and all 229 passed.
  • With main's copies of the five changed source files, 12 of the 229 fail. Those are the capacity, spawn-failure and CLI tests, the new push test and the descriptor test. The rest pass, so the new tests do test the change.
  • CI is green on this head, all 8 test shards included. I read that from GitHub and did not run it.

Still not run

  • macOS and Windows. The author ran macOS locally.
  • A real ENFILE, ENOMEM or EAGAIN. The PR's tests fake them, and my probe made only a real EMFILE.
  • The repeat push_adb_file with overwrite: false after the old behavior. The author's note on this is source-derived, and so is mine.
  • Anything after a mutating step in install, uninstall, start and stop. The author says none runs another adb command. I only listed the call sites.
  • The other execFileBytes callers under EMFILE.
  • The rest of the suite, typecheck, lint, format and the other test:built shards.

Thanks, chordpli, for taking all four nits and for the real EMFILE test.

Test setup
  • Where: Fedora 44 VM (4 vCPUs, 8 GB, kernel 7.2.11) on my Nobara 44 box, offline
  • Node: 22.23.4, 24.22.1, 26.12.1
  • Install: npm ci --offline and npm run test:prepare on Node 24.22.1
  • Head / base: 8151d0a / 8250bf2 (merge base; main was b912ec1)
  • Other: rea-agents 6.8.0, g++ 16.2.1
Commands

All of these ran in the VM, from ~/pr-6188/src, as a normal user. Times are wall clock.

Command Exit Time
npm ci --offline (Node 24.22.1) 0 19 s
npm run test:prepare (Node 24.22.1) 0 14 s
npm run test:focused -- src/adb/AdbCommand.test.ts src/adb/AdbProvider.test.ts src/adb/AdbVersionProbe.test.ts src/process/ExecFileOutput.test.ts tests/boundary/cli/adbCli.test.ts tests/boundary/process/adbDescriptorPressure.test.ts on Node 24.22.1 0 (6 files, 229 tests passed) 26 s
the same command on Node 22.23.4 0 (229 passed) 29 s
the same command on Node 26.12.1 0 (229 passed) 25 s
AdbProvider.test.ts alone, with AdbProvider.ts from just before 3b92767, Node 24.22.1 1 (1 failed, 107 passed) 3 s
test:prepare, then the six files, with ExecFileOutput.ts from just before b08e27e, Node 24.22.1 1 (1 failed, 228 passed) 14 s + 25 s
test:prepare, then the six files, with main's five changed source files (b912ec1), Node 24.22.1 1 (12 failed, 217 passed) about 15 s + 26 s
scratch probe, not part of the PR, run under ulimit -n 64 on Node 22.23.4, 24.22.1 and 26.12.1 0, 0, 0 about 1 s for all three

The scratch probe called execFileOutput on /bin/true after opening descriptors until EMFILE. It tried three routes: none, stopSignal, and stopSignal with lifetimePipe. It then released the descriptors and ran two more.

🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

@chordpli

chordpli commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@CassieFox23 Thanks for round 4, and for re-running the pre-fix files to confirm the new tests actually catch the regressions.

Docs nit: fixed in a3f2d6caf. The push paragraph in docs/adb-device-analysis.md now lists host capacity at the digest check as the third unverified case, next to a missing sha256sum and output without a digest. It also says that this case is reported as an unverified-transfer limitation, not as a retryable error, which matches pushFile. Docs only, no code changes. npm run docs:check passes locally.

@chordpli
chordpli requested a review from CassieFox23 November 3, 2026 03:59
@morluto

morluto commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Hey @chordpli, thanks for this! The fix looks good. What's left: it has merge conflicts with main in src/adb/AdbCommand.test.ts and src/adb/AdbCommand.ts (merging main into the branch is fine) and the Static checks check is failing. Happy to merge once that's sorted.

@chordpli

chordpli commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @morluto! I merged main and resolved the conflicts in src/adb/AdbCommand.ts and src/adb/AdbCommand.test.ts, keeping both sides. Static checks is passing now too. It was failing on website/wrangler.toml, which main has since fixed. CI is green on 16b272d00, so this is ready whenever you are.

@morluto
morluto merged commit 92f3326 into morluto:main Nov 5, 2026
47 of 49 checks passed
gensokyo-dev added a commit that referenced this pull request Nov 5, 2026
* refactor(mcp): share official tool evidence registration

Route official tools through registerEvidenceTools and remove the duplicate
execution, progress, and Evidence delivery pipeline.

Preserve relationship coverage in the shared path and reuse the existing
source Evidence recording helper.

Validation: typecheck and 29 focused MCP tests passed.
Real native providers were not exercised.

* fix(mcp): support retained pseudocode summaries and paging

Allow procedure_pseudo_code to return an opt-in summary linked to its
retained complete Evidence. Extend inspect_analysis_view to page the
original pseudocode without repeating provider analysis.

Preserve default complete output and exclude delivery detail from
provider parameters and source Evidence identity.

Add regression coverage for large results, Unicode, null and empty
output, missing retention, transport-overflow recovery, and CLI paging.

Validation: 178 focused tests, build, check, docs:check, and test discovery
passed. Real stdio simulation reconstructed 98,000 code units exactly.
Real Ghidra, iTunes, and Claude Code verification remains unavailable.

Fixes #5032

* test(mcp): scope pseudocode contract lookup to official tools

* feat(desktop): capture and export apps installed from a downloaded .deb (#8954)

* feat(desktop): capture a Linux desktop application in use

Add `capture-desktop-application`, a CLI-only, Linux and X11 capture that
launches an installed desktop application, watches it while it is used and
writes capture Evidence plus SHA-256 addressed content:

- inventory: desktop entry, launch command, executable, package and its
  apt sources (or snap, flatpak, AppImage), Electron markers and candidate
  state directories;
- session: the launched process tree, client windows from xprop with the
  first application window time and a window match, and files held open;
- state: a stat walk of the home directory before launch, at checkpoints
  read from stdin, at stop and after exit, with created, modified, deleted
  and retyped paths and the content of changed files and state directories.

It refuses non-Linux hosts, missing DISPLAY or xprop, a non-empty output
folder and an application whose window is already open, and signals only
processes it started.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): own launched processes, confirm walk coverage and keep cancelled captures

- Launch through the owned provider path with a run token; release with
  SIGTERM, then the token-verified group cleanup, after every session.
  Processes without the token are never signalled; each records whether it
  carries it, and the session records whether cleanup was verified.
- Report creations and deletions only where a walk listed the nearest
  existing directory; count the rest as unconfirmed.
- Retain a file only when it is still the walked version, through owned
  no-follow reads; charge the budget only for new content; create files
  exclusively in a private output folder owned by the caller.
- Walk content roots outside the home directory, compare paths in their
  physical spelling, and run executables from the caller's directory.
- Refuse when the window list cannot be read, re-evaluate window ownership
  each sample, handle one queued request per sample with a bounded stdin
  queue, and write the capture with end reason `cancelled` on interruption.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): keep owned cleanup failures and fresh digests

- Allow a capture cancelled before any requested checkpoint to hold only the
  baseline.
- Retry an incomplete stop once; if cleanup is still unverified, write the
  capture and fail with the run token and process group as cleanup
  resources.
- Classify path changes after a walk (ENOTDIR and other selected-file
  errors) as changed_since_walk instead of failing the capture.
- Treat a non-directory ancestor as proof that nothing existed beneath it.
- Report a before digest only for the file version it was read from.
- Derive stderr_truncated from stderr's own byte counts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* wip(desktop): state view over a capture folder

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): keep failed file-handle closes owned for retry

Content reads pass retainFailedClose, so a handle whose close fails stays
owned by the content store; the capture retries those closes after it is
written and fails with the output folder as the cleanup resource if one
still cannot be closed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(desktop): read a captured application's state

Add inspect-desktop-application-state, a CLI command that reads a capture
folder into the application's state: every retained or changed file with
its role and reasons, a typed JSON view of each version (SQLite through the
shared worker, dconf through a private dconf dump, JSON, XML, key files,
text) and the kinds of change between versions (lines, values, keys, rows).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): report process and handle cleanup failures together

When both the launched processes and a retained file's handle remain
unresolved after the capture is written, one cleanup error now lists both
reasons and both resource sets.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(desktop): export a captured application as an agentenv computer app

Add export-desktop-application, which writes an agentenv bundle with one
computer_app environment from a capture folder and its state view: the
apt package, a boot launch matched on the captured window class with a
window ready check, owned paths from the state roles, a seed of the
baseline files, data hooks that call agentenv's add/get/reset helpers
with a typed JSON view on get, a skill, a README and a deploy smoke task.
The desktop CLI commands now load their services lazily.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): keep state views faithful to the capture

- Read key files, XML attributes, dconf groups and SQLite tables into
  dictionaries without inherited properties, so captured keys such as
  __proto__ stay data.
- Version databases with their write-ahead log as of each checkpoint, and
  stage only digest-verified bytes for the SQLite and dconf readers.
- Detect the format per version, report format changes, keep JSON null and
  empty containers as values, keep XML text and preserved whitespace, and
  mark truncated views (including XML depth) and comparisons of them.
- Number versions and changes by checkpoint index, decide baseline
  presence from the captured type, and keep tagged SQLite integers, text
  bytes and blobs distinct.
- Carry the capture's limitations and omitted content forward, match state
  directories by their home path, index changes once per capture, keep
  failed handle closes owned, and finish the CLI through the shared owner.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): keep coverage, logs and handles honest in the state view

- Read coverage flags only from formats whose readers write them, so JSON
  fields named truncated stay data.
- Fail a SQLite version whose write-ahead log existed but was not retained
  or does not match its digest, instead of reading the database alone.
- Close retained content on every exit, including cancellation, and report
  a close that still fails together with the primary failure.
- Finish the CLI with the canonical operation name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): export only what the computer can install and seed

- Refuse packages not from the Ubuntu 24.04 archive, since the computer
  installs by name from that archive.
- Start the launch command in the captured working directory.
- Respell the home path only in files the state view read as text.
- Report files that were not retained instead of dropping them silently.
- Load captured dconf keys for apps that own no files.
- Keep home-level files as owned paths; rename reserved Python class names.
- Mark truncated SQLite and text views in the class's get view, and read
  file types the way the state view does.
- Release the output tree through a resource scope, and read seeds through
  an owner closed on every exit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): keep staged folders owned, symlinked state roots and XML values

- Stage database bytes in a private runtime root released through a
  resource scope, so a failed removal keeps its owner and is reported with
  the read's outcome.
- Report cleanup facts and owners from desktop failures instead of
  wrapping them as a plain adapter error.
- Record the state directories as walked, in their physical spelling, and
  match roles against both spellings, so files in a symlinked state
  directory are not mistaken for selected documents.
- Keep whitespace-only XML leaf values; drop only formatting between
  elements.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): read XML in the exported app the way the state view does

Keep whitespace-only leaf values and xml:space="preserve" text in the
generated get view; drop only formatting between elements.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): release retained handles with their owners, read older captures

- Release retained-content handles whose close failed through a resource
  scope on every exit; a release that fails again reports the exact handle
  owners. A read that finished keeps its bytes when only its close failed.
- Accept captures written before state directories were recorded, and say
  in the state view's limitations that symlinked state directories may be
  misclassed for them.
- Compute each XML element's whitespace context once instead of scanning
  siblings for every text run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): boot without the working folder, bound XML, accept mirrors

- Try the captured working directory only when an argument is relative,
  and start the app even when that folder is missing.
- Cut the generated XML view at REA's node and depth limits, and keep one
  unreadable file from failing data/get.
- Accept Ubuntu 24.04 mirrors, not only the canonical hosts; PPAs and
  other repositories are still refused.
- Read seeds through the retained-content owner's new signature.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): state view review round

- Stage a retained -journal beside its database so the SQLite worker
  accepts an inactive journal and refuses a hot one; a -wal or -journal
  that existed but was not retained (including one omitted at the
  baseline) makes the version unreadable.
- Keep tables that read when another fails, and let cancellation and
  unfinished cleanup propagate instead of becoming view errors.
- Read text as a key file only when every line parses as one.
- Rank a file named in a window title or selected by the caller as a
  document even when the application holds it open; match titles on
  file-name boundaries; leave the display name out of dconf matching.
- Bound JSON and key file views (4 MiB, 500 levels, exact numbers) and
  report too-large, missing and altered retained content separately.
- Add no version or change while a database stays absent.
- Read staged databases in place instead of copying them again.
- Give Evidence the same limitations as the result.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): export review round

- Load captured dconf keys without D-Bus: install dconf-cli, compile the
  existing and captured key files into the user database, and warn on
  failure instead of stopping the server.
- Start relative-argument launches in the captured working directory,
  the home included, since the framework launches from the app folder;
  respell the home itself and option values under it.
- Read views in a thread, skip files over 64 MiB, align the generated
  readers with the state view's, and close SQLite connections.
- Never own the home or a shared base folder; map a symlinked state
  directory's files back to their home spelling.
- Report omitted files and unretained opened folders.
- Name the module so it cannot shadow another, and keep the class off
  the module's own names; derive names the bundle check accepts.
- Write seeds as they are read, and remove an unpublished bundle on
  failure.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): capture review round

- Ask the launch process group and token carriers to exit before
  killing them, on errors too; report incomplete cleanup with its facts.
- Count descendants of the launch as started by the capture even when
  their environment cannot be read; treat a reused pid as a new process.
- Follow symlinked desktop entries; name a flatpak's state after its
  application id; match flatpak windows by name only.
- Stop on end of input; refuse empty, duplicate and reserved checkpoint
  names; require whitespace after the checkpoint keyword.
- Stay on each walk root's device, and never walk or retain `/` or a
  directory containing the home; say so in the limitations.
- Refuse a window manager that does not publish _NET_CLIENT_LIST.
- Remove retained content when a capture fails before it is written.
- Skip reading a file larger than the remaining content budget.
- Record apt's archive origin for each package source.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): read an unset client list as no windows when supported

xfwm4 leaves _NET_CLIENT_LIST unset while it manages no windows, so the
capture refused an ordinary desktop with nothing open. Read
_NET_SUPPORTED with the list: an unset list means no windows when the
window manager supports it, and the capture is refused only when it
does not. `xprop`'s "no such atom" output now reads as unset too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): accept packages by apt's archive origin

Accept a package source when apt reports its origin as Ubuntu for a
noble suite, so mirrors count and PPAs or other repositories that merely
have "ubuntu" in their URL do not. Captures made before origins were
recorded fall back to Canonical's own archive hosts. Seed reads report
why retained content could not be used.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(desktop): capture and export apps from vendor apt repositories

A closed-source app installed from its vendor's apt repository, such as
Typora, can now be captured and exported as a computer app.

- The capture records each non-Ubuntu repository listing the installed
  version (uri, suite, components from apt's sources files, one-line or
  deb822) and the key that signs it: the signed-by key, or the trusted
  key that gpgv shows verifies the repository's signed index. The key
  is retained with the capture.
- The capture records the packages owning the libraries the executable
  loads (DT_NEEDED with RUNPATH and the linker cache, through REA's ELF
  readers), since a vendor package may not depend on them.
- The export declares a verified vendor repository as an AptSource with
  its key, installs a vendor package's library packages, and adds
  --no-sandbox to an Electron app's launch, since a container denies
  Chromium's sandbox.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): report a locked database at once in data/get

A database the running app holds locked made each data/get wait sqlite's
five-second busy timeout before reporting it. Record the Typora run in an
agentenv computer in the verification.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* perf(desktop): detect key files without splitting the whole text

Read lines one at a time and stop at the first that a key file view
would drop, instead of splitting a file of up to 64 MiB into arrays
before its format is known.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): keep symlinked homes and state folders under the home in exports

- Respell a path under its state folder's logical spelling only when that
  spelling is under the captured home, so a symlinked HOME keeps its
  files; pair walked and logical state folders only when the capture
  lists the same number, and match the innermost folder first.
- When two files map to one home path, keep the one present before the
  capture and name the other in the limitations.
- Read key files in the generated data/get with the state view's rule,
  checked against it by running the helper under python3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): end captures on zombies and keep cleanup owners

- A zombie or dead process no longer keeps the session open.
- Remove only the partial capture file this run created.
- Keep the exact owners of handles and processes whose cleanup failed on
  the returned error, so a retry can release them; test the published
  capture's cleanup-failure branch with mixed outcomes and retries.
- Release the application once even when the exit checkpoint fails.
- A cancellation before the capture is written removes what it retained.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): vendor package review round

- Match apt sources through `apt-get indextargets`, which covers flat `./`
  and `/` suites and gives each release file and sources entry.
- Accept a key whose signature verifies even when the release carries
  another signature without a key here; keep only the verifying key from
  a keyring holding several (OpenPGP packet splitter).
- Install the package from its repository's release (`name/<release>`),
  declare one source per URI and suite, support only the capture host's
  architecture, and refuse Ubuntu Pro repositories.
- List only library packages the computer can install; walk libraries only
  for vendor installs, with RPATH inherited as ld.so does, normalized
  paths, and DT_NEEDED bounded while reading.
- Put --no-sandbox after the program an env wrapper launches; keep the
  gpgv folder's owner when its removal fails; respect --max-file-bytes for
  keys; wait 0.25 s on a busy SQLite database in data/get.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(desktop): keep the vendor spec's gpgv command on one line

A code span broken across lines left `<binary keyring>` for VitePress to
read as an unclosed HTML tag, so the docs build failed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(desktop): add a validated task to exported desktop applications

Each capture can now yield one agentenv task in its exported bundle. An
agent writes the task (a prompt plus declarative checks over the app's
data/get views); REA validates it and stays model-free.

- `describe-desktop-application-task` summarises a capture's net change
  per file (role, format, views before and after) and drafts checks.
- Checks: file presence, lines present/absent/counted, JSON-pointer values,
  SQLite rows and counts. REA keeps a task only if a check fails on the
  seed and every check passes on the captured end state; a file that was
  not retained at the baseline counts as absent, as the computer starts.
- `export-desktop-application --task` writes tasks/NAME.json (deploy,
  agent, skills, recording, prompt, verifier), a compiled verify.py that
  reads data/get, and an eval. A boundary test runs the verifier under
  python3 and checks it agrees with REA's evaluator on every check kind.
- Docs, spec and skill guidance, with the solve-rate recipe.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(desktop): keep the seed test in its own block

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(desktop): record the task verifier driven in an agentenv computer

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(desktop): record the Typora task run in an agentenv computer

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): keep task checks bounded, complete and attributable

- line_count counts lines holding a substring (contains) instead of
  matching a regular expression, which could stall the verifier on
  agent-written text and read differently in Python.
- value_equals of a whole object or array is undecided on a truncated
  view.
- The draft keeps a database whose rows changed under an unchanged hash,
  and a file whose truncated views match while it changed.
- A task file that cannot be read keeps the reader's detail, and a failed
  cleanup keeps the read failure as its primary.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): leave a file with one version out of the task draft

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(desktop): update the task verification's test counts

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(desktop): record the task solve rate with Claude Code and Sonnet 5.5

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(desktop): capture and export apps installed from a downloaded .deb

capture-desktop-application --package-file reads the file's control fields
with dpkg-deb and records its SHA-256, size and dependencies when it holds the
installed package; the file itself is never kept. The library walk now also
runs for local installs.

export-desktop-application --package-url declares agentenv's
Download(url, sha256) for that file, its dependencies and library packages as
apt packages, and a run script that installs it with dpkg.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): seed app-named dotfiles and respell UTF-16 seeds

The capture now treats dotfiles in the home named after the application
(.varicad-cfg.ini, .notesrc) as state roots, so a file the app only reads
during the capture is still seeded. The exported seeding respells the
captured home in UTF-16 text files with a byte-order mark, keeping the mark.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): hold readiness until the app's own window shows

An exported app is ready only once a window of its class that the taskbar
lists is shown, so a splash screen of the class, which skips the taskbar, no
longer counts as the app being up.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(desktop): record VariCAD captured, exported and run in an agentenv computer

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): keep exported views strict JSON for infinite and inexact numbers

The exported data/get spells infinite and negative-zero SQLite reals as REA's
SQLite reader does ("Infinity", "-Infinity", "-0"), and refuses a JSON file
holding a number that reading would change (1e999, integers past 2^53, -0,
rounded fractions) with the state view's own error, instead of a view with
an infinity in it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): keep package-file facts tied to one file and URLs unechoed

- A --package-url refusal never repeats the URL, and credentials are checked
  before the scheme.
- The package file's identity must hold between dpkg-deb's read and the hash.
- A failed close keeps its cleanup owner even when the capture is cancelled.
- Readiness also ignores windows typed as splash screens.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): record database logs and keep state changes distinct

- A selected path that is not a directory brings its -wal and -journal as
  content roots, so the capture records whether they exist and retains them.
- The state view treats a file as absent only under recorded content roots
  and refuses a database whose log presence is unknown.
- JSON changes list containers too, so an array that becomes an object with
  the same members is a change.
- Key file entries escape the key as a JSON pointer segment, so [a/b] c and
  [a] b/c stay apart.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): keep watching through unread samples and late workers

- An unreadable window list is unknown, not zero windows, and is named in
  the limitations.
- Before ending the session, live run-token carriers no parent link reached
  are tracked; an unreadable process table leaves the exit unknown.
- An env prefix's assignments find the program and name its XDG folders.
- flatpak run options that take a value are skipped with it, -- is honoured
  and a /arch/branch suffix is dropped from the id.
- State directories include the entry's full id.
- Path options refuse empty values; roots count toward the entry limit.
- A capture file whose close failed stays owned and is retried on discard.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): bound apt sources, keep older captures and cleanup owners

- Sources files parse into one stanza per line or deb822 paragraph with its
  URIs and suites kept as lists, so no URI x suite product is built.
- Repository architectures and release are optional, so captures written
  before they were recorded parse; the export treats them as unrestricted
  and unknown.
- Library sources are matched against every index of a declared
  repository's URI, suite and components.
- Two failures side by side keep both causes and both cleanup owners, and a
  host file whose close fails reports a lease on its handle.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): match escaped key file entries and suggest containers through members

- The draft's key file lookup uses the state view's escaped `group/key`, so a
  key holding `/` or `~` still gets its suggestion.
- JSON and XML changes now list containers too; the draft suggests an added
  or removed container through its listed members, and a container only
  when none of its members is listed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): read relative PATH entries from the launch folder

A program, or an empty or relative PATH entry, is resolved from the folder the
program starts in, as the launch does, so `env PATH=. app` with the entry's
Path still finds the app.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* perf(desktop): compare JSON views on one shared path

JSON and XML changes are found by walking both trees with one shared pointer
path, building a pointer only for a listed value, so memory follows depth
rather than every container's full path. A pointer over 4096 characters is
counted but not listed. A 256-level document with 4000-character keys went
from about 251 MiB of heap to under 1 MiB.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): keep JSON Lines as text in the exported reader

The exported reader parses the whole text before an inexact number makes it
JSON with an error, so JSON Lines with an integer above 2^53 stay text as in
REA. Over-long integer spellings are unsafe without converting them. The
guide no longer claims large integers keep their value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): keep the state-path help free of dash-led words

The CLI alias check reads `-wal` and `-journal` in help text as short flags,
so the help names the write-ahead log and rollback journal instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): never record or export apt source credentials

- Source URIs lose any user name and password as they are parsed, the way apt
  splits them, and so do index-target URIs and descriptions and the sources
  apt-cache policy lists, so matching works whether or not apt prints them.
- A repository whose entry held credentials is marked
  `uri_credentials_removed`, and the export refuses it, or an older capture
  whose URI still holds them, with a reason that names no URL.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): look programs up without normalizing their paths

Program paths and PATH entries are joined rather than resolved, so `..` after
a symbolic link means what it means to the launch. The lookup moves to its own
module.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): note inexact JSON numbers with a flag, not a list

The exported reader only needs to know whether any number was inexact, so it
keeps a boolean instead of every rejected spelling.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): refuse older captures that still hold apt credentials

A capture written before credentials were removed counted the credentialed
repository's libraries as installable, so the export refuses it whole and asks
for a new capture rather than declaring packages no source offers. Recorded
policy sources are redacted in export messages too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(desktop): keep the credential fixture on an example host

A login on a real host reads as a secret to the commit scanner, so the older
capture's fixture uses apt.example.com like the other credential tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): tidy looked-up paths and search relative entries only for env

Empty and `.` segments are dropped from a looked-up program path, which keeps
`/snap/bin/` entries recognisable as snaps, while `..` is still left for the
kernel. Relative and empty PATH entries are searched only in the PATH an `env`
prefix sets, which travels with the exported launch; the host's own PATH does
not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): keep excluded and unwalked database logs unknown

The capture records the paths every walk left out, and the state view treats
a log as absent only under content roots the baseline walked completely and
outside those exclusions, so an excluded or unvisited log leaves the database
unread rather than read without it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): judge JSON numbers after duplicate keys settle

The exported reader marks an inexact number instead of flagging it during the
parse, then looks for marks in the parsed value, so a number a later duplicate
key overwrote no longer refuses the file, as in REA.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): redact a repository's policy source when it names it

An older capture whose policy source matched no sources entry kept that text
whole, and the export named the repository by it; the export now names it
without any user name or password.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): never signal the launch group on unknown membership

When the current read cannot observe a carrier's process group, the carrier
is signalled on its own instead of letting an older process-table row grant
a group-wide SIGTERM.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): look programs up in the launch's order and refuse host-relative finds

The lookup searches PATH as the launch does, an empty entry meaning the
launch folder, so inspection and launch name the same program. A program found
only through a relative or empty entry of the host's own PATH is refused,
since the exported computer would not have it; an env prefix's PATH travels
with the command.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): count unchecked paths and keep logs behind them unknown

Each walk counts the paths it could not stat and the directories on another
device it did not enter, and the checkpoint records it as `unchecked_paths`.
The state view treats a log as absent only when the baseline left nothing
unchecked, so a log whose stat failed stays unknown.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* perf(desktop): scan parsed JSON with one iterator per level

The check for marked numbers walks the parsed value with an iterator per
nesting level instead of copying each container's children; a million-entry
array went from about 15.7 MiB to 8.1 MiB of peak traced memory.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(desktop): start a relative program from its captured folder

An exported launch whose program path is relative, such as `./app` from an
entry's Path, now changes to the captured working directory first, as it
already did for relative arguments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(electron): reject non-directory scenario roots before launch (#8967)

* fix(contracts): align managed example MethodDef scope (#8966)

* docs(debugger): document configurable session limits (#8963)

* docs(debugger): document configurable session limits

* docs(debugger): clarify GDB control command deadlines

* docs(debugger): qualify configurable GDB output budget

* docs(debugger): clarify one-shot CLI settings scope

* docs(debugger): preserve repository line endings

* docs(testing): explain npm launcher selection in PowerShell (#8962)

* docs(mcp): explain PowerShell launch environment scope (#8961)

* docs(mcp): explain PowerShell launch environment scope

* docs(mcp): qualify saved setup selections and OpenCode environment

* fix(native): declare temporary filesystem writes for inspect_macho (#8959)

* fix(environment): retain ID ordering with missing clocks (#8957)

* fix(environment): retain ID ordering with missing clocks

* fix(environment): compare known creation clocks across gaps

---------

Co-authored-by: hhang <[email protected]>

* fix(gpu): distinguish ELF string scan limits from corruption (#8955)

Co-authored-by: hhang <[email protected]>

* fix(setup): replace the fixed Hopper download deadline with a stall timeout (#7150)

* fix(setup): replace the fixed Hopper download deadline with a stall timeout

Hopper package downloads aborted after a fixed 120 s, which was also the
largest deadline the download owner accepted. The current 32 MB Linux
package needs about 132 s at the reporter's sustained 245 KB/s, so setup
could never finish on that connection, and the timeout surfaced only as
Node's generic abort message.

Abort a download when no response bytes arrive for 30 s, or when it
outlives a 15-minute overall bound, with a tagged
HopperDownloadTimeoutError that names the URL, the limit reached and the
bytes received. Linux and macOS setup already relay a thrown download
error's message; the Linux publisher now keeps it for release metadata
and public key fetches instead of a generic verification failure.
Metadata and key fetches keep their 10 s bound.

Refs #7077

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(setup): keep the macOS release feed on the metadata limit

The stall-timeout change left the macOS release feed fetch on the
package download bounds. That fetch could then wait up to 15 minutes
instead of the 120 s it had, while the installation guide says release
metadata keeps a 10 s limit. Only the Linux publisher owned that limit.

Move the 10 s metadata limit into HopperDownload.ts beside the package
bounds. The Linux feed and key fetches use it, and the macOS installer
now passes it for its feed fetch through the installer host.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(cli): parse environment-serve --port and --host like rea mcp --http (#7092)

* fix(cli): parse environment-serve --port and --host like rea mcp --http

environment-serve declared --port as a number, so incur coerced the flag text with Number(): an empty --port= bound an ephemeral port instead of failing, and 0x1F90 or 1e3 were reinterpreted. --host accepted whitespace. docs/cli.md says these flags resolve like rea mcp --http, which accepts only decimal port text and a non-empty trimmed host. The flags now use the same rules and are refused before binding.

* refactor(cli): reuse the shared MCP listener port and host schemas

* fix(adb): separate unresolvable paths and host capacity in adb spawn failures (#6188)

* fix(adb): name unexecutable adb paths in readiness refusals

When REA_ADB_PATH or the PATH-resolved adb is a directory or a file the
host refuses to execute, the version probe fails at spawn with EACCES or
EPERM. That fell through to the generic "did not report a usable version"
refusal, which named neither the path nor the cause.

Classify those spawn errors as binary_not_executable (provider rejection
executable_missing), name the selected path and errno, and give
remediation for the environment, PATH and host-policy cases. The generic
fallback now names the selected path too.

Fixes #5689

* fix(process): admit synchronous spawn errors as captured failures

Node throws spawn errors other than EACCES, EAGAIN, EMFILE, ENFILE and
ENOENT synchronously from execFile. execFileBytes called execFile inside
its Promise executor, so ENOTDIR or EPERM became a rejection without
capture fields and execFileOutputFailure returned undefined. Consumers
that classify by failure code, such as the adb version probe, could not
see the code, which left the adb EPERM branch unreachable.

Catch synchronous spawn errno errors at the capture boundary and attach
the same empty capture an asynchronous spawn failure carries. Argument
validation errors stay unadmitted.

The adb version probe now reports an ENOTDIR selected path, such as a
REA_ADB_PATH whose parent is a regular file, as a missing binary with
the filesystem error code instead of the generic version refusal.

* fix(process): expose spawn failures from the capture owner

execFileBytes knows when a command never started, but
ExecFileOutputFailure did not say so, so consumers reread raw syscall
and code fields and disagreed. Mark both the synchronous throw and an
asynchronous `spawn <path>` error with `spawnFailed: true`, and set
`path` on the synchronous error to match the asynchronous shape.
Argument validation errors stay unadmitted.

Consumers now use the owner field:

- inspectAdbClient never reports a spawn errno as `exit_code`. ENOENT,
  ENOTDIR, ELOOP and ENAMETOOLONG are `binary_missing`; EACCES and EPERM
  stay `binary_not_executable`; any other spawn errno, such as EINVAL,
  is `binary_not_executable` with a path-naming "could not be started"
  message. Each records `filesystem_error` and `path_source`. EACCES
  remediation also names parent directory search permission, and EPERM
  remediation no longer names host policy as the only cause.
- DarwinProcessRunTokenReader tags every not-started compiler as
  `spawn_failed`, not only ENOENT. EACCES, EPERM and ENOTDIR were
  previously `failed`.
- NativeDmgArtifactReader uses one not-started rule for both
  `processNotStarted` (previously `spawn ` only, so synchronous errors
  were missed) and the ENOENT unavailable/io split (previously any
  `spawn` prefix). Its fake hosts now reject with real execFileOutput
  spawn failures.

* fix(process): classify spawn failures consistently across consumers

Admit synchronous and asynchronous spawn errnos through one helper that
requires an errno and a `spawn` or `spawn <path>` syscall. The
synchronous shape now also gains `spawnargs`, so both shapes match.

Use the owner's `spawnFailed` fact in the remaining consumers:

- inspectAdbClient reports exhausted host capacity (EAGAIN, EMFILE,
  ENFILE, ENOMEM) as a host failure to retry and no longer tells the
  caller to change REA_ADB_PATH. Path-resolution errnos come from a
  predicate the filesystem owner exports.
- runAdbCapture says adb could not be started instead of claiming an
  exit code for a process that never ran.
- The Darwin compiler probe words every spawn_failed outcome as a start
  failure, not a compilation failure.
- Asset catalog inspection treats any assetutil that never started as
  unavailable, not only ENOENT.

* fix(process): report host spawn capacity as a retryable constraint

Spawn errnos that report exhausted host capacity (EAGAIN, EMFILE, ENFILE,
ENOMEM) were classified by adb readiness alone. assetutil reported them as
an unavailable tool, which marked inspect_asset_catalog unavailable in the
session, and adb commands reported them as protocol failures.

Classify them once in the process capture owner and report a retryable
capacity constraint with recovery advice from assetutil and adb commands.

* docs(adb): describe host capacity failures from device operations

* fix(adb): report exhausted host spawn capacity as runtime unavailability

A host that cannot start adb for lack of process, memory or descriptor
capacity is not a configuration problem. Give it its own failure code and
map it to the runtime_unavailable provider rejection instead of
not_configured.

* fix(adb): report probe-time host capacity as a retryable constraint

A device operation whose adb version probe could not start for lack of host
capacity was refused as capability_unavailable without retryable. It now
reports the same retryable capacity constraint as a later adb command.

* fix(adb): keep the selected adb path in probe-time capacity errors

The retryable capacity constraint raised at the version probe dropped the
selected_binary and path_source diagnostics the refusal used to carry.

* refactor(adb): keep the spawn-failure fact to adb consumers

Restore the DMG reader, Darwin compiler probe and assetutil to main. The
capture owner still marks a never-started command, including the spawn
errors Node throws synchronously, and only the adb readiness probe and
adb commands read that fact.

* test(adb): assert spawn-failure facts instead of refusal wording

The new adb tests compared complete refusal sentences and banned an old
phrase. They now check the errno, selected path, path source and the
owner's spawn-failure marker, so wording edits do not break them.

* fix(adb): own one host-capacity remediation and cover the spawn route

The host-capacity constraint and the configuration failure each carried their own remediation sentence. AdbConfiguration now owns the text and both use it, so the constraint's remediation.action equals diagnostics.remediation.

The synchronous spawn-throw test now runs on Node's execFile route and on the owned spawn route adb uses (stopSignal). The provider test covers inspect_adb_client under EMFILE next to list_adb_devices, and the docs say which operations report the retryable capacity constraint and which report runtime_unavailable.

* fix(process): report EMFILE and ENFILE spawn failures without stdio

After an EMFILE or ENFILE spawn failure Node creates no stdio, so the
owned stop-signal route threw a TypeError while reading the streams and
the later spawn error went unhandled. Attach the error listener first and
capture absent streams as empty, so adb reports retryable host capacity.

* fix(adb): keep a completed push when host capacity stops its digest check

A capacity failure starting sha256sum came back as a retryable error even
though adb push had already written the file. Repeating the request with
overwrite=false is then refused because the destination exists.

Return the receipt with an unavailable device digest and name the capacity
failure in its limitations, so the caller is told the transfer is unverified
rather than advised to retry.

* docs(adb): list host capacity as an unverified push case

---------

Co-authored-by: t <t@t>

* test(gdb): expect configurable stream truncation diagnostics (#8965)

* test(gdb): expect configurable stream truncation diagnostics

* build(gdb): include prerequisite duplicate-import repair from #8884

* fix(javascript): resolve module-level Electron options in functions (#8960)

* fix(javascript): resolve module-level Electron options in functions

* fix(javascript): limit module option ancestry walk

* fix(javascript): preserve uncertain captured argument ordering

* fix(javascript): retain hoisted activation uncertainty

* fix(javascript): retain function ownership through loops

* fix(javascript): account for classic global activations

* fix(javascript): bind first activations to lexical identities

* fix(javascript): retain uncertain global activation timing

* fix(javascript): isolate receiver facts and share computed reads

* fix(javascript): retain projected and opaque global activations

* fix(javascript): refresh activation bounds as opaque effects grow

* fix(ci): format website watch directories without changing configuration

* fix(javascript): share source reads across opaque-effect updates

* fix(javascript): retain constructed-code global activation bounds

* fix(javascript): share runtime activation and receiver facts

* fix(javascript): reuse pattern reads and function positions

* fix(javascript): isolate copied paths and preserve runtime reads

* style(javascript): format migrated reference imports

* fix(javascript): normalize constructor activation and receiver effects

* fix(javascript): retain aliased receiver timing and lexical global this

* fix(javascript): preserve effect-free receiver identity across activations

* fix(javascript): retain outer activation and prototype effects

* fix(javascript): index implicit reads without deep path rescans

* fix(javascript): retain aliased prototype and parameter read uncertainty

* fix(javascript): index reflected reads through intrinsic invocation facts

* fix(javascript): retain unresolved global activation reads

* chore: refresh PR branch after review fix publication

* fix(javascript): retain projected receiver reads and cache method facts

* fix(javascript): retain inherited and implicit activation reads

* fix(javascript): retain caller-owned this uncertainty

* fix(javascript): retain reflected reads with unresolved spread arguments

* fix(javascript): preserve enclosing activation for decorators

* fix(javascript): track intrinsic literal prototype effects

* fix(javascript): retain catch activation from implicit reads

* perf(javascript): reuse effective keys for projected reads

* fix(javascript): retain possible caller-owned ambient effects

* fix(uninstall): preserve caller-selected Kuna caches during purge (#7921)

* fix(uninstall): keep a managed cache namespace whole when it holds a caller-selected Kuna cache

purge --purge-data reported a REA_KUNA_CACHE_DIR selection below the default Kuna cache as retained, then removed it together with its parent namespace. A namespace that contains the selection is now retained and reported, so the retained report is true.

Fixes #7344

* fix(uninstall): also keep a namespace equal to, or reached by symlink traversal from, the selected Kuna cache

Compare the namespace and the selection with the same normalization, treat an equal path as contained, and resolve existing paths before planning so a symbolic link followed by .. is judged by where it leads.

* fix(uninstall): judge a selection with parent traversal where the filesystem resolves it

Collapsing .. lexically contradicts the existing rule that parent traversal after a symbolic link leads elsewhere, and broke the retained-through-symlink-traversal test. Compare spellings without .. directly and resolve existing paths for the rest, so the symlink-parent case still purges the default cache while a selection that resolves into a managed namespace is retained.

* fix(uninstall): keep a namespace whole when the selection's location is unknown

A realpath failure other than ENOENT/ENOTDIR (for example EACCES under an
inaccessible parent) no longer counts as "absent". Each namespace that may
contain the caller-selected Kuna cache is retained instead of purged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(changed-behavior): withhold equality for unknowns and contradictions (#7624)

find_changed_behavior derived behavior_status from each process
comparison's aggregate status alone. An unchanged comparison whose
first_divergence was unknown (residual unknowns prevent proving no
divergence) and a consistent contradiction comparison both fell
through to observed_unchanged, with no unresolved finding and no
changed-behavior registry unknown.

An unchanged comparison with unknown divergence now counts as unknown
and adds one comparison-level unresolved first_divergence finding
carrying its reason, as artifact comparisons already do for coverage.
A contradiction status makes the aggregate unknown, and contradiction
dimensions are classified and counted as contradictions instead of
unresolved branches. Complete unchanged comparisons stay
observed_unchanged and changed comparisons with unknown localization
stay observed_changed.

Fixes #7384
Fixes #7383

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(process): reject contradictory filesystem capture facts (#7631)

* fix(process): reject captures whose top-level filesystem facts contradict their checkpoints

A process capture records its filesystem state twice: files_before,
files_after and filesystem_effects at the top level, and the initial
and final filesystem_checkpoints. Validation never reconciled the two,
and comparison reads only the checkpoints. A caller-authored capture
recording a created file at the top level while its final checkpoint
was empty was therefore accepted and compared as unchanged.

Semantic validation now requires the initial checkpoint to match
files_before with no effects, and the final checkpoint to match
files_after and filesystem_effects. The native producer builds both
representations from the same snapshots, so produced captures are
unaffected; consistent created-file captures still compare as changed.

Fixes #7371

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(process): cover file-list checkpoint mismatches independently of effects

Every rejected case in the checkpoint-consistency test also disagreed on
effects, so removing both file-list comparisons left it passing. Add
initial and final checkpoint cases whose file lists alone disagree while
effects and coverage accounting stay valid.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(process): report deadlines expiring during final cleanup (#7635)

* fix(process): report a deadline that elapses during final cleanup as a timeout

runOwnedCommand checked its absolute command deadline before awaiting
process cleanup, but on the ordinary successful path it consulted only
the caller's cancellation signal afterwards. A command whose deadline
expired while successful cleanup was still awaited therefore resolved
as success.

After cleanup, an elapsed deadline now throws OwnedCommandFailure with
reason "timeout" and the completed snapshot, as docs/tool-design.md
requires a final signal check after the last awaited finalization step.
Existing primary failures, caller cancellation and incomplete-cleanup
classification keep their precedence.

Fixes #7369

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(process): drive the cleanup-deadline regression with controlled time

The regression test gave output collection 100 ms of real time before
the deadline. On a busy worker the deadline could expire during
collection instead, taking a different failure path and failing the
test even with the fix. Use fake timers, wait until cleanup has
started, then advance past the deadline and release cleanup, so the
ordering no longer depends on worker speed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(enhanced): bound batch decompile input size (#5937)

* fix(artifacts): handle early ASAR extraction cancellation (#5672)

* fix(artifacts): own source errors during output setup

* fix(artifacts): join silent source destruction before returning

* fix(artifacts): retain source cleanup failures with primary errors

* fix(artifacts): join source finalization and classify secondary failures

* fix(firmware): separate source cleanup from output rollback

* fix(artifacts): retain live source cleanup dependencies

* fix(artifacts): preserve source failure completion and semantics

* fix(artifacts): retain scope cleanup owners and typed failures

* fix(artifacts): keep cleanup classification and admission recovery

When the operation completed and only scope cleanup failed, keep the cleanup failure's own reason instead of reporting io, matching main (fixes artifactProvider.cleanupRetry). When a typed primary is rebuilt with pending scope cleanup, carry its userMessage and ASAR header admission so callers keep the configured ceiling and setting.

* fix(artifacts): translate plain file-close failures through the reader path

The outer file-cleanup branch rebuilt every ArtifactFileCleanupFailure as a
ProviderAdapterError, so dyld reads lost their io, unavailable, format and
cancelled reasons and their exact file-cleanup cause. Compose separately only
when the failed primary owns its own translation (a domain error, source
failure or scope cleanup failure); raw and reader primaries are already
projected by the file failure with its exact lease.

* fix(artifacts): bound source destruction by cancellation and keep wrapper admission

After cancellation, SafeOutputTree.write could wait indefinitely for a source
whose destruction did not settle, both in the destroy join and in the
iterator's wait for close. Both waits now end at cancellation plus a fixed 1 s
grace, modeled on the process-output closure grace. A destruction that
outlives it is reported as incomplete source cleanup under an exact lease that
releases only once closure is observed without a late error.

ArtifactResourceCleanupFailure and SafeOutputSourceFailure now keep the
primary's admission, matching withCleanup.

* fix(artifacts): keep one settled wait while observing a stuck source

observeClosure raced the same pending close promise against a new timer every
10 ms, so a source whose destruction never settled accumulated one reaction per
poll for as long as it stayed open. Each poll now waits on its own promise that
the close listener or the unref'd timer settles, leaving one pending wait and
one close listener. The lifecycle test also asserts that a late close releases
the retained owner without an explicit retry.

* fix(artifacts): settle pending reads before cancellation

* test(artifacts): observe the consumed ZIP iterator on cancellation

* test(artifacts): validate projected cleanup resources before sorting

* test(mcp): reserve parent capacity for timeout recovery

* fix(artifacts): contain ASAR cancellation before output consumption

* test(artifacts): hash ASAR cancellation fixture bytes

* fix(decompile): retain inventory limitations and selection (#8466)

* fix(decompile): retain inventory limitations with the latest selection

The manifest and decompile index dropped procedure-inventory
limitations, so a directory separated from its Evidence response could
not explain why functions were selected or omitted. Keep those
limitations on the manifest and in a latest_run index record that also
names the filter and counts that produced them. Older runs remain
represented only by their retained function records.

Fixes #8355

* test(decompile): surface export errors and check function caveats

Address review findings on the inventory-limitation regression:

- Throw the typed export error instead of returning from a failed Result.
- Assert historical function records keep their own pseudocode caveats
  and do not receive the latest inventory warnings.

* fix(pyinstaller): leave PE carrier binary members unmarked (#6730)

The Windows bootloader sets no execute bit on extracted ARCHIVE_ITEM_BINARY
members (the S_IXUSR fchmod in pyi_archive.c is #ifndef WIN32). Mark type b
members executable only when the carrier dialect is posix.

* fix(jeb): reconnect after stale MCP sessions (#3754)

* fix(jeb): reconnect after stale MCP sessions

* fix(jeb): preserve failures for overlapping MCP requests

* fix(jeb): make cleanup operations explicit and stabilize timeout fixtures

* fix(setup): flag unresolved migrated Claude Desktop storage (#8971)

* fix(setup): flag unresolved migrated Claude Desktop storage

* fix(setup): preserve Claude MSIX process view when config is unresolved

* fix(enhanced): restore batch input record limit

* docs(tool-design): audit agent workflow guidance (#8439)

* docs(tool-design): audit agent workflow guidance

* docs(tool-design): check deployed guidance versions

* fix(cli): align ADB directory and package query schemas (#8974)

* fix(cli): align ADB directory and package query schemas

* fix(cli): preserve ADB selector correction details

* fix(devicetree): reject duplicate node paths in Evidence (#8970)

* fix(pe): classify valid DOS targets as unsupported (#7530)

fix(pe): classify confirmed DOS targets as unsupported

Signed-off-by: Rudy Celekli <[email protected]>

* fix(native): reject nonzero reserved ELF dynamic symbols (#7528)

fix(native): validate the reserved ELF dynamic symbol

Signed-off-by: Rudy Celekli <[email protected]>

* fix(evidence): traverse large source link sets safely (#8457)

* fix(verification): use inspected Ghidra JDK (#8440)

* fix(mcp): clarify retained dossier handoff in crash prompt (#8437)

* fix(evidence): clarify unsupported view recovery (#8412)

* fix(evidence): clarify unsupported view recovery

* fix(evidence): explain sensitive capture view refusal

* test(ghidra): check regex recovery at its owning boundary (#8578)

* test(ghidra): check structured snapshot profile mismatch (#8536)

* test(ghidra): check retained historical snapshot evidence (#8381)

* test(ghidra): check retained historical snapshot evidence

* test(ghidra): select historical observations by address

* test(cli): cover Frida argument admission and spawn ordering (#3356)

* fix(cli): reject spawn arguments in Frida attach mode

* test(cli): remove redundant Frida recorder assignments

---------

Co-authored-by: Kaoru0822 <[email protected]>

* fix(ghidra): report restricted-host temp write denial on Windows (#8889)

* fix(ghidra): report restricted-host temp write denial on Windows

Add a Windows doctor check that creates and deletes a file under os.tmpdir(), and classify a denied java_home.save in Ghidra startup output with its path, Win32 error 5, and TMP/TEMP remediation. The probe covers REA's own process only; a host that restricts only child processes is reported from the child's output at startup.

Fixes #7075

* fix(ghidra): probe the session root and retain failed probe cleanup

The Windows doctor temp_directory probe now writes under ghidraSessionRoot(), the same root Ghidra session runtimes use, instead of os.tmpdir(), which can differ when the inherited temp path has a dot-prefixed element. A probe file whose removal fails is retained on the doctor resource owner so doctor shutdown retries the removal; the result still reports its path.

* fix(cli): normalize exit status on worker cleanup failure (#8049) (#8050)

* fix(cli): normalize exit status on worker cleanup failure (#8049)

* test(cli): verify SDK output status and finalization rejection on exit

* ci: retrigger checks

---------

Co-authored-by: Sarthak Pandey <[email protected]>

* fix(gdb): keep inferior-tty verification for read-only queries (#5539)

* fix(gdb): keep TTY verification across read-only inferior-tty inspection

The console command path cleared `inferiorTtyVerified` before dispatching
any command whose text merely mentioned `inferior-tty`, so the read-only
`show inferior-tty` query permanently revoked a persistent session's
verified output sink; no in-session path ever restored the flag, and a
later close of a live session failed detach verification with
capability_unavailable.

Exempt the exact read-only query forms (`show inferior-tty` and the MI
`-inferior-tty-show`) from the output-mutation predicate; every other
command mentioning the TTY setting keeps revoking, so mutating commands
still fail closed and detach keeps re-reading the live TTY before
detaching. Cover the query forms, composite commands, and the
inspect-then-close detach path with regression tests.

Fixes #5099

* test(gdb): classify show inferior-tty in the one-shot table and rename the TTY classification table

- Add a 'show inferior-tty' row to the 'classifies one-shot GDB
  commands' table: the read-only query no longer invalidates the detach
  proof, a user-visible one-shot behavior change.
- Rename the 'classifies read-only inferior TTY queries as non-mutating'
  table to 'classifies inferior TTY commands' since two of its rows are
  mutation cases.
- Assert via the existing recorded-commands array that the inspected
  'show inferior-tty' text is actually dispatched, and add an
  execute-path assertion that the MI '-inferior-tty-show' form leaves
  the verified-sink flag intact (defensive exemption: REA's own MI calls
  do not route through this gate).

---------

Co-authored-by: akushonkamen <[email protected]>

* fix(browser): report an out-of-range generated position as a selection fault (#7133)

trace_web_source_location reported a well-formed generated_position past
the end of the selected script as invalid_format on generated_position,
with no bounds, so callers were told their input was malformed and not
which coordinate to change. Report out_of_range on the line or column
that is past the end, with its valid bounds, as export_web_scripts and
inspect_web_network_capture now do for their selections.

The position scan now returns the bound it ran past, so the offset and
the reported limit come from one pass and cannot disagree on line
terminators.

Fixes #7132

* fix(captures): classify unresolvable capture paths as capture_path input (#7814)

* fix(captures): classify unresolvable capture paths as capture_path input

Fixes #7636

* test(captures): cover unresolvable descriptor paths

---------

Co-authored-by: Abelo9996 <[email protected]>
Co-authored-by: morluto <[email protected]>

* fix(apple): preserve exact integer precision with post-table plist objects (#8910)

* fix(javascript): resolve electron findings through aliases of interop results (#8914)

* fix(javascript): resolve electron findings through aliases of interop results

* fix(javascript): resolve interop aliases iteratively and check target mutations

* fix(javascript): retain possible writes through uncertain aliases and guard positive reads

* perf(javascript): cache alias change status across semantic interop lookups

* fix(javascript): transient Windows private-runtime source-transfer (#8769)

* fix(javascript): transient Windows private-runtime source-transfer

Parent source-transfer into the Windows private runtime root failed with
EPERM on path-based exclusive create. Write through a native transient
private-runtime path that closes the handle after flush so per-job rm
still works, and yield around the sync write so abort deadlines can fire.

* fix(javascript): yield timer phase before Windows source-transfer write

* fix(il2cpp): reject module image references outside retained inventory (#8956)

* fix(ida): admit Docker host-gateway names as local MCP hosts (#8932)

Containerized REA reaches an IDA MCP server on the container host through
host.docker.internal (Docker, Podman compatibility) or
host.containers.internal (Podman). The HTTP registration refinement only
admitted localhost, 127.0.0.1 and [::1], so doctor reported the valid
gateway registration as invalid_configuration.

Admit both gateway names in the registration's local-host set. The
refinement still requires http or https, no URL credentials, and refuses
every other host.

Fixes #8925

* fix(mcp): report target after failed open (#8613)

* fix(mcp): report target after failed open

* test(session): cover failed open receipt ownership

* test(session): verify restored target receipt

* test(mcp): retain target on snapshot mismatch

* test(mcp): retain oversized open failure receipts

* test(cli): avoid continuing session receipt in one-shot errors

* fix(mcp): report provider after failed switch

* test(ghidra): verify failed open preserves annotations

* test(mcp): join queued receipt request before cleanup

* test(session): assert open failure receipts in lifecycle suites

* test(session): keep open-failure receipt checks within function limits

Move the provider-collision case and snapshot fixture setup out of the
functions that grew when both failure receipts were asserted.

---------

Co-authored-by: Cursor Agent <[email protected]>

* fix(prompts): include existing static artifact investigation routes (#8972)

* fix(prompts): include existing static artifact investigation routes

* fix(prompts): preserve workflows in existing family scopes

* fix(prompts): require readers for Apple resource routes

* fix(rizin): keep debug targets off the debugger command stream (#8647)

* fix(rizin): keep debug targets off the debugger command stream

A Rizin debug target inherited Rizin's stdin, which is REA's command
stream. Once resumed, a target that reads stdin consumed REA's commands,
so close return…
@chordpli
chordpli deleted the fix/adb-client-unusable-path branch November 6, 2026 02:10
@morluto morluto mentioned this pull request Nov 11, 2026
3 tasks done
@morluto morluto added bug Something isn't working area: runtime Process capture and runtime observation labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants